# GPU utilization and MPI

**URL:** <https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528>\
**Category:** User discussions\
**Created:** [February 2, 2021, 12:36pm UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528 "2021-02-02T12:36:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnab\_1](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@arnab\_1](https://gromacs.bioexcel.eu/u/arnab_1)\
**Post date:** [February 2, 2021, 12:36pm UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/1 "2021-02-02T12:36:32Z")

</div>

GROMACS version: 2021  
GROMACS modification: Yes/No  
Here post your question  
Hi,  
I have NVIDIA Geforce GTX 1660 super,6GB which is CUDA enabled.  
During the GROMACS installation I used DGMX\_GPU=cuda in command line.  
Now, I am running a 20ns job by using simple command gmx mdrun -s topol-nvt.tpr -deffnm nvt.  
How do I confirm that job is using GPU? or is there anything else need to write in command line?  
Another query, can I use MPI and GPU simultaneously for increasing the efficiency?

---

<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:** [February 2, 2021, 12:55pm UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/2 "2021-02-02T12:55:00Z")

</div>

> [@arnab\_1](#):
>
> How do I confirm that job is using GPU? or is there anything else need to write in command line?

Take a look at the log file. There you will find a hardware detection report as well as a hardware usage and task assignment report which will indicate whether you are using a GPU and which of the computations are offloaded.

To check GPU utilization use the `nvidia-smi` tool.

> [@arnab\_1](#):
>
> Another query, can I use MPI and GPU simultaneously for increasing the efficiency?

If you have a single GPU, you have no need for MPI. In addition, GROMACS has a built-in MPI (called thread-MPI) which allows MPI-type parallelization as long as you run on a single node.

---

<div class="post-metadata">

**Author:** ![arnab\_1](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@arnab\_1](https://gromacs.bioexcel.eu/u/arnab_1)\
**Post date:** [February 3, 2021, 5:43am UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/3 "2021-02-03T05:43:15Z")

</div>

Thank you so much for your information.  
I will check my log file.  
Is there anything additional need to write to command line for GPU utilization?

---

<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:** [February 3, 2021, 3:31pm UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/4 "2021-02-03T15:31:05Z")

</div>

> [@arnab\_1](#):
>
> Is there anything additional need to write to command line for GPU utilization?

That depends on your use-case; see  
[https://manual.gromacs.org/current/user-guide/mdrun-performance.html#node-level-parallelization-via-gpu-offloading-and-thread-mpi](https://manual.gromacs.org/current/user-guide/mdrun-performance.html#node-level-parallelization-via-gpu-offloading-and-thread-mpi)  
and  
[https://manual.gromacs.org/current/user-guide/mdrun-performance.html#examples-for-mdrun-on-one-node](https://manual.gromacs.org/current/user-guide/mdrun-performance.html#examples-for-mdrun-on-one-node)

---

<div class="post-metadata">

**Author:** ![arnab\_1](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@arnab\_1](https://gromacs.bioexcel.eu/u/arnab_1)\
**Post date:** [February 4, 2021, 6:22am UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/5 "2021-02-04T06:22:14Z")

</div>

Okay, Thanks a lot!

---

<div class="post-metadata">

**Author:** ![arnab\_1](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@arnab\_1](https://gromacs.bioexcel.eu/u/arnab_1)\
**Post date:** [February 4, 2021, 12:19pm UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/6 "2021-02-04T12:19:09Z")

</div>

Dear pszilard,  
I have checked my log file where I found  
**GROMACS version: 2020.1-Ubuntu-2020.1-1**  
**Precision: Single**  
**Memory model:64bit**  
**MPI library : thread\_mpi**  
**OpenMP support : enabled (GMX\_OPENMP\_MAX\_THREADS = 64)**  
**GPU support: disabled.**  
Then I reinstall the gromacs with command: **cmake … -DGMX\_BUILD\_OWN\_FFTW=ON -DGMX\_GPU=CUDA -DGMX\_MPI=ON**  
After that when I am trying to run using **gmx mdrun … -nb gpu -pme gpu**  
the system is showing the following:  
**Inconsistency in user input:**  
**Nonbonded interactions on the GPU were requested with -nb gpu, but the GROMACS binary has been build without GPU support.Either run without selecting GPU options or recompile GROMACS with GPU support enabled.**  
Now What can be done to solve this?

---

<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:** [February 4, 2021, 4:59pm UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/7 "2021-02-04T16:59:33Z")

</div>

> [@arnab\_1](#):
>
> I have checked my log file where I found  
> **GROMACS version: 2020.1-Ubuntu-2020.1-1**  
> **Precision: Single**  
> **Memory model:64bit**  
> **MPI library : thread\_mpi**  
> **OpenMP support : enabled (GMX\_OPENMP\_MAX\_THREADS = 64)**  
> **GPU support: disabled.**

That was GROMACS provided as an Ubuntu package built without GPU support.

> [@arnab\_1](#):
>
> After that when I am trying to run using **gmx mdrun … -nb gpu -pme gpu**  
> the system is showing the following:  
> **Inconsistency in user input:**  
> **Nonbonded interactions on the GPU were requested with -nb gpu, but the GROMACS binary has been build without GPU support.Either run without selecting GPU options or recompile GROMACS with GPU support enabled.**  
> Now What can be done to solve this?

That suggests that you still do not have GPU support. Have you checked your log?

---

<div class="post-metadata">

**Author:** ![arnab\_1](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@arnab\_1](https://gromacs.bioexcel.eu/u/arnab_1)\
**Post date:** [February 5, 2021, 9:08am UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/8 "2021-02-05T09:08:59Z")

</div>

Yeah I have checked my log after getting your suggestion. I found that run was performed completely without GPU support and it took near about 6 hours for 20 ns run.  
Then I reinstall the GROMACS package and able to enable the GPU support. I run following command _gmx mdrun -s topol-nvt.tpr -deffnm nvt -nb gpu_ for the same system what I used before. This time it has been taken 9 hours for the similar 20 ns run.  
I was wondering that why it has taken so long time in spite of getting GPU support?

---

<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:** [February 5, 2021, 2:55pm UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/9 "2021-02-05T14:55:30Z")

</div>

Please share you log files and some information about the simulated system, otherwise it is hard to assess the performance of your simulations.

---

<div class="post-metadata">

**Author:** ![arnab\_1](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@arnab\_1](https://gromacs.bioexcel.eu/u/arnab_1)\
**Post date:** [February 5, 2021, 4:15pm UTC](https://gromacs.bioexcel.eu/t/gpu-utilization-and-mpi/1528/10 "2021-02-05T16:15:12Z")

</div>

![IMG_20210205_111848](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/1X/9e5b30d43f21225a349078e9e0e8862cedb5df9a.jpeg) ![IMG_20210205_111725 (1)](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/1X/c995989e60044d98a33bbc58d2025b2035fccaa6.jpeg)  
I have shared two screenshots of the log file because presently I don’t have the access the computer for the sharing the log file. Kindly look these images and I will share you tomorrow the original file.  
Here I am simulating the Ionic Liquid.  
Thanks a lot for your kind concern.
