[BUG]: CMake fails when using nvc++ as a c++ compiler
Is this a duplicate?
- [x] I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
Type of Bug
Something else
Component
Thrust
Describe the bug
After this commit: https://github.com/NVIDIA/cccl/commit/4f5c28783cd17926decebc274d9f68982b91b183
when using nvc++ as a c++ compiler, CMake fails with this error:
CMake Error at cmake/CCCLBuildCompilerTargets.cmake:34 (message):
CCCL developer builds require that CMAKE_CUDA_HOST_COMPILER exactly matches
CMAKE_CXX_COMPILER when using nvcc:
How to Reproduce
cmake /path/to/cccl
Expected behavior
To see thrust tests/examples being pulled and passed successfully.
Reproduction link
No response
Operating System
No response
nvidia-smi output
No response
NVCC version
No response
This is expected when CMake has different settings for the CUDA host compiler and C++ compiler. Our build system for tests/examples requires that the CXX and CUDA_HOST compilers match. Try:
cmake -DCMAKE_CXX_COMPILER=nvc++ -DCMAKE_CUDA_HOST_COMPILER=nvc++ /path/to/cccl
These can also be set using the CXX and CUDAHOSTCXX environment variables.
Do we always need to set CUDA-related environment variables, even if the tests are not meant to be compiled for the device? It seems that CUDA_COMPILER and CUDA_HOST_COMPILER are required even for host-only tests. Can we separate them?
Can you share the full cmake command you're using to configure your build?
Need more info to understand usescase to fix this.