# GPU not being enabled even though I compile it with CUDA support on a Azure VM

**URL:** <https://gromacs.bioexcel.eu/t/gpu-not-being-enabled-even-though-i-compile-it-with-cuda-support-on-a-azure-vm/11129>\
**Category:** User discussions\
**Tags:** gpu\
**Created:** [January 23, 2025, 7:20pm UTC](https://gromacs.bioexcel.eu/t/gpu-not-being-enabled-even-though-i-compile-it-with-cuda-support-on-a-azure-vm/11129 "2025-01-23T19:20:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EMMartin](https://avatars.discourse-cdn.com/v4/letter/e/b77776/32.png) [@EMMartin](https://gromacs.bioexcel.eu/u/EMMartin)\
**Post date:** [January 23, 2025, 7:20pm UTC](https://gromacs.bioexcel.eu/t/gpu-not-being-enabled-even-though-i-compile-it-with-cuda-support-on-a-azure-vm/11129/1 "2025-01-23T19:20:29Z")

</div>

GROMACS version: 2024.4  
GROMACS modification: No

I used the following command to compile gromacs in a virtual machine from Azure.

cmake … -DCMAKE\_C\_COMPILER=gcc-10  
-DCMAKE\_CXX\_COMPILER=g+±10  
-DGMX\_MPI=on  
-DGMX\_GPU=CUDA  
-DGMX\_BUILD\_OWN\_FFTW=ON  
-DCUDA\_TOOLKIT\_ROOT\_DIR=/usr/local/cuda

The drivers that I have are 560.35.05 and nvcc-CUDA Version: 12.6. The VM has 8 vCPUs and 1 Nvidia Tesla T4 GPU (16GB).

```
  Start 31: GpuUtilsUnitTests

```

31/89 Test #31: GpuUtilsUnitTests … Passed 1.04 sec  
Start 73: MdrunMpiTests  
73/89 Test #73: MdrunMpiTests … Passed 8.96 sec  
Start 74: MdrunMultiSimTests  
74/89 Test #74: MdrunMultiSimTests … Passed 11.52 sec  
Start 75: MdrunMultiSimReplexTests  
75/89 Test #75: MdrunMultiSimReplexTests … Passed 5.60 sec  
Start 76: MdrunMultiSimReplexEquivalenceTests  
76/89 Test #76: MdrunMultiSimReplexEquivalenceTests … Passed 14.36 sec  
Start 77: MdrunMpi1RankPmeTests  
77/89 Test #77: MdrunMpi1RankPmeTests … Passed 4.11 sec  
Start 78: MdrunMpi2RankPmeTests  
78/89 Test #78: MdrunMpi2RankPmeTests … Passed 10.43 sec

Label Time Summary:  
GTest = 1070.93 sec_proc (87 tests)  
IntegrationTest = 634.58 sec_proc (30 tests)  
MpiTest = 805.20 sec_proc (23 tests)  
QuickGpuTest = 259.04 sec_proc (20 tests)  
SlowGpuTest = 730.61 sec_proc (14 tests)  
SlowTest = 382.64 sec_proc (13 tests)  
UnitTest = 53.71 sec\*proc (44 tests)

All the test performed by make check were passed even those regarding GPU use, though when I check for gmx --version the GPU support appears to be disabled.  
GROMACS: gmx, version 2021.4-Ubuntu-2021.4-2  
Executable: /usr/bin/gmx  
Data prefix: /usr  
Working dir: /home/azureuser/gromacs-2024.4/build  
Command line:  
gmx --version

GROMACS version: 2021.4-Ubuntu-2021.4-2  
Precision: mixed  
Memory model: 64 bit  
MPI library: thread\_mpi  
OpenMP support: enabled (GMX\_OPENMP\_MAX\_THREADS = 64)  
GPU support: disabled  
SIMD instructions: SSE4.1  
FFT library: fftw-3.3.8-sse2-avx  
RDTSCP usage: enabled  
TNG support: enabled  
Hwloc support: hwloc-2.5.0  
Tracing support: disabled  
C compiler: /usr/bin/cc GNU 11.2.0  
C compiler flags: -msse4.1 -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -O3 -DNDEBUG  
C++ compiler: /usr/bin/c++ GNU 11.2.0  
C++ compiler flags: -msse4.1 -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -fopenmp -O3 -DNDEBUG

I am trying to provide all information that I think might be related to the use of the GPUs, hope that helps. One thing that has catch my eye is some test that do not respond when the nvcc is trying to make some checks.  
– Checking if nvcc accepts flags --generate-code=arch=compute\_35,code=sm\_35  
– Checking if nvcc accepts flags --generate-code=arch=compute\_35,code=sm\_35 - No  
– Checking if nvcc accepts flags --generate-code=arch=compute\_37,code=sm\_37  
– Checking if nvcc accepts flags --generate-code=arch=compute\_37,code=sm\_37 - No

These appear during the cmake and make processes.

Thanks in advance, hope you have an idea of what the issue is and I was clear enough.

---

<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:** [January 24, 2025, 6:44am UTC](https://gromacs.bioexcel.eu/t/gpu-not-being-enabled-even-though-i-compile-it-with-cuda-support-on-a-azure-vm/11129/2 "2025-01-24T06:44:10Z")

</div>

It looks like you are not using the recently compiled 2024.4 version:  
“GROMACS: gmx, version 2021.4-Ubuntu-2021.4-2  
Executable: /usr/bin/gmx  
Data prefix: /usr  
Working dir: /home/azureuser/gromacs-2024.4/build”

If you want to keep the 2024.4 installation separate from the system-wide GROMACS installation (or if you don’t have admin privileges), you can add `-DCMAKE_INSTALL_PREFIX=/home/azureuser/gromacs-2024.4/build/install` (you can change the installation dir if you want to, see [Installation guide - GROMACS 2024.4 documentation](https://manual.gromacs.org/current/install-guide/index.html#where-to-install-gromacs)) to the cmake command. Then you will have to recompile, install the newly compiled version and finally update the environment variables to use the new version. So, a full command sequence would be something like:

```auto
cmake … -DCMAKE_C_COMPILER=gcc-10
-DCMAKE_CXX_COMPILER=g+±10
-DGMX_MPI=on
-DGMX_GPU=CUDA
-DGMX_BUILD_OWN_FFTW=ON
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
-DCMAKE_INSTALL_PREFIX=/home/azureuser/gromacs-2024.4/build/install

make -j 16
make install
source /home/azureuser/gromacs-2024.4/build/install/bin/GMXRC

```

The last line command (`source ...`) needs to be run once in all terminals/logins you want to use this version of GROMACS, see [Installation guide - GROMACS 2024.4 documentation](https://manual.gromacs.org/current/install-guide/index.html#getting-access-to-gromacs-after-installation).

---

<div class="post-metadata">

**Author:** ![EMMartin](https://avatars.discourse-cdn.com/v4/letter/e/b77776/32.png) [@EMMartin](https://gromacs.bioexcel.eu/u/EMMartin)\
**Post date:** [January 29, 2025, 3:12am UTC](https://gromacs.bioexcel.eu/t/gpu-not-being-enabled-even-though-i-compile-it-with-cuda-support-on-a-azure-vm/11129/3 "2025-01-29T03:12:59Z")

</div>

Thanks a lot for the, this worked just fine.
