# Performance tuning

**URL:** <https://gromacs.bioexcel.eu/t/performance-tuning/8636>\
**Category:** User discussions\
**Created:** [March 18, 2024, 6:37am UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636 "2024-03-18T06:37:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xeno007](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xeno007](https://gromacs.bioexcel.eu/u/xeno007)\
**Post date:** [March 18, 2024, 6:37am UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/1 "2024-03-18T06:37:44Z")

</div>

GROMACS version: 2024  
GROMACS modification: No  
Here post your question

Hi, I see the following recommendation in my md.log

NOTE: 7 % of the run time was spent communicating energies,  
you might want to increase some nst\* mdp options

and when looking at the statistics, I find the following

Comm. energies 2688 1 75001 477.624 2439149.256 7.1

What nst\* parameters should i play with to improve this?

Are these parameters safely modifiable without any impact in accuracy?

comm-mode = Linear  
nstcomm = 100

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [March 19, 2024, 3:58pm UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/2 "2024-03-19T15:58:31Z")

</div>

There are several parameters that cause energies to be computed and communicated:  
nstcalcenergy  
nsttcouple (can be set indirectly by tau\_t)  
nstpcouple (can be set indirectly by tau\_p)

---

<div class="post-metadata">

**Author:** ![xeno007](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xeno007](https://gromacs.bioexcel.eu/u/xeno007)\
**Post date:** [March 19, 2024, 4:12pm UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/3 "2024-03-19T16:12:49Z")

</div>

> [@xeno007](#):
>
> NOTE: 7 % of the run time was spent communicating energies,  
> you might want to increase some nst\* mdp options

1. Are there possibilities to reduce this by playing with the parameters you have mentioned?
2. will there be any effect on accuracy?
3. For an efficient and optimal run, which function will consume the most %time in the md.log statistics?

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [March 19, 2024, 5:29pm UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/4 "2024-03-19T17:29:43Z")

</div>

In most cases you should be able to adjust the parameters to get better performance with affecting accuracy. But I don’t know which settings you have used.

The non-bonded pair calculation and PME usually take the most time.

---

<div class="post-metadata">

**Author:** ![xeno007](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xeno007](https://gromacs.bioexcel.eu/u/xeno007)\
**Post date:** [March 20, 2024, 10:43am UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/5 "2024-03-20T10:43:44Z")

</div>

In my current setup nst\* parameters looks like this

```auto
nstcomm = 100
   nstcgsteep = 1000
   nstxout = 10000
   nstvout = 10000
   nstfout = 500000
   nstlog = 10000
   nstcalcenergy = 100
   nstenergy = 10000
   nstxout-compressed = 10000
   nstlist = 10
   ensemble-temperature-setting = constant
   nsttcouple = 10
   nstpcouple = 10

```

Does this info give any hint on what can be paramter can be tuned?

---

<div class="post-metadata">

**Author:** ![xeno007](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xeno007](https://gromacs.bioexcel.eu/u/xeno007)\
**Post date:** [March 20, 2024, 10:46am UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/6 "2024-03-20T10:46:21Z")

</div>

> [@hess](#):
>
> The non-bonded pair calculation and PME usually take the most time.

I have Force=52%, PME Mesh \*=20%, PME wait for PP \* = 6% and Comm. energies = 7%

---

<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:** [March 20, 2024, 12:36pm UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/7 "2024-03-20T12:36:00Z")

</div>

> [@xeno007](#):
>
> In my current setup nst\* parameters looks like this
> 
> ```auto
> nsttcouple = 10
> nstpcouple = 10
> 
> ```
> 
> Does this info give any hint on what can be paramter can be tuned?

Those are likely unnecessarily frequent. You can just omit them and _if you have your coupling parameters set correctly_ grompp should pick better values (ideally 50-100).

---

<div class="post-metadata">

**Author:** ![xeno007](https://avatars.discourse-cdn.com/v4/letter/x/2bfe46/32.png) [@xeno007](https://gromacs.bioexcel.eu/u/xeno007)\
**Post date:** [March 20, 2024, 4:11pm UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/8 "2024-03-20T16:11:04Z")

</div>

> [@xeno007](#):
>
> `nstpcouple `

As I see, in my mdp file these paramters are not defined. Reading the documentation, i understand that default value -1 is assumed and grompp has replaced it with 10.

Is it recommended to change these values to see if it improves performance? will it change the system definition and lead to inaccurate results?

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [March 20, 2024, 5:28pm UTC](https://gromacs.bioexcel.eu/t/performance-tuning/8636/9 "2024-03-20T17:28:50Z")

</div>

The old default values work like this. Newer grompp versions choose values up to 100 taking into account accuracy needs. What can be used depends on the thermo/barostat and tau values.
