ARTICLE AD BOX
I'm trying to configure a project of mine involving CUDA, like so:
cmake \ -DCMAKE_CUDA_ARCHITECTURES=61 \ -DCMAKE_BUILD_TYPE=Release \ -DCUDAToolkit_ROOT=/usr/local/cuda-11.6 \ -DCMAKE_CUDA_COMPILER=/usr/local/cuda-11.6/bin/nvcc \ -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-11 \ -S /path/to/src_dir \ -B /path/to/build_dirand am getting:
-- The C compiler identification is GNU 11.5.0 -- The CXX compiler identification is GNU 11.5.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/gcc-11 - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/g++-11 - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- The CUDA compiler identification is unknown -- Check for working CUDA compiler: /usr/local/cuda-11.6/bin/nvcc CMake Error: Error required internal CMake variable not set, cmake may not be built correctly. Missing variable is: _CMAKE_CUDA_WHOLE_FLAG CMake Error at /opt/cmake/share/cmake-4.1/Modules/CMakeTestCUDACompiler.cmake:48 (try_compile): Failed to generate test project build system. Call Stack (most recent call first): examples/CMakeLists.txt:8 (enable_language)I know that the nvcc is is right there (and if I point CMake to a different path, I get an error about not finding nvcc). I also know the architectures flag is legit.
So, what's going on? What does variable mean? And what do I need to do for my CMake configuration to succeed?
138k86 gold badges448 silver badges923 bronze badges
1
A possible reason for this situation is that you lack the permissions to execute your nvcc compiler . If that's indeed the case and you add that permission - your configuration should succeed. Make sure you yourself can manually run nvcc - with no weird failures - before using it with CMake.
Speculation: It seems that CMake only provides decent error messages for some test-compilation failure scenarios, and if you hit one that's not extremely common (such as the compiler just not being there), then CMake will fail in some opaque way, and basically tell you "I wasn't able to figure things out and complete my internal work regarding CUDA" - through that variable.
138k86 gold badges448 silver badges923 bronze badges
Explore related questions
See similar questions with these tags.
