top of page
uni datacenter

Gromacs: Get maximum performance

Updated: Aug 2, 2024

Gromacs is a free and open-source software suite for high-performance molecular dynamics, mainly designed for simulations of proteins, lipids, and nucleic acids. In this tutorial, we will look at how to get the best performance while using Gromacs on Uni Datacenter clusters.


Let us take an example of a protein in water. In our case, we have a small protein called lysozyme. The protein has 130 amino acids or 2016 atoms. We have followed the same procedure as Gromacs tutorials (more information at link). Once your files are ready for a production run, we can start with testing speeds using different configurations for GPU runs. For consistency purposes, all the runs are using charmm27 all-atom-forcefields, TIP3 water model and a cubic box type. The final system contains 48,238 atoms including the amino acids, water molecules and ions.


For production run, we can use the Gromacs command gmx mdrun and specify different components of calculations to run specifically on cpu, gpu, or auto (auto detection) -


  • CPU Run: We have selected non-bonded, bonded and PME calculations to be done specifically on cpu only.

gmx mdrun -v -deffnm md -nb cpu -bonded cpu -pme cpu 
step 15700, will finish Fri Aug  2 00:34:17 2024
               Core t (s)   Wall t (s)        (%)
       Time:       89.079        2.784     3199.4
                 (ns/day)    (hour/ns)
Performance:      117.984        0.203

GROMACS reminds you: "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." (Will Rogers)
  • GPU Run: We can rerun the production run, with a few changes. This time we will use gpu for the calculations of non-bonded, bonded, and pme terms. Please also note that the -update flag is cpu

gmx mdrun -v -deffnm md -nb gpu -bonded gpu -pme gpu -update cpu
step 15800, will finish Fri Aug  2 00:40:47 2024
               Core t (s)   Wall t (s)        (%)
       Time:       80.274        5.017     1600.0
                 (ns/day)    (hour/ns)
Performance:      544.209        0.044
 
GROMACS reminds you: "Expertise is not inherently good." (Joe Jordan)
  • GPU Resident Run: we can rerun the command with changes in the -update flag set to GPU.

gmx mdrun -v -deffnm md -nb gpu -bonded gpu -pme gpu -update gpu 
step 15700, will finish Fri Aug  2 00:34:17 2024
               Core t (s)   Wall t (s)        (%)
       Time:       59.577        3.724     1599.9
                 (ns/day)    (hour/ns)
Performance:      728.610        0.033

GROMACS reminds you: "Two guys can move very fast when they're motivated enough and unemployed" (Eric Betzig)

Here, we see that even when the hardware is the same, it is possible to get more speed in Gromacs. This can be done using the -update flag in gmx mdrun command. Setting the value of this flag to 'gpu', switches to gpu-resident mode and performs much better than the earlier runs.


Here, the GPU-resident run performs the best with an avg. speed ~730 ns/day, followed by non GPU-resident run which clocks ~550 ns/day. The CPU run could only produce 120 ns/day. Thus, we hereby suggest all gromacs users on uni datacenter clusters to try to make use of the gpu-resident runs to boost your gromacs performance.


If you are interested in learning more about molecular dynamics simulations and Gromacs, check out some more topics in our blog section. If you are interested in acquiring your own computing space, don't hesitate to contact Uni Datacenter at admin-help@uni-datacenter.com or visit www.uni-datacenter.com .



bottom of page