Does GROMACS supports GPU acceleration on M1 Mac?

GROMACS version:2021.4
GROMACS modification: No
I have installed the GROMACS 2021.4 on my Macbook with M1, OpenCL supported. However it seems the GPU is not supported.
The log shows:

Running on 1 node with total 8 cores, 8 logical cores, 0 compatible GPUs
Hardware detected:
CPU info:
Vendor: ARM
Brand: Unknown CPU brand
Family: 0 Model: 0 Stepping: 0
Features: neon neon_asimd
Hardware topology: Only logical processor count
GPU info:
Number of GPUs detected: 1
#0: name: Apple M1 Pro, vendor: Apple, device version: OpenCL 1.2 , status: incompatible

Is this means the GPU acceletate doesn’t support M1?

No it is not supported. You can try to see if it works at all by setting the GMX_GPU_DISABLE_COMPATIBILITY_CHECK environment variable which disables the compatibility check. Let us know what you find!
If that seems to work, do make sure that you run extensive tests before you proceed to use the GPU.

Thank you! After setting GMX_GPU_DISABLE_COMPATIBILITY_CHECK=1 and with a OpenCL-enabled build, GROMACS is indeed able to find and utilize the GPU in M1 chip.

Can you please report back whether tests pass and everything seems to run correctly?

Hi there,
I did install yesterday and make check passed all the test 100%

100% tests passed, 0 tests failed out of 90

Label Time Summary:
GTest              = 117.59 sec*proc (83 tests)
IntegrationTest    =  45.68 sec*proc (27 tests)
MpiTest            =  30.27 sec*proc (21 tests)
SlowTest           =  29.23 sec*proc (13 tests)
UnitTest           =  42.68 sec*proc (43 tests)

Total Test time (real) = 701.14 sec
[100%] Built target run-ctest-nophys
[100%] Built target check

cmake command I used:

CC=/opt/homebrew/bin/mpicc CXX=/opt/homebrew/bin/mpic++ cmake ../ -DCMAKE_INSTALL_PREFIX=/Users/duy/soft/gromacs -DGMX_FFT_LIBRARY=fftw3 -DGMX_MPI=ON -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=OpenCL

Compiler: GNU, opencl, libomp from homebrew

Version: 2022.1

This is the benchmarking for M1 Pro

Particles                    Speed (ns/day)
214305                          5.546
77788                          14.677

Enjoy MDs

2 Likes

Hi,

Thanks for the feedback. Note however that running just make check will not use the GPU, you need to disable the compatibility check as you did for mdrun. Do the tests still pass if you run GMX_GPU_DISABLE_COMPATIBILITY_CHECK=1 make check?

Cheers,
Szilárd

Hi.
For me it passed.

Hi,
I have installed Gromacs 2023.1 on a Mac M1 Pro using Homebrew.
Do you know if it is possible to enable GPU support with this type of installation?
Thank you very much!

I’m not an expert on Mac things, but judging by the Homebrew formula for GROMACS, no, it does not support OpenCL.

You will have to compile GROMACS yourself with -DGMX_GPU=OpenCL.

Thank you so much!