NVTX not found / nvtxRangePushEx unresolved due to nvToolsExt → NVTX v3 transition
Build fails when enabling NVTX because CMake (or dependencies) still require `CUDA::nvToolsExt` (legacy shared lib). With modern CUDA, NVTX v3 is header‑only (`nvtx3/…`), and starting **CUDA 12.9** the legacy `nvToolsExt` library was **removed**, so `CUDA::nvToolsExt` can’t be found. Also, code should include v3 headers (`nvtx3/nvToolsExt.h` or `nvtx3.hpp`) rather than legacy paths. [\[cmake.org\]](https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html) [\[developer.nvidia.com\]](https://developer.nvidia.com/blog/cuda-pro-tip-generate-custom-application-profile-timelines-nvtx/), [\[nvidia.github.io\]](https://nvidia.github.io/NVTX/)
**Suggested fixes** (... by copilot)
* **CMake:** Prefer `CUDA::nvtx3`; only fall back to `CUDA::nvToolsExt` on older toolkits.
```cmake
find_package(CUDAToolkit REQUIRED)
if (TARGET CUDA::nvtx3)
target_link_libraries(my_target PRIVATE CUDA::nvtx3)
elseif (TARGET CUDA::nvToolsExt)
target_link_libraries(my_target PRIVATE CUDA::nvToolsExt)
else()
message(FATAL_ERROR "NVTX not available (nvtx3 or nvToolsExt).")
endif()
```
(CMake’s `FindCUDAToolkit` documents `CUDA::nvtx3` and notes `nvToolsExt` is deprecated and removed in CUDA 12.9.) [\[cmake.org\]](https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html)
* **Includes:** Update sources to use NVTX v3 headers:
```c
#include <nvtx3/nvToolsExt.h> // C API (e.g., nvtxRangePushEx)
// or
#include <nvtx3/nvtx3.hpp> // C++ helpers
```
(NVTX v3 is header‑only; no legacy lib linking required.) [\[developer.nvidia.com\]](https://developer.nvidia.com/blog/cuda-pro-tip-generate-custom-application-profile-timelines-nvtx/), [\[nvidia.github.io\]](https://nvidia.github.io/NVTX/)
* **Fortran builds (if applicable):** When using NVIDIA HPC SDK, link the provided NVTX wrapper so Fortran can call NVTX v3 (e.g., add `-cudalib=nvtx` or link `libnvhpcwrapnvtx`). [\[docs.nvidia.com\]](https://docs.nvidia.com/hpc-sdk/compilers/fortran-cuda-interfaces/cfnvtx-runtime.html)
**Environment notes**
The failure typically appears after upgrading to CUDA ≥ 12.9 or when dependencies hard‑require `CUDA::nvToolsExt`. Please confirm CUDA & CMake versions and switch to `CUDA::nvtx3` where available. [\[cmake.org\]](https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html)
**References**
* CMake `FindCUDAToolkit`: NVTX targets, `nvToolsExt` deprecation/removal, `nvtx3` usage. [\[cmake.org\]](https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html)
* NVTX v3 is header‑only; use `nvtx3/` includes (no legacy linking). [\[developer.nvidia.com\]](https://developer.nvidia.com/blog/cuda-pro-tip-generate-custom-application-profile-timelines-nvtx/), [\[nvidia.github.io\]](https://nvidia.github.io/NVTX/)
* Fortran wrapper in NVIDIA HPC SDK (`-cudalib=nvtx` / `libnvhpcwrapnvtx`). [\[docs.nvidia.com\]](https://docs.nvidia.com/hpc-sdk/compilers/fortran-cuda-interfaces/cfnvtx-runtime.html)
issue