# Gromacs 2023 GPU support not working for some reason

**URL:** <https://gromacs.bioexcel.eu/t/gromacs-2023-gpu-support-not-working-for-some-reason/6262>\
**Category:** User discussions\
**Tags:** gpu\
**Created:** [April 24, 2023, 6:59am UTC](https://gromacs.bioexcel.eu/t/gromacs-2023-gpu-support-not-working-for-some-reason/6262 "2023-04-24T06:59:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noob](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@Noob](https://gromacs.bioexcel.eu/u/Noob)\
**Post date:** [April 24, 2023, 6:59am UTC](https://gromacs.bioexcel.eu/t/gromacs-2023-gpu-support-not-working-for-some-reason/6262/1 "2023-04-24T06:59:49Z")

</div>

GROMACS version: 2023  
GROMACS modification: No  
Here post your question  
So I have beee trying to get GPU support for gromacs in my WSL2 Ubuntu system, for a few days and have come up short so I thought I’d try here. I have already run the comands to compile gromacs form source code like on the website as shown:

```auto
tar xfz gromacs-2023.1.tar.gz
cd gromacs-2023.1
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON
make
make check
sudo make install
source /usr/local/gromacs/bin/GMXRC

```

but I then realized from watching tutorials on youtube that running Gromacs on GPU is better, so I installed CUDA and recompiled it with the cmake command:

```auto
cmake .. -DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DCUDAToolkit_ROOT=/usr/local/cuda

```

then ran the make and source commands again, then ran gmx --version and got this:

```auto
GROMACS version: 2023
Precision: mixed
Memory model: 64 bit
MPI library: thread_mpi
OpenMP support: enabled (GMX_OPENMP_MAX_THREADS = 128)
GPU support: CUDA
NB cluster size: 8
SIMD instructions: AVX2_256
CPU FFT library: fftw-3.3.8-sse2-avx-avx2-avx2_128
GPU FFT library: cuFFT
Multi-GPU FFT: none
RDTSCP usage: enabled
TNG support: enabled
Hwloc support: disabled
Tracing support: disabled
C compiler: /usr/bin/cc GNU 11.3.0
C compiler flags: -fexcess-precision=fast -funroll-all-loops -mavx2 -mfma -Wno-missing-field-initializers -O3 -DNDEBUG
C++ compiler: /usr/bin/c++ GNU 11.3.0
C++ compiler flags: -fexcess-precision=fast -funroll-all-loops -mavx2 -mfma -Wno-missing-field-initializers -Wno-cast-function-type-strict -fopenmp -O3 -DNDEBUG
BLAS library:
LAPACK library:
CUDA compiler: /usr/local/cuda/bin/nvcc nvcc: NVIDIA (R) Cuda compiler driver;Copyright (c) 2005-2023 NVIDIA Corporation;Built on Mon_Apr__3_17:16:06_PDT_2023;Cuda compilation tools, release 12.1, V12.1.105;Build cuda_12.1.r12.1/compiler.32688072_0
CUDA compiler flags:-std=c++17;--generate-code=arch=compute_50,code=sm_50;--generate-code=arch=compute_52,code=sm_52;--generate-code=arch=compute_60,code=sm_60;--generate-code=arch=compute_61,code=sm_61;--generate-code=arch=compute_70,code=sm_70;--generate-code=arch=compute_75,code=sm_75;--generate-code=arch=compute_80,code=sm_80;--generate-code=arch=compute_86,code=sm_86;--generate-code=arch=compute_89,code=sm_89;--generate-code=arch=compute_90,code=sm_90;-Wno-deprecated-gpu-targets;--generate-code=arch=compute_53,code=sm_53;--generate-code=arch=compute_80,code=sm_80;-use_fast_math;-Xptxas;-warn-double-usage;-Xptxas;-Werror;-D_FORCE_INLINES;-fexcess-precision=fast -funroll-all-loops -mavx2 -mfma -Wno-missing-field-initializers -Wno-cast-function-type-strict -fopenmp -O3 -DNDEBUG
CUDA driver: 11.70
CUDA runtime: 12.10

```

which made me think that support was enabled, but when I ran this command:

```auto
gmx mdrun -deffnm md_0_1 -nb gpu

```

I got his result:

```auto
:-) GROMACS - gmx mdrun, 2023 (-:

Executable: /usr/local/gromacs/bin/gmx
Data prefix: /usr/local/gromacs
Working dir: /mnt/c/Users/jerem/Documents/MD simulations/Lysozyme in Water
Command line:
  gmx mdrun -deffnm md_0_1 -nb gpu

Back Off! I just backed up md_0_1.log to ./#md_0_1.log.18#
Reading file md_0_1.tpr, VERSION 2021.4-Ubuntu-2021.4-2 (single precision)
Note: file tpx version 122, software tpx version 129
Changing nstlist from 10 to 100, rlist from 1 to 1.168

-------------------------------------------------------
Program: gmx mdrun, version 2023
Source file: src/gromacs/taskassignment/findallgputasks.cpp (line 85)
MPI rank: 2 (out of 20)

Fatal error:
Cannot run short-ranged nonbonded interactions on a GPU because no GPU is
detected.

```

## 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)

it says not GPU detected but when I run this command:

```auto
nvidia-smi

```

and get:

```auto
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.85 Driver Version: 517.70 CUDA Version: 11.7 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... On | 00000000:01:00.0 Off | N/A |
| N/A 41C P0 23W / N/A | 0MiB / 6144MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+

```

which makes me think that my Linux subsystem can detect my graphics card my gromacs can’t for some reason?

---

<div class="post-metadata">

**Author:** ![scinikhil](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/scinikhil/32/3483_2.png) [@scinikhil](https://gromacs.bioexcel.eu/u/scinikhil)\
**Post date:** [May 18, 2023, 10:59am UTC](https://gromacs.bioexcel.eu/t/gromacs-2023-gpu-support-not-working-for-some-reason/6262/2 "2023-05-18T10:59:45Z")

</div>

Can you just run gmx mdrun -deffm md\_o\_1 and update the log here

---

<div class="post-metadata">

**Author:** ![al42and](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/al42and/32/1393_2.png) [@al42and](https://gromacs.bioexcel.eu/u/al42and)\
**Post date:** [May 18, 2023, 12:14pm UTC](https://gromacs.bioexcel.eu/t/gromacs-2023-gpu-support-not-working-for-some-reason/6262/3 "2023-05-18T12:14:21Z")

</div>

> [@Noob](#):
>
> which makes me think that my Linux subsystem can detect my graphics card my gromacs can’t for some reason?

Hi!

You compiled GROMACS with CUDA 12.1, yet your driver is for CUDA 11.7.

You have to update your NVIDIA driver or downgrade your CUDA installation. You can find the compatibility matrix in the CUDA docs: [1. CUDA 12.3 Update 1 Release Notes — Release Notes 12.3 documentation](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#id4)

---

<div class="post-metadata">

**Author:** ![era01](https://avatars.discourse-cdn.com/v4/letter/e/8e8cbc/32.png) [@era01](https://gromacs.bioexcel.eu/u/era01)\
**Post date:** [May 15, 2024, 10:09am UTC](https://gromacs.bioexcel.eu/t/gromacs-2023-gpu-support-not-working-for-some-reason/6262/4 "2024-05-15T10:09:54Z")

</div>

may i know what you did to solve this? i am encountering this same problem

---

<div class="post-metadata">

**Author:** ![Noob](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@Noob](https://gromacs.bioexcel.eu/u/Noob)\
**Post date:** [May 15, 2024, 5:26pm UTC](https://gromacs.bioexcel.eu/t/gromacs-2023-gpu-support-not-working-for-some-reason/6262/5 "2024-05-15T17:26:14Z")

</div>

It was what al42and said, it was a problem with the CUDA version gromacs was compiled with and my driver version. I suggest updating your drivers, so you don’t have to recompile gromacs.
