# Cuda error gromacs with plumed

**URL:** <https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583>\
**Category:** User discussions\
**Tags:** mdrun\
**Created:** [January 16, 2023, 9:10pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583 "2023-01-16T21:10:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgugliel](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@sgugliel](https://gromacs.bioexcel.eu/u/sgugliel)\
**Post date:** [January 16, 2023, 9:10pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/1 "2023-01-16T21:10:16Z")

</div>

GROMACS version: 2022.3  
GROMACS modification: No

Dear all,  
in running a metadynamics simulation with gromacs 2022.3 and plumed 2.8 on a workstation with rtx 3090ti (CUDA 11.8) and intel xeon dual core (2 x 20 cores), I get the following error:

Program: gmx mdrun, version 2022.3-plumed\_2.8.1  
Source file: src/gromacs/gpu\_utils/devicebuffer.cuh (line 91)  
Function: freeDeviceBuffer\<float2\*\>(float2\*\*)::\<lambda()\>  
MPI rank: 4 (out of 8)

Assertion failed:  
Condition: stat == cudaSuccess  
Source file: src/gromacs/gpu\_utils/devicebuffer.cuh (line 91)  
Function: freeDeviceBuffer\<float2\*\>(float2\*\*)::\<lambda()\>  
Freeing of the device buffer failed. CUDA error #1 (cudaErrorInvalidValue):  
invalid argument.

## For more information and tips for troubleshooting, please check the GROMACS website at [Common Errors — GROMACS webpage https://www.gromacs.org documentation](http://www.gromacs.org/Documentation/Errors)

MPI rank: 5 (out of 8)

Assertion failed:  
Condition: stat == cudaSuccess  
Freeing of the device buffer failed. CUDA error #1 (cudaErrorInvalidValue):

The simulation runs without error if I use gromacs compiled with MPI, but I tried to use a non MPI version of gromacs to get better performance and I got the error above.  
The simulation was started with the following command:

gmx mdrun -deffnm MES\_6\_complex\_metad -plumed plumed.dat -bonded gpu -nb gpu -pme gpu -ntmpi 8 -ntomp 5 -npme 1 -gputasks 00000000

Compilation was done with g++ 11.3 on ubuntu 22.04.

The version of non MPI gromacs works fine without plumed.

Thanks in advance  
Stefano

---

<div class="post-metadata">

**Author:** ![agomes](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@agomes](https://gromacs.bioexcel.eu/u/agomes)\
**Post date:** [January 18, 2023, 4:32pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/2 "2023-01-18T16:32:00Z")

</div>

Hello,

I’m facing exactly the same problem.  
Did you say that the MPI version runs with plumed, right? Could you please print the cmake command you used?

Best,

---

<div class="post-metadata">

**Author:** ![sgugliel](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@sgugliel](https://gromacs.bioexcel.eu/u/sgugliel)\
**Post date:** [January 18, 2023, 5:07pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/3 "2023-01-18T17:07:46Z")

</div>

Hello,  
configuration was made with

cmake … -DGMX\_BUILD\_OWN\_FFTW=ON -DGMX\_GPU=CUDA -DCUDA\_TOOLKIT\_ROOT\_DIR=/usr/local/cuda -DCMAKE\_INSTALL\_PREFIX=/home/stefano/gromacs2022\_mpi -DGMX\_SIMD=AVX2\_256` -DGMX_MPI=on`

`after adding to PATH the path to mpi executables (I have tried both with OpenMPI or MPICH).`

`Best`

---

<div class="post-metadata">

**Author:** ![agomes](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@agomes](https://gromacs.bioexcel.eu/u/agomes)\
**Post date:** [January 20, 2023, 1:07pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/5 "2023-01-20T13:07:11Z")

</div>

Hi, I solved it downgrading cuda (v. 10.2) and nvidia-driver (v. 440).  
Then, I’ve installed gromacs 2019.6.  
Both plumed (v. 2.8.1) and gromacs were compiled **without** mpi.

Unfortunately, this was only way I’ve found.  
I hope they will fix this problem soon. If you do so, please let me know.

Best,

---

<div class="post-metadata">

**Author:** ![sgugliel](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@sgugliel](https://gromacs.bioexcel.eu/u/sgugliel)\
**Post date:** [January 20, 2023, 2:31pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/6 "2023-01-20T14:31:27Z")

</div>

Hi,  
thanks for the feedback, I’m glad you solved; I posted the issue to PLUMED forum as well, so far I did not get response.

In the meantime I turned to Gromacs 2021 patched with Colvars module, as I have to run metadynamics, which is implementd in the module.  
For the cent my opinion is worth, I have noticed that the colvars patched version of gromacs, beside being smoothier to install (nothing different from installing gromacs per se), runs with exactly the same performance of “native” gromacs, while I have always noticed a loss of performance with PLUMED (maybe this is my blame and is due to non optimal compilation of plumed).

All the best

---

<div class="post-metadata">

**Author:** ![ghorvat](https://avatars.discourse-cdn.com/v4/letter/g/35a633/32.png) [@ghorvat](https://gromacs.bioexcel.eu/u/ghorvat)\
**Post date:** [March 10, 2023, 10:40am UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/7 "2023-03-10T10:40:30Z")

</div>

Hello

I’ve managed to run Plumed distance restrain simulation using non-MPI Gromacs 2022.5 patched with Plumed 2.9.0\_dev on Ubuntu 20.04, but only on one GPU card by passing a -gpu\_id value to the mdrun.

I think that issue originates from the fact that when you run Gromacs on multiple GPU cards, each card gets assigned one MPI thread that contains multiple OpenMP threads. Gromacs has native thread-MPI by default, which is probably incompatible with plumed MPI. Possibly that’s why Gromacs compiled with MPI works fine with MPI version of Plumed.

Regards

Gordan

---

<div class="post-metadata">

**Author:** ![RobertCoff](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@RobertCoff](https://gromacs.bioexcel.eu/u/RobertCoff)\
**Post date:** [August 14, 2023, 2:57pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/8 "2023-08-14T14:57:33Z")

</div>

I can get Plumed 2.8.2 to run with a funnel-metadynamics simulation using non-MPI gromacs 2022.5 if I use the mdrun option -ntmpi 1 . Anything larger than 1 does not work. This also limits Gromacs to recognizing only 1 gpu, even if others are available. It would be nice if Plumed worked with Gromacs’ threadMPI because I get ~3x more performance using non-MPI on a single node with 1-4 gpus when running equilibrium simulations.

---

<div class="post-metadata">

**Author:** ![Chenggong](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@Chenggong](https://gromacs.bioexcel.eu/u/Chenggong)\
**Post date:** [March 25, 2024, 12:45pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/9 "2024-03-25T12:45:30Z")

</div>

I got the same error with plumed 2.8.2 + gromacs 2022.5. My solution was to use plumed 2.8.2 with gromacs 2021.7 with MPI+cuda for my replicas exchange

---

<div class="post-metadata">

**Author:** ![obZehn](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/obzehn/32/2629_2.png) [@obZehn](https://gromacs.bioexcel.eu/u/obZehn)\
**Post date:** [March 26, 2024, 8:11am UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/10 "2024-03-26T08:11:11Z")

</div>

This is the GROMACS error right? What does the plumed output file say?

Anyway, I am pretty sure PLUMED was not compatible with GROMACS thread MPI ([https://groups.google.com/g/plumed-users/c/0B5AAbBB9M0](https://groups.google.com/g/plumed-users/c/0B5AAbBB9M0)), and I don’t think this changed. If you want to use MPI then you have to compile something like OpenMPI, link it to PLUMED for the compilation, use that PLUMED to patch GROMACS and compile that GROMACS pointing at the same MPI install.

---

<div class="post-metadata">

**Author:** ![Chenggong](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@Chenggong](https://gromacs.bioexcel.eu/u/Chenggong)\
**Post date:** [March 27, 2024, 2:02pm UTC](https://gromacs.bioexcel.eu/t/cuda-error-gromacs-with-plumed/5583/11 "2024-03-27T14:02:25Z")

</div>

Sorry to add more confusion. Mine was not the same error as this post. I was trying to to Hamiltonian replica exchange (with external MPI).  
I tried several combinations again on my ubuntu 22.04 (GCC 11.4.0) with cuda11.8 with openMPI 4.1.6, and they all work fine for Hamiltonian replica exchange, and I cannot reproduce my previous error.  
plumed 2.8.2, gmx 2021.7  
plumed 2.8.2, gmx 2022.5  
plumed 2.8.3, gmx 2021.7  
plumed 2.8.3, gmx 2022.5
