CUDA compilation error (WSL2 - Ubuntu 24.04, GeForce RTX 3050 Laptop GPU )

Hello,

I have the fresh, unmodified GROMACS clone on WSL2 - Ubuntu 24.04, having GeForce RTX 3050 Laptop GPU.

The CMake configuration went fine, it detected cuda toolkit:

cmake -DGMX_MPI=on  -DGMX_GPU=CUDA .. > build_gpu.log

see the log:

build_gpu.log (13.8 KB)

But the following compilation gives this CUDA error:

make
.
.
.
[ 16%] Building CUDA object src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_kernel_pruneonly.cu.o
ptxas error   : Value of threads per SM for entry _ZN3gmx23nbnxn_kernel_prune_cudaILb1EEEvNS_13NBAtomDataGpuENS_10NBParamGpuENS_11GpuPairlistEi is out of range. .minnctapersm will be ignored
ptxas error   : Value of threads per SM for entry _ZN3gmx23nbnxn_kernel_prune_cudaILb0EEEvNS_13NBAtomDataGpuENS_10NBParamGpuENS_11GpuPairlistEi is out of range. .minnctapersm will be ignored
ptxas fatal   : Ptx assembly aborted due to errors
make[2]: *** [src/gromacs/CMakeFiles/libgromacs.dir/build.make:3733: src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_kernel_pruneonly.cu.o] Error 255
make[1]: *** [CMakeFiles/Makefile2:5762: src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Please help.

Well, even it does not detect native CUDA architecture:

cmake -DGMX_MPI=on -DGMX_GPU=CUDA -DCMAKE_CUDA_ARCHITECTURES=native .. > cmake_config_gpu.log
CMake Error at cmake/gmxManageNNPot.cmake:57 (message):
Unknown CUDA architecture: native
Call Stack (most recent call first):
CMakeLists.txt:843 (include)

cmake_config_gpu.log (9.6 KB)

Neither -DCMAKE_CUDA_ARCHITECTURES=all helps:

[ 39%] Building CUDA object src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda.cu.o
[ 39%] Building CUDA object src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_data_mgmt.cu.o
[ 39%] Building CUDA object src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_kernel_F_noprune.cu.o
[ 39%] Building CUDA object src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_kernel_F_prune.cu.o
[ 39%] Building CUDA object src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_kernel_VF_noprune.cu.o
[ 39%] Building CUDA object src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_kernel_VF_prune.cu.o
[ 39%] Building CUDA object src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_kernel_pruneonly.cu.o
ptxas error : Value of threads per SM for entry _ZN3gmx23nbnxn_kernel_prune_cudaILb1EEEvNS_13NBAtomDataGpuENS_10NBParamGpuENS_11GpuPairlistEi is out of range. .minnctapersm will be ignored
ptxas error : Value of threads per SM for entry _ZN3gmx23nbnxn_kernel_prune_cudaILb0EEEvNS_13NBAtomDataGpuENS_10NBParamGpuENS_11GpuPairlistEi is out of range. .minnctapersm will be ignored
ptxas fatal : Ptx assembly aborted due to errors
make[2]: *** [src/gromacs/CMakeFiles/libgromacs.dir/build.make:3733: src/gromacs/CMakeFiles/libgromacs.dir/nbnxm/cuda/nbnxm_cuda_kernel_pruneonly.cu.o] Error 255
make[2]: *** Waiting for unfinished jobs…
make[1]: *** [CMakeFiles/Makefile2:5762: src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Hi!

What if you set CMAKE_CUDA_ARCHITECTURES=86-real?

At least some of the issues you’ve encountered should already be fixed in the current release-2026 git branch, but might not have been pulled into main yet, so switching to that branch should also help.

1 Like

I helped, thanks, with the current main branch !

See cmake_buildup_mpi-gpu-x86real.log (28.5 KB)

How do you know the CMAKE_CUDA_ARCHITECTURES flag for my not so powerful laptop GPU ? Will the GPU be properly detected with cmake in future Gromacs release ?

But I have RTX 3060 in my workstation, so I happened to know this one :)

They should. It would be great if you can update your source directory to the current main (and clean build directory). The fixes have been merged over the last week, so cmake -DGMX_GPU=CUDA should work both with and without CMAKE_CUDA_ARCHITECTURES=native. If you still see problems, share which CMake version you’re using.

1 Like