From cd200c6c2d21806d7ba064f4edf45a5c94094286 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Sat, 13 Aug 2022 13:20:57 +0300 Subject: FindCUDAToolkit: nvtx3 target nvtx3 is a header-only replacement for the previous shared library implementations. I implemented it as a separate target since while the header names match and ideally it should be API compatible, forcing its include directory into the old target would lengthen the include search path and could cause confusion or possible build differences for projects using multiple build systems. This keeps it explicit as a developer opt-in. Implements: #21377 Resolves: #23835 --- Help/release/dev/find-cuda-toolkit-nvtx3.rst | 8 +++++++ Modules/FindCUDAToolkit.cmake | 32 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Help/release/dev/find-cuda-toolkit-nvtx3.rst diff --git a/Help/release/dev/find-cuda-toolkit-nvtx3.rst b/Help/release/dev/find-cuda-toolkit-nvtx3.rst new file mode 100644 index 0000000..b16ed9f --- /dev/null +++ b/Help/release/dev/find-cuda-toolkit-nvtx3.rst @@ -0,0 +1,8 @@ +find-cuda-toolkit-nvtx3 +----------------------- + +* The :module:`FindCUDAToolkit` module now provides a target for + :ref:`nvtx3 ` for CUDA 10.0+, which supersedes + :ref:`nvToolsExt `. A deprecation warning is emitted + when using ``nvToolsExt`` if the project requires CMake 3.25 and CUDA 10.0+ + is used. diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 538e132..c1368da 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -121,6 +121,7 @@ of the following libraries that are part of the CUDAToolkit: - :ref:`nvidia-ML` - :ref:`nvRTC` - :ref:`nvToolsExt` +- :ref:`nvtx3` - :ref:`OpenCL` - :ref:`cuLIBOS` @@ -362,6 +363,8 @@ Targets Created: nvToolsExt """""""""" +.. deprecated:: 3.25 With CUDA 10.0+, use :ref:`nvtx3 `. + The `NVIDIA Tools Extension `_. This is a shared library only. @@ -369,6 +372,20 @@ Targets Created: - ``CUDA::nvToolsExt`` +.. _`cuda_toolkit_nvtx3`: + +nvtx3 +""""" + +.. versionadded:: 3.25 + +The header-only `NVIDIA Tools Extension Library `_. +Introduced in CUDA 10.0. + +Targets created: + +- ``CUDA::nvtx3`` + .. _`cuda_toolkit_opencl`: OpenCL @@ -1011,6 +1028,21 @@ if(CUDAToolkit_FOUND) endif() _CUDAToolkit_find_and_add_import_lib(nvToolsExt ALT nvToolsExt64) + if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.0) + # nvToolsExt is deprecated since nvtx3 introduction. + # Warn only if the project requires a sufficiently new CMake to make migration possible. + if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_GREATER_EQUAL 3.25) + set_property(TARGET CUDA::nvToolsExt PROPERTY DEPRECATION "nvToolsExt has been superseded by nvtx3 since CUDA 10.0 and CMake 3.25. Use CUDA::nvtx3 and include instead.") + endif() + + # Header-only variant. Uses dlopen(). + if(NOT TARGET CUDA::nvtx3) + add_library(CUDA::nvtx3 INTERFACE IMPORTED) + target_include_directories(CUDA::nvtx3 SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}") + target_link_libraries(CUDA::nvtx3 INTERFACE ${CMAKE_DL_LIBS}) + endif() + endif() + _CUDAToolkit_find_and_add_import_lib(OpenCL) endif() -- cgit v0.12