Skip to content

CUDA: cmake still fails to correctly identify and report GCC-CUDA version mismatch

I'm using cmake 3.23.0-rc2. On a system with GCC 10 being the default C++ compiler and CUDA 10.2.89 installed, trying to configure a CUDA project yields:

CMake Error at /opt/versions/cmake/3.23.0-rc2/share/cmake-3.23/Modules/CMakeDetermineCUDACompiler.cmake:632 (message):
  Failed to detect a default CUDA architecture.

  

  Compiler output:

Call Stack (most recent call first):
  CMakeLists.txt:19 (PROJECT)

Now, that's an untrue statement in itself, but never mind. The point is that we should be told the C++ compiler NVCC is using is incompatible with it; or at least - we should be forwarded the explicit error that NVCC emits. It's certainly not the problem that I have an ambiguous CUDA architecture in any way.

Also, if I repeat the cmake configuration command, I get:

CMake Error at /opt/versions/cmake/3.23.0-rc2/share/cmake-3.23/Modules/CMakeDetermineCUDACompiler.cmake:310 (message):
  CMAKE_CUDA_ARCHITECTURES must be valid if set.
Call Stack (most recent call first):
  CMakeLists.txt:19 (PROJECT)

So, right back at ya: If you set CMAKE_CUDA_ARCHITECTURES, then make it valid.

This is a sort-of continuation of issue #23010 (closed).

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information