GROMACS version: 2022.1
GROMACS modification: No
Here post your question
Dear all,
I have been struggling to compile gromacs with OpenCL (Radeon 6800xt GPU) for some time. I think it’s about the time to ask experts for some help.
I have installed opencl-headers and ocl-icd-libopencl1 from apt, as suggested in the manual, but cmake complained that it can’t find opencl libraries. Therefore, I have installed the amdgpu drivers from amd (Using the amdgpu-install Script — amdgpu graphics and compute stack unknown-build documentation) and included --opencl=rocr option.
With that, I was able to run cmake:
cmake … -DGMX_GPU=OpenCL -DGMX_BUILD_OWN_FFTW=ON -DCMAKE_INSTALL_PREFIX=$HOME/gromacs-2022.1-opencl/ -DCMAKE_PREFIX_PATH=/opt/rocm-5.1.2
Followed by smooth make and make install:
gmx -version
GROMACS version: 2022.1
Precision: mixed
Memory model: 64 bit
MPI library: thread_mpi
OpenMP support: enabled (GMX_OPENMP_MAX_THREADS = 128)
GPU support: OpenCL
SIMD instructions: AVX2_256
CPU FFT library: fftw-3.3.8-sse2-avx-avx2-avx2_128
GPU FFT library: clFFT
RDTSCP usage: enabled
TNG support: enabled
Hwloc support: disabled
Tracing support: disabled
C compiler: /usr/bin/cc GNU 9.4.0
C compiler flags: -mavx2 -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -O3 -DNDEBUG
C++ compiler: /usr/bin/c++ GNU 9.4.0
C++ compiler flags: -mavx2 -mfma -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -fopenmp -O3 -DNDEBUG
OpenCL include dir: /usr/include
OpenCL library: /opt/rocm-5.1.2/lib/libOpenCL.so
OpenCL version: 2.2
However, when I start mdrun (gmx mdrun -s bench.tpr -deffnm tst -nb gpu), gromacs complains:
Cannot run short-ranged nonbonded interactions on a GPU because no GPU is
detected.
clinfo (sudo /opt/amdgpu-pro/bin/clinfo) recognizes the card:
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 2.1 AMD-APP (3423.0)
Platform Name: AMD Accelerated Parallel Processing
Platform Vendor: Advanced Micro Devices, Inc.
Platform Extensions: cl_khr_icd cl_amd_event_callback
Platform Name: AMD Accelerated Parallel Processing
Number of devices: 1
Device Type: CL_DEVICE_TYPE_GPU
Vendor ID: 1002h
Board name: AMD Radeon RX 6800 XT
Device Topology: PCI[ B#12, D#0, F#0 ]
Max compute units: 36
Max work items dimensions: 3
(…)
Any hints where I made the mistake?
Thanks!