# Installing GROMACS on Ubuntu with CUDA GPU Support Fails

**URL:** <https://gromacs.bioexcel.eu/t/installing-gromacs-on-ubuntu-with-cuda-gpu-support-fails/4714>\
**Category:** User discussions\
**Tags:** gpu\
**Created:** [September 1, 2022, 12:46pm UTC](https://gromacs.bioexcel.eu/t/installing-gromacs-on-ubuntu-with-cuda-gpu-support-fails/4714 "2022-09-01T12:46:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![faruqe](https://avatars.discourse-cdn.com/v4/letter/f/aca169/32.png) [@faruqe](https://gromacs.bioexcel.eu/u/faruqe)\
**Post date:** [September 1, 2022, 12:46pm UTC](https://gromacs.bioexcel.eu/t/installing-gromacs-on-ubuntu-with-cuda-gpu-support-fails/4714/1 "2022-09-01T12:46:25Z")

</div>

Ubuntu 22.04  
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0  
GROMACS version: gromacs-2022.2  
GROMACS modification: No

$ nvcc --version  
nvcc: NVIDIA (R) Cuda compiler driver  
Copyright (c) 2005-2021 NVIDIA Corporation  
Built on Thu\_Nov\_18\_09:45:30\_PST\_2021  
Cuda compilation tools, release 11.5, V11.5.119  
Build cuda\_11.5.r11.5/compiler.30672275\_0

$ nvidia-smi  
Thu Sep 1 18:42:48 2022  
±----------------------------------------------------------------------------+  
| NVIDIA-SMI 510.85.02 Driver Version: 510.85.02 CUDA Version: 11.6 |  
|-------------------------------±---------------------±---------------------+  
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |  
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |  
| | | MIG M. |  
|===============================+======================+======================|  
| 0 NVIDIA GeForce … Off | 00000000:42:00.0 On | N/A |  
| 27% 35C P8 25W / 250W | 1678MiB / 8192MiB | 5% Default |  
| | | N/A |  
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+  
| Processes: |  
| GPU GI CI PID Type Process name GPU Memory |  
| ID ID Usage |  
|=============================================================================|  
| 0 N/A N/A 1760 G /usr/lib/xorg/Xorg 807MiB |  
| 0 N/A N/A 2094 G /usr/bin/gnome-shell 126MiB |  
| 0 N/A N/A 3613 G …RendererForSitePerProcess 167MiB |  
| 0 N/A N/A 98530 C+G ./yasara 163MiB |  
| 0 N/A N/A 180148 G …030562158609341530,131072 403MiB |  
| 0 N/A N/A 466910 G gnome-control-center 2MiB |  
±----------------------------------------------------------------------------+

I am following [Installation guide — GROMACS 2022.2 documentation](https://manual.gromacs.org/current/install-guide/index.html)

$ sudo cmake … -DGMX\_BUILD\_OWN\_FFTW=ON -DREGRESSIONTEST\_DOWNLOAD=ON -DGMX\_GPU=CUDA

→ Succeeded

$ sudo make  
[26%] Built target scanner  
[26%] Generating baseversion-gen.cpp  
[26%] Building NVCC (Device) object src/gromacs/CMakeFiles/libgromacs.dir/domdec/libgromacs\_generated\_gpuhaloexchange\_impl.cu.o  
/usr/include/c++/11/bits/std\_function.h:435:145: error: parameter packs not expanded with ‘…’:  
435 | function(\_Functor&& \_\_f)  
| ^  
/usr/include/c++/11/bits/std\_function.h:435:145: note: ‘\_ArgTypes’  
/usr/include/c++/11/bits/std\_function.h:530:146: error: parameter packs not expanded with ‘…’:  
530 | operator=(\_Functor&& \_\_f)  
| ^  
/usr/include/c++/11/bits/std\_function.h:530:146: note: ‘\_ArgTypes’  
CMake Error at libgromacs\_generated\_gpuhaloexchange\_impl.cu.o.Release.cmake:280 (message):  
Error generating file  
/home/faruqe/Downloads/gromacs-2022.2/build-gpu/src/gromacs/CMakeFiles/libgromacs.dir/domdec/./libgromacs\_generated\_gpuhaloexchange\_impl.cu.o

make[2]: \*\*\* [src/gromacs/CMakeFiles/libgromacs.dir/build.make:133: src/gromacs/CMakeFiles/libgromacs.dir/domdec/libgromacs\_generated\_gpuhaloexchange\_impl.cu.o] Error 1  
make[1]: \*\*\* [CMakeFiles/Makefile2:4883: src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2  
make: \*\*\* [Makefile:166: all] Error 2

But If I install using apt-get with `sudo apt-get install gromacs` command, gromacs installed properly without GPU support (CUDA)

How can I build gromacs with GPU support ?

---

<div class="post-metadata">

**Author:** ![al42and](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/al42and/32/1393_2.png) [@al42and](https://gromacs.bioexcel.eu/u/al42and)\
**Post date:** [September 1, 2022, 7:08pm UTC](https://gromacs.bioexcel.eu/t/installing-gromacs-on-ubuntu-with-cuda-gpu-support-fails/4714/2 "2022-09-01T19:08:33Z")

</div>

Hi faruqe!

It is a known issue with recent CUDA and GCC 11.x. We’ll add it to the official list of known issues in the next release of GROMACS :).

As a solution, you can install `g++-9` and use it (`cmake -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA -DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_COMPILER=g++-9`).

Sidenote: it is usually excessive and not very secure to run `cmake` and `make` with `sudo`. Only `make install` requires it. But that is not related to the issue you’re observing.
