Skip to content

Commit

Permalink
Clearer error message and HIP architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
td-mpcdf committed Dec 20, 2024
1 parent f769ce5 commit e041934
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ else()
endif()
set(HIP_PATH "${ROCM_PATH}/hip" CACHE STRING "path to HIP installation")
if(GTENSOR_GPU_ARCHITECTURES STREQUAL "default")
set(HIP_GPU_ARCHITECTURE "gfx90a")
set(CMAKE_HIP_ARCHITECTURES "gfx90a")
else()
set(CMAKE_CUDA_ARCHITECTURES ${GTENSOR_GPU_ARCHITECTURES})
set(CMAKE_HIP_ARCHITECTURES ${GTENSOR_GPU_ARCHITECTURES})
endif()

# SYCL specific configuration
Expand Down Expand Up @@ -201,8 +201,8 @@ if ("hip" IN_LIST GTENSOR_BUILD_DEVICES)
target_compile_definitions(gtensor_hip INTERFACE GTENSOR_HAVE_DEVICE)
target_compile_definitions(gtensor_hip INTERFACE GTENSOR_DEVICE_HIP)

set(GPU_TARGETS "${HIP_GPU_ARCHITECTURES}"
CACHE STRING "GPU targets to compile for")
#set(GPU_TARGETS "${HIP_GPU_ARCHITECTURES}"
# CACHE STRING "GPU targets to compile for")
find_package(hip REQUIRED)
find_package(rocthrust REQUIRED)

Expand Down
6 changes: 4 additions & 2 deletions include/gtensor/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ inline auto gpuGetLastError() { return cudaGetLastError(); }
inline void gtLaunchCheck(dim3 numblocks, dim3 numthreads, const char* file,
int line)
{
if (hipGetLastError() != hipSuccess) {
fprintf(stderr, "launch failed %s %d\n", file, line);
hipError_t last_error = hipGetLastError();
if (last_error != hipSuccess) {
fprintf(stderr, "launch failed %s %d, error_code: %d\n", file, line,last_error);
fprintf(stderr, "(%s)\n", hipGetErrorString(last_error));
fprintf(stderr, "blocks was [%d, %d, %d]\n", numblocks.x, numblocks.y,
numblocks.z);
fprintf(stderr, "threads was [%d, %d, %d]\n", numthreads.x, numthreads.y,
Expand Down

0 comments on commit e041934

Please sign in to comment.