# Maximizing GROMACS Throughput with Multiple Simulations per GPU Using MPS and MIG

**URL:** <https://forums.developer.nvidia.com/t/maximizing-gromacs-throughput-with-multiple-simulations-per-gpu-using-mps-and-mig/191609>\
**Category:** Technical Blog\
**Created:** [October 8, 2021, 4:20pm UTC](https://forums.developer.nvidia.com/t/maximizing-gromacs-throughput-with-multiple-simulations-per-gpu-using-mps-and-mig/191609 "2021-10-08T16:20:09Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![akshaychenna](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@akshaychenna](https://forums.developer.nvidia.com/u/akshaychenna)\
**Post date:** [July 20, 2022, 4:49am UTC](https://forums.developer.nvidia.com/t/maximizing-gromacs-throughput-with-multiple-simulations-per-gpu-using-mps-and-mig/191609/7 "2022-07-20T04:49:01Z")

</div>

Hello Dr Alan,

I appreciate your response to my queries.

**1)**  
No, I am not setting the CUDA\_VISIBLE\_DEVICES environment variable.  
(Though I had also tried running mdrun after setting this as detailed in your blog.)

The simulation.sh file solely consists of:

```auto
module load apps/gromacs/2021.4/gnu
export OMP_NUM_THREADS=1

mpirun -np 1 gmx_mpi mdrun -v -s md.tpr -o md.trr -x md.xtc -cpo md.cpt -e md.edr -g md.log -c md.gro -ntomp 1 -nstlist 150 -nb gpu -bonded gpu -pme gpu -update gpu

```

**2)**  
I have tried launching jobs with multiple GPUs and used the CUDA\_VISIBLE\_DEVICES variable. **This had worked as expected without errors.** The simulations were running on GPU\_ID 0 or 1 based on our CUDA\_VISIBLE\_DEVICES variable used with `gmx mdrun`.

Some observations:

1. No user is able to use the second GPU using `-nb gpu -bonded gpu -pme gpu -update gpu` when MPS was activated by someone on the first GPU.
2. GROMACS only uses CPUs when `-nb gpu -bonded gpu -pme gpu -update gpu` flags are skipped on the second GPU jobs when MPS is already running on the first GPU. Therefore we don’t see the “no GPU is detected” error.

I am attaching the tpr file, in case you would like to test them at your end.  
[md.tpr](https://forums.developer.nvidia.com/uploads/short-url/fIQMtNWf8Jf9FW0RqsypUJNbPsX.tpr) (6.1 MB)

Thank you,  
Akshay.

---

_[View the full topic](https://forums.developer.nvidia.com/t/maximizing-gromacs-throughput-with-multiple-simulations-per-gpu-using-mps-and-mig/191609)._
