Skip to content

Commit 09b0f54

Browse files
author
Devin Prescott
committed
Update CMakeLists.txt to link new header files for NVTX v3 for CUDA 12.9+
1 parent 565178a commit 09b0f54

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,10 +524,21 @@ function(MFC_SETUP_TARGET)
524524
target_compile_options(${a_target} PRIVATE "SHELL:-h noacc" "SHELL:-x acc")
525525
endif()
526526

527-
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" OR CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
528-
find_package(CUDAToolkit REQUIRED)
529-
target_link_libraries(${a_target} PRIVATE CUDA::nvToolsExt)
527+
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" OR
528+
CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
529+
530+
# Ask specifically for the header-only NVTX v3 interface
531+
find_package(CUDAToolkit REQUIRED COMPONENTS nvtx3)
532+
533+
if (TARGET CUDA::nvToolsExt) # CUDA <= 12.8
534+
target_link_libraries(${a_target} PRIVATE CUDA::nvToolsExt)
535+
else() # CUDA >= 12.9
536+
target_link_libraries(${a_target} PRIVATE CUDA::nvtx3)
537+
endif()
538+
target_link_options(${a_target} PRIVATE "-cudalib=nvtx")
539+
530540
endif()
541+
531542
endforeach()
532543

533544
install(TARGETS ${ARGS_TARGET} RUNTIME DESTINATION bin)

0 commit comments

Comments
 (0)