I recompiled GROMACS with GPU support and it is still not using my GPU

GROMACS version: 2021.5
GROMACS modification: No
I have been trying to run GROMACS on my personal computer for the past month or so and cannot figure out how to take advantage of my GPU. Her are some details:

OS: Ubuntu 20.04
CPU: Ryzen 9 5900

Drivers up to date
CUDA installed

Here are some of the things I have tried:

I have fully removed GROMACS from my system and recompiled with the following tags (each of these was a seperate recompile):


In each of these recompiles I redo the lysozyme tutorial from scratch and when I hit mdrun I try with the -nb gpu tag and without. The closest I have gotten to using my gpu was the -DGMX_GPU=CUDA attempt. That attempt gave me “GPU support: CUDA” when I looked into GROMACS version.

Everything runs fine on my CPU, but I would like to take advantage of my hardware if I can. Please help and let me know if you need any other information to help diagnose the issue.


Usually this happens when there is a mismatch between a driver version and CUDA runtime. The header of the .log file will have some information about the versions it finds, and if one of these says “unknown,” then that is the problem.

I don’t see in your post any indication of what’s not working? In what way is the GPU not used? What happens when you run gmx mdrun -nb gpu?

I think I semi solved my issue. It turns out the command: “source /usr/local/gromacs/bin/GMXRC” was not executing, but if I move to a directory for a project I am working on and run “source /usr/local/gromacs/bin/GMXRC”, Gromacs works fine as I meant to compile it (with gpu support).

I think this may be a permission issue, but I am not sure. Any suggestions to get this working without having to execute that command each time would be much appreciated.



Normally one would just add the source command to a shell startup script, so that you have full access to your GROMACS installation every time you open a terminal without having to manually do anything. It should have no connection at all to what directory you’re in when you execute it. Alternatively, simply add /usr/local/gromacs/bin to your $PATH.