Skip to content

Commit 518d350

Browse files
authored
Modernize roctx Annotations (#4523)
## Summary ROCm annotations (roctx) for ROCm profiling tools have been modernized in ROCm 6.2+. Use the new modules and tooling support now. - [x] CMake - [x] GnuMake - [x] [Includes](ROCm/roctracer#56 (comment)) - [x] [Markers](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/how-to/using-rocprofiler-sdk-roctx.html#how-to-use-roctx-in-your-application) Tested on LLNL Tuolumne with ROCm 6.4.1. ## Additional background See ROCm/roctracer#56 (comment) Attention: ROCm/rocprofiler-systems#266 ## Checklist The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [x] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
1 parent 1d307c2 commit 518d350

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

Src/Base/AMReX_GpuDevice.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@
3131
#if defined(AMREX_USE_HIP)
3232
#include <hip/hip_runtime.h>
3333
#if defined(AMREX_USE_ROCTX)
34-
#include <roctracer/roctracer_ext.h>
35-
#if defined(AMREX_PROFILING) || defined (AMREX_TINY_PROFILING)
36-
#include <roctracer/roctx.h>
37-
#endif
34+
#include <rocprofiler-sdk-roctx/roctx.h>
3835
#endif
3936
#endif
4037

@@ -1062,7 +1059,7 @@ Device::profilerStart ()
10621059
#ifdef AMREX_USE_CUDA
10631060
AMREX_GPU_SAFE_CALL(cudaProfilerStart());
10641061
#elif (defined(AMREX_USE_HIP) && defined(AMREX_USE_ROCTX))
1065-
roctracer_start();
1062+
roctxProfilerResume(0);
10661063
#endif
10671064

10681065
}
@@ -1073,7 +1070,7 @@ Device::profilerStop ()
10731070
#ifdef AMREX_USE_CUDA
10741071
AMREX_GPU_SAFE_CALL(cudaProfilerStop());
10751072
#elif (defined(AMREX_USE_HIP) && defined(AMREX_USE_ROCTX))
1076-
roctracer_stop();
1073+
roctxProfilerPause(0);
10771074
#endif
10781075
}
10791076

Src/Base/AMReX_TinyProfiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#endif
2626

2727
#if defined(AMREX_USE_HIP) && defined(AMREX_USE_ROCTX)
28-
#include <roctracer/roctx.h>
28+
#include <rocprofiler-sdk-roctx/roctx.h>
2929
#endif
3030

3131
#include <algorithm>

Tools/CMake/AMReXParallelBackends.cmake

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,17 +302,9 @@ if (AMReX_HIP)
302302
endif()
303303

304304
if(AMReX_ROCTX)
305+
find_package(rocprofiler-sdk-roctx REQUIRED CONFIG)
305306
foreach(D IN LISTS AMReX_SPACEDIM)
306-
# To be modernized in the future, please see:
307-
# https://github.com/ROCm-Developer-Tools/roctracer/issues/56
308-
target_include_directories(amrex_${D}d SYSTEM PUBLIC
309-
${HIP_PATH}/../roctracer/include
310-
${HIP_PATH}/../rocprofiler/include
311-
)
312-
target_link_libraries(amrex_${D}d PUBLIC
313-
"-L${HIP_PATH}/../roctracer/lib -lroctracer64"
314-
"-L${HIP_PATH}/../roctracer/lib -lroctx64"
315-
)
307+
target_link_libraries(amrex_${D}d PUBLIC rocprofiler-sdk-roctx::rocprofiler-sdk-roctx)
316308
endforeach()
317309
endif()
318310
foreach(D IN LISTS AMReX_SPACEDIM)

Tools/GNUMake/comps/hip.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ ifeq ($(HIP_COMPILER),clang)
132132
CXXFLAGS += -DAMREX_USE_ROCTX
133133
HIPCC_FLAGS += -DAMREX_USE_ROCTX
134134
LIBRARY_LOCATIONS += $(ROC_PATH)/lib
135-
LIBRARIES += -Wl,--rpath=$(ROC_PATH)/lib -lroctracer64 -lroctx64
135+
LIBRARIES += -Wl,--rpath=$(ROC_PATH)/lib -lrocprofiler-sdk-roctx
136136
endif
137137

138138
# hipcc passes a lot of unused arguments to clang

0 commit comments

Comments
 (0)