Cmake problem: "The CUDA compiler identification is unknown"

GROMACS version: gromacs-2024.2

I’m trying to compile gromacs on a Xeon E-2174G with a nvidia Quadro P2000 an fresh almalinux9.4 installation, but I’m getting stuck on a cuda issue after running cmake like this:


cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESScmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA
IONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA

[...]

-- The CUDA compiler identification is unknown
CMake Error at /usr/share/cmake/Modules/CMakeDetermineCUDACompiler.cmake:603 (message):
  Failed to detect a default CUDA architecture.


  Compiler output:

Call Stack (most recent call first):
  cmake/gmxManageCuda.cmake:116 (enable_language)
  CMakeLists.txt:697 (include)

some output that may be relevant

[...]
-- Found CUDA: /usr/local/cuda (found suitable version "12.5", minimum required is "11.0") 
-- Adding work-around for issue compiling CUDA code with glibc 2.23 string.h
-- Check for working NVCC/C++ compiler combination with nvcc '/usr/local/cuda/bin/nvcc'
-- Check for working NVCC/C++ compiler combination - works
[...[

using cuda-11.8 doesn’t seem to make a difference.

Any idea how to fix this?

Thanks, Eiso

Hello, I am facing the same issue, did you get any solution?

I have tried multiple solutions available on user forums but all in vain.

make version: 3.29.3 CUDA toolkit: 12.5 gcc version:9.4.0

Hi,
In the end it worked, but not sure what did the trick …

either adding -D CMAKE_CUDA_ARCHITECTURES=native

cmake … -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA -D CMAKE_CUDA_ARCHITECTURES=native

or this:

dnf install libcudnn8-devel libcudnn8 cudnn

or both.

Eiso

By this command :
sudo cmake … -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA -D CMAKE_CUDA_ARCHITECTURES=native

I got the following error:
– The CUDA compiler identification is unknown
CMake Error at cmake/gmxManageCuda.cmake:116 (enable_language):
No CMAKE_CUDA_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment
variable “CUDACXX” or the CMake cache entry CMAKE_CUDA_COMPILER to the full
path to the compiler, or to the compiler name if it is in the PATH.
Call Stack (most recent call first):
CMakeLists.txt:697 (include)

Thanks,
This command worked for me after upgrading gcc version from 9 to 13:

sudo cmake … -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA -DCMAKE_PREFIX_PATH=/usr/local/cuda-12.5