Skip to content

Commit

Permalink
Add roctracer support
Browse files Browse the repository at this point in the history
  • Loading branch information
td-mpcdf committed Jan 3, 2024
1 parent 579fb24 commit d80c357
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ if ("hip" IN_LIST GTENSOR_BUILD_DEVICES)
target_compile_definitions(gtensor_hip INTERFACE GTENSOR_USE_THRUST)
endif()

target_include_directories(gtensor_hip INTERFACE ${ROCM_PATH}/include/roctracer)
target_link_libraries(gtensor_hip INTERFACE ${ROCM_PATH}/lib/libroctracer64.so)
target_link_libraries(gtensor_hip INTERFACE roc::rocthrust)

if (HIP_GCC_TOOLCHAIN)
Expand Down
5 changes: 5 additions & 0 deletions src/fortran/gpu_api.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "cuda_runtime_api.h"
#elif defined(GTENSOR_DEVICE_HIP)
#include "hip/hip_runtime.h"
#include "roctracer_ext.h"
#endif

#ifdef GTENSOR_DEVICE_SYCL
Expand Down Expand Up @@ -57,13 +58,17 @@ extern "C" void gpuProfilerStart()
{
#ifdef GTENSOR_DEVICE_CUDA
gtGpuCheck(cudaProfilerStart());
#elif defined(GTENSOR_DEVICE_HIP)
roctracer_start();
#endif
}

extern "C" void gpuProfilerStop()
{
#ifdef GTENSOR_DEVICE_CUDA
gtGpuCheck(cudaProfilerStop());
#elif defined(GTENSOR_DEVICE_HIP)
roctracer_stop();
#endif
}

Expand Down

0 comments on commit d80c357

Please sign in to comment.