Open dkolsen-pgi opened 2 weeks ago
I don't really see what we can do above and beyond what we already provide. The nvToolsExt.h
header is deprecated and slated to be removed from the CTK.
A person's options are:
nvToolsExt.h
-DCCCL_DISABLE_NVTX
CUB can deal with this by adding something like this to the CUB header:
#if defined(NVTX_VERSION) && NVTX_VERSION < 3
#define CCCL_DISABLE_NVTX 1
#endif
The situation is actually more complex. While we can workaround your example by disabling NVTX3 inside CUB:
#include <nvToolsExt.h>
// NVTX_VERSION is defined to 2
#include <thrust/reduce.h> // CUB sees NVTX_VERSION == 2 and disables NVTX3
int main() { }
We cannot workaround a swapped order of includes:
#include <thrust/reduce.h> // CUB sees no NVTX_VERSION and includes NVTX3
#include <nvToolsExt.h> // clashes with NVTX3 symbols
int main() { }
See: https://cuda.godbolt.org/z/PTq64P4dr
Given we can only provide half a workaround, I would rather not have it at all. The final order of includes can be unpredictable sometimes, so users would only be surprised that they can use NVTX2 in some TUs and not in others. Or a refactoring of their headers would suddently break, because NVTX2 and NVTX3 include order changed. That sounds very brittle. I think users should rather take note of mixing APIs deterministically and start to migrate away from NVTX2.
Is this a duplicate?
Type of Bug
Compile-time Error
Component
CUB
Describe the bug
As of CUDA 12.6, CUB includes NVTX version 3 headers. If a source file includes an earlier version of NVTX and then includes a CUB header, then the NVTX version 3 header will
#error
out with "Trying to #include NVTX version 3 in a source file where an older NVTX version has already been included." The CUDA Toolkit contains headers for NVTX version 2, so it is quite easy for users to hit this compilation error. (See the steps to reproduce for a trivial example.)How to Reproduce
Expected behavior
CUB should not fail with a compilation error if
<nvToolsExt.h>
has been included before CUB is included.Reproduction link
No response
Operating System
No response
nvidia-smi output
No response
NVCC version
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2024 NVIDIA Corporation Built on Fri_Jun_14_16:34:21_PDT_2024 Cuda compilation tools, release 12.6, V12.6.20 Build cuda_12.6.r12.6/compiler.34431801_0