# Gromacs not utilizing gpu

**URL:** <https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302>\
**Category:** User discussions\
**Tags:** mdrun, gpu, qm-mm\
**Created:** [October 1, 2023, 9:55am UTC](https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302 "2023-10-01T09:55:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AKA](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@AKA](https://gromacs.bioexcel.eu/u/AKA)\
**Post date:** [October 1, 2023, 9:55am UTC](https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302/1 "2023-10-01T09:55:46Z")

</div>

GROMACS version: 2023.2  
GROMACS modification: No

I have compiled gromacs-cp2k with CUDA. The mdrun gpu utilization is zero always and I see occasional spike in gpu usage.

 ![Screenshot from 2023-10-01 15-16-35](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/5/571315cc3625972eb4bf66a767c33e8783d1d4da.png)

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [October 2, 2023, 8:27am UTC](https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302/2 "2023-10-02T08:27:02Z")

</div>

In order to help you, we would need more information. Could you post the log file of a simulation, starting from the top of the file until the first simulation step?

---

<div class="post-metadata">

**Author:** ![AKA](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@AKA](https://gromacs.bioexcel.eu/u/AKA)\
**Post date:** [October 3, 2023, 7:59am UTC](https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302/3 "2023-10-03T07:59:21Z")

</div>

Gromacs 2022.4 was built with cp2k for CUDA.  
The following are the commands used for the simulation.

```auto
############################classical######################
gmx_cp2k solvate -cp conf.gro -o conf.gro -p topol.top -shell 10
gmx_cp2k grompp -f em.mdp -p topol.top -c conf -o egfp-genions.tpr -maxwarn 10
gmx_cp2k genion -s egfp-genions.tpr -p topol.top -o conf.gro -neutral
gmx_cp2k grompp -f em.mdp -p topol.top -c conf -o egfp-em.tpr
gmx_cp2k mdrun -s egfp-em.tpr -deffnm egfp-em
gmx_cp2k grompp -f md-mm-nvt.mdp -p topol.top -c conf.gro -t egfp-em.trr -o egfp-mm-nvt.tpr
gmx_cp2k mdrun -s egfp-mm-nvt.tpr -deffnm egfp-mm-nvt -v

gmx_cp2k make_ndx -f conf.gro

> a 938-956
> name 18 QMatoms
> q
###########################QMMM################################################
gmx_cp2k grompp -f md-qmmm-nvt.mdp -p topol.top -c conf.gro -t egfp-mm-nvt.trr -n index.ndx -o egfp-qmmm-nvt.tpr -maxwarn 1

gmx_cp2k mdrun -s egfp-qmmm-nvt.tpr -deffnm egfp-qmmm-nvt -v
###############################################################################

```

mdrun performs as expected in the MM part with max usage. The low performance is observed in the qmmm mdrun.

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [October 3, 2023, 9:58am UTC](https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302/4 "2023-10-03T09:58:05Z")

</div>

As I said, please provide the log file (until the first MD step) from the `gmx_cp2k mdrun -s egfp-qmmm-nvt.tpr -deffnm egfp-qmmm-nvt -v` that will provide more information.

There is also another post on the forum that might be of interest to you: [GROMACS 2022+CP2K with GPU - #2 by dmorozov](https://gromacs.bioexcel.eu/t/gromacs-2022-cp2k-with-gpu/3897/2). Apparently not all GPUs are supported with CP2K.

---

<div class="post-metadata">

**Author:** ![AKA](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@AKA](https://gromacs.bioexcel.eu/u/AKA)\
**Post date:** [October 3, 2023, 10:21am UTC](https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302/5 "2023-10-03T10:21:08Z")

</div>

Thank you very much.  
Please look at the log file:  
[egfp-em.log](https://gromacs.bioexcel.eu/uploads/short-url/tsi2ZxEMZWYfRo9xKrm0eyPjyxr.log) (354.7 KB)  
[egfp-mm-nvt.log](https://gromacs.bioexcel.eu/uploads/short-url/paD8g0Rxx9laohxqkTn1D1Fnfnp.log) (27.4 KB)  
[egfp-qmmm-nvt.log](https://gromacs.bioexcel.eu/uploads/short-url/lGKJ0MsWTtD6IVHq4bc97nlkQ3r.log) (18.0 KB)

---

<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:** [October 3, 2023, 3:15pm UTC](https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302/6 "2023-10-03T15:15:51Z")

</div>

This question is also being answered here: [Mdrun : An error occurred in MPI\_Allreduce](https://gromacs.bioexcel.eu/t/mdrun-an-error-occurred-in-mpi-allreduce/7307)  
I think we should continue there.

---

<div class="post-metadata">

**Author:** ![organicchemistry\_01](https://avatars.discourse-cdn.com/v4/letter/o/6bbea6/32.png) [@organicchemistry\_01](https://gromacs.bioexcel.eu/u/organicchemistry_01)\
**Post date:** [January 20, 2024, 1:04pm UTC](https://gromacs.bioexcel.eu/t/gromacs-not-utilizing-gpu/7302/7 "2024-01-20T13:04:30Z")

</div>

The QMMM in CP2K is not yet implemented in GPU, there was a plan, but not sure were it is now. So, when calculation hits the QMMM, you are being bottlenecked by CP2K cpu calculations. See here for the status of QMMM GPU implementation:

[https://www.cp2k.org/gpu](https://www.cp2k.org/gpu)
