Skip to content

Commit

Permalink
Use rocprofiler-sdk-roctx in roctxconnector when available
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenarnst committed Dec 16, 2024
1 parent a9453b2 commit 55e46a1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-with-kokkos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- image: nvidia/cuda:12.2.0-devel-ubuntu22.04
preset: Cuda
compiler: {cpp: g++-12, c: gcc-12}
- image: rocm/dev-ubuntu-22.04:5.4
- image: rocm/dev-ubuntu-22.04:5.7
preset: ROCm
compiler: default
- image: rocm/dev-ubuntu-22.04:5.7
- image: rocm/dev-ubuntu-22.04:6.3
preset: ROCm
compiler: default
container:
Expand Down
21 changes: 16 additions & 5 deletions profiling/roctx-connector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
find_library(ROCM_ROCTX_LIB roctx64 REQUIRED HINTS $ENV{ROCM_PATH}/lib)
find_path(ROCM_ROCTX_INCLUDE roctx.h REQUIRED HINTS $ENV{ROCM_PATH}/include/roctracer)

kp_add_library(kp_roctx_connector kp_roctx_connector.cpp)

target_include_directories(kp_roctx_connector PRIVATE ${ROCM_ROCTX_INCLUDE})
target_link_libraries(kp_roctx_connector PRIVATE ${ROCM_ROCTX_LIB})
# As of ROCm 6.2, it is recommended to use ROCtx provided by rocprofiler-sdk-roctx
# instead of the "old" one provided by roctracer.
#
# See also: https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/amd-mainline/how-to/using-rocprofv3.html
find_package(rocprofiler-sdk-roctx CONFIG PATHS $ENV{ROCM_PATH} PATH_SUFFIXES "lib/cmake/rocprofiler-sdk-roctx")
if(rocprofiler-sdk-roctx_FOUND)
target_link_libraries(kp_roctx_connector PRIVATE rocprofiler-sdk-roctx::rocprofiler-sdk-roctx)

target_compile_definitions(kp_roctx_connector PRIVATE KP_ROCTXCONNECTOR_HAVE_ROCPROFILER_SDK_ROCTX)
else()
find_library(ROCM_ROCTX_LIB roctx64 REQUIRED HINTS $ENV{ROCM_PATH}/lib)
find_path(ROCM_ROCTX_INCLUDE roctx.h REQUIRED HINTS $ENV{ROCM_PATH}/include/roctracer)

target_include_directories(kp_roctx_connector PRIVATE ${ROCM_ROCTX_INCLUDE})
target_link_libraries(kp_roctx_connector PRIVATE ${ROCM_ROCTX_LIB})
endif()
6 changes: 5 additions & 1 deletion profiling/roctx-connector/kp_roctx_connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
//
//@HEADER

#include <roctx.h>
#ifdef KP_ROCTXCONNECTOR_HAVE_ROCPROFILER_SDK_ROCTX
#include "rocprofiler-sdk-roctx/roctx.h"
#else
#include "roctx.h"
#endif

#include <cstdint>
#include <iostream>
Expand Down

0 comments on commit 55e46a1

Please sign in to comment.