Deployment of Gromacs with CUDA

GROMACS version: 2025.1
GROMACS modification: No
CUDA Version 12.8.1
Ubuntu 22.04
Here post your question

Hi Team,
I am trying to build Gromacs with CUDA support. Here is where I am now. Please help - in which direction should I investigate? Many thanks!

Downloads/gromacs-2025.1/build$ cmake .. -DGMX_BUILD_OWN_FFTW=ON -DGMX_GPU=CUDA -DCMAKE_INSTALL_PREFIX=/opt/gromacs-2025.1 -DCMAKE_C_COMPILER=gcc -DGMX_HWLOC=ON -DCMAKE_CUDA_ARCHITECTURES=native
– Checking if nvcc accepts flags --generate-code=arch=compute_50,code=sm_50
– Checking if nvcc accepts flags --generate-code=arch=compute_50,code=sm_50 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_52,code=sm_52
– Checking if nvcc accepts flags --generate-code=arch=compute_52,code=sm_52 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_60,code=sm_60
– Checking if nvcc accepts flags --generate-code=arch=compute_60,code=sm_60 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_61,code=sm_61
– Checking if nvcc accepts flags --generate-code=arch=compute_61,code=sm_61 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_70,code=sm_70
– Checking if nvcc accepts flags --generate-code=arch=compute_70,code=sm_70 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_75,code=sm_75
– Checking if nvcc accepts flags --generate-code=arch=compute_75,code=sm_75 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_80,code=sm_80
– Checking if nvcc accepts flags --generate-code=arch=compute_80,code=sm_80 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_86,code=sm_86
– Checking if nvcc accepts flags --generate-code=arch=compute_86,code=sm_86 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_89,code=sm_89
– Checking if nvcc accepts flags --generate-code=arch=compute_89,code=sm_89 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_90,code=sm_90
– Checking if nvcc accepts flags --generate-code=arch=compute_90,code=sm_90 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_100,code=sm_100
– Checking if nvcc accepts flags --generate-code=arch=compute_100,code=sm_100 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_120,code=sm_120
– Checking if nvcc accepts flags --generate-code=arch=compute_120,code=sm_120 - No
– Checking if nvcc accepts flags -Wno-deprecated-gpu-targets
– Checking if nvcc accepts flags -Wno-deprecated-gpu-targets - No
– Checking if nvcc accepts flags --generate-code=arch=compute_53,code=compute_53
– Checking if nvcc accepts flags --generate-code=arch=compute_53,code=compute_53 - No
– Checking if nvcc accepts flags --generate-code=arch=compute_90,code=compute_90
– Checking if nvcc accepts flags --generate-code=arch=compute_90,code=compute_90 - No
– Checking if nvcc accepts flags -use_fast_math
– Checking if nvcc accepts flags -use_fast_math - No
– Checking if nvcc accepts flags -Xptxas=-warn-double-usage
– Checking if nvcc accepts flags -Xptxas=-warn-double-usage - No
– Checking if nvcc accepts flags -Xptxas=-Werror
– Checking if nvcc accepts flags -Xptxas=-Werror - No
– Checking if nvcc accepts flags -diag-suppress=177
– Checking if nvcc accepts flags -diag-suppress=177 - No
– The GROMACS-managed build of FFTW 3 will configure with the following optimizations: --enable-sse2;–enable-avx;–enable-avx2
– Could NOT find LATEX (missing: LATEX_COMPILER)
– Configuring done (0.5s)
CMake Error in src/gromacs/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “libgromacs”.

CMake Error in src/gromacs/mdlib/tests/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “mdlib-test”.

CMake Error in src/gromacs/applied_forces/nnpot/tests/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “nnpot_applied_forces-test”.

CMake Error in src/gromacs/nbnxm/tests/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “nbnxm-gpu-test”.

CMake Error in src/gromacs/domdec/tests/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “domdec-mpi-test”.

CMake Error in src/gromacs/ewald/tests/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “ewald-test”.

CMake Error in src/gromacs/fft/tests/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “fft-test”.

CMake Error in src/gromacs/gpu_utils/tests/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “gpu_utils-test”.

CMake Error in src/gromacs/hardware/tests/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “hardware-test”.

– Generating done (0.5s)
CMake Generate step failed. Build files cannot be regenerated correctly.

Hi!

The messages you shared suggest that your CUDA compiler is not working well. Most of the --generate-code flags should be supported in any recent CUDA version.

To understand, what goes wrong, you can try looking at the CMakeFiles/CMakeConfigureLog.yaml file in the build directory for errors; it’s quite long, so I recommend searching for “compute_70” there, and looking around for any errors.

Clearing the build directory and trying anew might also help resove some issues.

Also, it’s uncommon to only specify C compiler (-DCMAKE_C_COMPILER=gcc) without also specifying the C++ compiler (-DCMAKE_CXX_COMPILER=g++). Depending on your environment, this can cause mismatch between the C and C++ compilers, which can lead to strange things.