# Gormacs installation-enabling GPU

**URL:** <https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029>\
**Category:** User discussions\
**Tags:** gpu, installation-error\
**Created:** [October 25, 2021, 8:17pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029 "2021-10-25T20:17:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivu](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@shivu](https://gromacs.bioexcel.eu/u/shivu)\
**Post date:** [October 25, 2021, 8:17pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/1 "2021-10-25T20:17:04Z")

</div>

GROMACS version: 2021.3  
GROMACS modification: Yes/No  
Here post your question

Hi,  
i have recently installed Gromacs on ubuntu platform.  
I used following to cmake:  
cmake .. -DGMX\_BUILD\_OWN\_FFTW=ON -DREGRESSIONTEST\_DOWNLOAD=ON -DGMX\_MPI=on -DGMX\_GPU=CUDA -DMPI\_C\_COMPILER=mpicc -DGMX\_MPI=on

I am getting following error at the end:

/usr/bin/ld: ../../../../lib/libmdrun\_test\_infrastructure.a(moduletest.cpp.o): undefined reference to symbol ‘MPI\_Barrier’  
/usr/bin/ld: /usr/lib/x86\_64-linux-gnu/libmpich.so: error adding symbols: DSO missing from command line  
collect2: error: ld returned 1 exit status  
make[3]: \*\*\* [src/programs/mdrun/tests/CMakeFiles/mdrun-tpi-test.dir/build.make:113: bin/mdrun-tpi-test] Error 1  
make[2]: \*\*\* [CMakeFiles/Makefile2:6646: src/programs/mdrun/tests/CMakeFiles/mdrun-tpi-test.dir/all] Error 2  
make[1]: \*\*\* [CMakeFiles/Makefile2:2713: CMakeFiles/check.dir/rule] Error 2  
make: \*\*\* [Makefile:249: check] Error 2

I did “make install” after this.

running an md job is giving me following error:  
gmx mdrun -deffnm md\_0\_1 -nb gpu

GROMACS version: 2021.3  
Precision: mixed  
Memory model: 64 bit  
MPI library: thread\_mpi  
OpenMP support: enabled (GMX\_OPENMP\_MAX\_THREADS = 64)  
GPU support: disabled  
SIMD instructions: AVX\_512  
FFT library: fftw-3.3.8-sse2-avx-avx2-avx2\_128-avx512  
RDTSCP usage: enabled  
TNG support: enabled  
Hwloc support: disabled  
Tracing support: disabled  
C compiler: /usr/bin/cc GNU 9.3.0  
C compiler flags: -mavx512f -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -O3 -DNDEBUG  
C++ compiler: /usr/bin/c++ GNU 9.3.0  
C++ compiler flags: -mavx512f -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -fopenmp

Running on 1 node with total 20 cores, 40 logical cores  
Hardware detected:  
CPU info:  
Vendor: Intel  
Brand: Intel(R) Xeon(R) Gold 6230 CPU @ 2.10GHz  
Family: 6 Model: 85 Stepping: 7  
Number of AVX-512 FMA units: 2

* * *

## Please let me know how to resolve the issue and best use the GPU capabilities. Thank you

---

<div class="post-metadata">

**Author:** ![pszilard](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/pszilard/32/21_2.png) [@pszilard](https://gromacs.bioexcel.eu/u/pszilard)\
**Post date:** [October 25, 2021, 10:31pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/2 "2021-10-25T22:31:13Z")

</div>

There is no error in your output, but I assume it stated that your binary does not have GPU support. That’s because you build without GPU support as you can see from the " GPU support: disabled" in the version header.  
Make sure to pass `-DGMX_GPU=` and specify your GPU platform (CUDA or OpenCL).

Secondly, your install commands should build an MPI build, but that seems to fail, then you run the `gmx mdrun` binary which is not an MPI binary (because " MPI library: thread\_mpi" indicates it is not using lib-MPI). If you want to run multi-node, make sure you have a functioning MPI build.

---

<div class="post-metadata">

**Author:** ![shivu](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@shivu](https://gromacs.bioexcel.eu/u/shivu)\
**Post date:** [October 27, 2021, 12:58pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/3 "2021-10-27T12:58:13Z")

</div>

Hi Thank you for the reply.  
I used this command to do cmake:

cmake … -DGMX\_BUILD\_OWN\_FFTW=ON -DREGRESSIONTEST\_DOWNLOAD=ON -DGMX\_MPI=on -DGMX\_GPU=CUDA -DMPI\_C\_COMPILER=mpicc -DGMX\_MPI=on

I specified CUDA for -DGMX\_GPU

Please see and guide how to best use the GPU capabilities.

Thank you

---

<div class="post-metadata">

**Author:** ![pszilard](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/pszilard/32/21_2.png) [@pszilard](https://gromacs.bioexcel.eu/u/pszilard)\
**Post date:** [October 27, 2021, 4:04pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/4 "2021-10-27T16:04:39Z")

</div>

If you did that your binary should report “GPU support: CUDA” in the `gmx --version` output. Have you verified that it does?

---

<div class="post-metadata">

**Author:** ![shivu](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@shivu](https://gromacs.bioexcel.eu/u/shivu)\
**Post date:** [October 27, 2021, 8:16pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/5 "2021-10-27T20:16:44Z")

</div>

> [@pszilard](#):
>
> `gmx --version`

Hi Thanks again.  
I checked my system for CUDA.  
==\> when I give command:  
“nvidia-smi”,  
following is the output:

±----------------------------------------------------------------------------+  
| NVIDIA-SMI 495.29.05 Driver Version: 495.29.05 CUDA Version: 11.5 |  
|-------------------------------±---------------------±---------------------+  
| 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 Quadro RTX 4000 On | 00000000:17:00.0 On | N/A |  
| 30% 41C P8 17W / 125W | 274MiB / 7974MiB | 5% Default |  
| | | N/A |  
±------------------------------±---------------------±---------------------+

I re did the cmake command:  
==\> “cmake … -DGMX\_GPU=CUDA”  
output:  
– The GROMACS-managed build of FFTW 3 will configure with the following optimizations: --enable-sse2;–enable-avx;–enable-avx2;–enable-avx512  
– Configuring done  
– Generating done  
– Build files have been written to: /home/mypc/Documents/software/gromacs-2021.3/build

==\> after this I gave: “make”  
output:  
[1%] Built target fftwBuild  
[1%] Built target scanner  
[2%] Generating release version information  
[2%] Built target release-version-info  
[4%] Built target tng\_io\_obj  
[4%] Built target tng\_io\_zlib  
[4%] Built target lmfit\_objlib  
[5%] Built target thread\_mpi  
[25%] Built target linearalgebra  
[26%] Built target modularsimulator  
[93%] Built target libgromacs  
[94%] Built target gmxapi  
[95%] Built target nblib  
[95%] Built target methane-water-integration  
[95%] Built target argon-forces-integration  
[95%] Built target gtest  
[95%] Built target gmock  
[98%] Built target testutils  
[100%] Built target gmx\_objlib  
[100%] Built target mdrun\_objlib  
[100%] Built target view\_objlib  
[100%] Built target gmx

==\> followed by “make check”  
output:  
[0%] Built target mdrun\_objlib  
[0%] Built target scanner  
[1%] Generating release version information  
[1%] Built target release-version-info  
[2%] Built target fftwBuild  
[3%] Built target tng\_io\_obj  
[3%] Built target tng\_io\_zlib  
[3%] Built target lmfit\_objlib  
[4%] Built target thread\_mpi  
[18%] Built target linearalgebra  
[19%] Built target modularsimulator  
[67%] Built target libgromacs  
[68%] Built target gmx\_objlib  
[68%] Built target view\_objlib  
[68%] Built target gmx  
[68%] Built target gmxtests  
[68%] Built target gtest  
[68%] Built target gmock  
[70%] Built target testutils  
[70%] Built target mdrun\_test\_infrastructure  
[71%] Built target gmxapi  
[72%] Built target workflow-details-test  
[73%] Built target nblib  
[73%] Built target nblib\_test\_infrastructure  
[74%] Built target nblib-setup-test  
[74%] Built target methane-water-integration  
[74%] Built target argon-forces-integration  
[74%] Built target nblib-integrator-test  
[75%] Built target nblib-integration-test  
[75%] Built target nblib-tests  
[75%] Built target nblib-listed-forces-test  
[75%] Built target nblib-util-test  
[75%] Built target testutils-mpi-test  
[75%] Built target testutils-test  
[75%] Built target utility-mpi-test  
[77%] Built target utility-test  
[77%] Linking CXX executable …/…/…/…/bin/mdlib-test  
[78%] Built target mdlib-test  
[79%] Built target awh-test  
[79%] Built target density\_fitting\_applied\_forces-test  
[79%] Built target applied\_forces-test  
[79%] Built target listed\_forces-test  
[79%] Built target onlinehelp-test-shared  
[80%] Built target commandline-test  
[81%] Built target domdec-mpi-test  
[81%] Built target domdec-test  
[82%] Built target ewald-test  
[82%] Built target fft-test  
[82%] Linking CXX executable …/…/…/…/bin/gpu\_utils-test  
[82%] Built target gpu\_utils-test  
[83%] Built target hardware-test  
[84%] Built target math-test  
[84%] Built target mdrunutility-test-shared  
[84%] Built target mdrunutility-mpi-test  
[84%] Built target mdrunutility-test  
[85%] Built target mdspan-test  
[85%] Built target mdtypes-test  
[85%] Built target onlinehelp-test  
[86%] Built target options-test  
[86%] Built target pbcutil-test  
[86%] Built target random-test  
[86%] Built target restraintpotential-test  
[86%] Built target table-test  
[86%] Built target taskassignment-test  
[86%] Built target topology-test  
[86%] Built target pull-test  
[87%] Built target simd-test  
[87%] Built target compat-test  
[87%] Built target gmxana-test  
[88%] Built target pdb2gmx3-test  
[88%] Built target pdb2gmx2-test  
[88%] Built target pdb2gmx1-test  
[89%] Built target gmxpreprocess-test  
[89%] Built target correlations-test  
[89%] Built target analysisdata-test-shared  
[89%] Built target analysisdata-test  
[90%] Built target coordinateio-test  
[91%] Built target trajectoryanalysis-test  
[91%] Built target energyanalysis-test  
[92%] Built target tool-test  
[92%] Built target fileio-test  
[93%] Built target selection-test  
[93%] Linking CXX executable …/…/…/…/bin/mdrun-tpi-test  
/usr/bin/ld: …/…/…/…/lib/libmdrun\_test\_infrastructure.a(moduletest.cpp.o): undefined reference to symbol ‘MPI\_Barrier’  
/usr/bin/ld: /usr/lib/x86\_64-linux-gnu/libmpich.so: error adding symbols: DSO missing from command line  
collect2: error: ld returned 1 exit status  
make[3]: \*\*\* [src/programs/mdrun/tests/CMakeFiles/mdrun-tpi-test.dir/build.make:113: bin/mdrun-tpi-test] Error 1  
make[2]: \*\*\* [CMakeFiles/Makefile2:6646: src/programs/mdrun/tests/CMakeFiles/mdrun-tpi-test.dir/all] Error 2  
make[1]: \*\*\* [CMakeFiles/Makefile2:2713: CMakeFiles/check.dir/rule] Error 2  
make: \*\*\* [Makefile:249: check] Error 2

it gave errors.

now: “gmx --version”  
output:  
GROMACS version: 2021.3  
Precision: mixed  
Memory model: 64 bit  
MPI library: thread\_mpi  
OpenMP support: enabled (GMX\_OPENMP\_MAX\_THREADS = 64)  
GPU support: disabled  
SIMD instructions: AVX\_512  
FFT library: fftw-3.3.8-sse2-avx-avx2-avx2\_128-avx512  
RDTSCP usage: enabled  
TNG support: enabled  
Hwloc support: disabled  
Tracing support: disabled  
C compiler: /usr/bin/cc GNU 9.3.0  
C compiler flags: -mavx512f -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -O3 -DNDEBUG  
C++ compiler: /usr/bin/c++ GNU 9.3.0  
C++ compiler flags: -mavx512f -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -fopenmp

there are few errors here also in C compiler and it is still saying GPU support: disabled

Please see and guide

---

<div class="post-metadata">

**Author:** ![shivu](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@shivu](https://gromacs.bioexcel.eu/u/shivu)\
**Post date:** [October 28, 2021, 4:50pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/6 "2021-10-28T16:50:13Z")

</div>

Please provide the best possible solution to help resolve this issue.

Thank you

---

<div class="post-metadata">

**Author:** ![shivu](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@shivu](https://gromacs.bioexcel.eu/u/shivu)\
**Post date:** [October 29, 2021, 6:20pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/7 "2021-10-29T18:20:52Z")

</div>

Hi,

I have done the complete installation again.  
now the gmx --version shows that GPU is supported.  
see below:  
gmx pdb2gmx --version

GROMACS version: 2021.3  
Verified release checksum is  
Precision: mixed  
Memory model: 64 bit  
MPI library: thread\_mpi  
OpenMP support: enabled (GMX\_OPENMP\_MAX\_THREADS = 64)  
GPU support: CUDA  
SIMD instructions: AVX\_512  
FFT library: fftw-3.3.8-sse2-avx  
RDTSCP usage: enabled  
TNG support: enabled  
Hwloc support: disabled  
Tracing support: disabled  
C compiler: /usr/bin/cc GNU 8.4.0  
C compiler flags: -mavx512f -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -O3 -DNDEBUG  
C++ compiler: /usr/bin/c++ GNU 8.4.0  
C++ compiler flags: -mavx512f -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -fopenmp -O3 -DNDEBUG  
CUDA compiler: /usr/bin/nvcc nvcc: NVIDIA (R) Cuda compiler driver;Copyright (c) 2005-2019 NVIDIA Corporation;Built on Sun\_Jul\_28\_19:07:16\_PDT\_2019;Cuda compilation tools, release 10.1, V10.1.243  
CUDA compiler flags:-std=c++14;-gencode;arch=compute\_30,code=sm\_30;-gencode;arch=compute\_35,code=sm\_35;-gencode;arch=compute\_37,code=sm\_37;-gencode;arch=compute\_50,code=sm\_50;-gencode;arch=compute\_52,code=sm\_52;-gencode;arch=compute\_60,code=sm\_60;-gencode;arch=compute\_61,code=sm\_61;-gencode;arch=compute\_70,code=sm\_70;-gencode;arch=compute\_75,code=sm\_75;-gencode;arch=compute\_35,code=compute\_35;-gencode;arch=compute\_32,code=compute\_32;-use\_fast\_math;-D\_FORCE\_INLINES;-mavx512f -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -fopenmp -O3 -DNDEBUG  
CUDA driver: 11.40  
CUDA runtime: 10.10

I do see: “-Wno-missing-field-initializers” in C++ compiler section.

---

<div class="post-metadata">

**Author:** ![pszilard](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/pszilard/32/21_2.png) [@pszilard](https://gromacs.bioexcel.eu/u/pszilard)\
**Post date:** [November 2, 2021, 6:25pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/8 "2021-11-02T18:25:42Z")

</div>

> [@shivu](#):
>
> I have done the complete installation again.  
> now the gmx --version shows that GPU is supported.

Good, so mdrun should now be able to utilize an NVIDIA GPU.

> [@shivu](#):
>
> I do see: “-Wno-missing-field-initializers” in C++ compiler section.

That is very much expected, it is a compiler flag used.

---

<div class="post-metadata">

**Author:** ![shivu](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@shivu](https://gromacs.bioexcel.eu/u/shivu)\
**Post date:** [November 3, 2021, 8:27pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/9 "2021-11-03T20:27:46Z")

</div>

Thank you for your feedback.

---

<div class="post-metadata">

**Author:** ![LTaro](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@LTaro](https://gromacs.bioexcel.eu/u/LTaro)\
**Post date:** [April 3, 2022, 8:14am UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/10 "2022-04-03T08:14:50Z")

</div>

How did you fix it?

---

<div class="post-metadata">

**Author:** ![Sajad](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@Sajad](https://gromacs.bioexcel.eu/u/Sajad)\
**Post date:** [July 28, 2022, 8:01am UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/11 "2022-07-28T08:01:41Z")

</div>

Hi I have the same problem  
may you please help me?

---

<div class="post-metadata">

**Author:** ![Vignesh](https://avatars.discourse-cdn.com/v4/letter/v/4bbf92/32.png) [@Vignesh](https://gromacs.bioexcel.eu/u/Vignesh)\
**Post date:** [September 1, 2023, 3:18pm UTC](https://gromacs.bioexcel.eu/t/gormacs-installation-enabling-gpu/3029/12 "2023-09-01T15:18:54Z")

</div>

After completing the installation with -DGMX\_GPU=CUDA (or your preference) execute the following command

> source /usr/local/gromacs/bin/GMXRC

After this whenever you need GPU support run the same command before starting your mdrun and proceed with your run (or verify with gmx --version)
