Compile Gromacs with GPU/AdaptiveCpp support on PC

GROMACS version: 2024.2
GROMACS modification: No

Hi,
I want to compile Gromacs with GPU support on my PC, with hardware:
CPU: 12th Gen Intel(R) Core™ i9-12900
GPU: [AMD/ATI] Navi 23 [Radeon RX 6650 XT / 6700S / 6800S] (rev c1)
I’ve installed several ROCm package provided by arch-linux and compiled AdaptiveCpp with options:

cmake -DROCM_PATH=/opt/rocm -DWITH_ROCM_BACKEND=ON -DCMAKE_INSTALL_PREFIX=/home/myuser/AdaptiveCPP-24.02 -DCLANG_EXECUTABLE_PATH=/opt/rocm/lib/llvm/bin/clang -DHIPSYCL_NO_DEVICE_MANGLER=ON -DLLVM_ROOT=/opt/rocm/lib/llvm/lib/cmake -DWITH_SSCP_COMPILER=OFF -DWITH_OPENCL_BACKEND=OFF -DWITH_LEVEL_ZERO_BACKEND=OFF -DDEFAULT_TARGETS='hip:gfx1032' ..

then:

export PATH=~/AdaptiveCPP-24.02:$PATH
export CC=/opt/rocm/lib/llvm/bin/clang
export CXX=/opt/rocm/lib/llvm/bin/clang++

configured Gromacs with:

cmake -DGMX_MPI=on -DGMX_GPU=SYCL -DGMX_SYCL=ACPP -DCMAKE_INSTALL_PREFIX=/home/salvicio/gromacs.single/gromacs-2024.2 -DCMAKE_C_COMPILER=/opt/rocm/lib/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/rocm/lib/llvm/bin/clang++ -DHIPSYCL_TARGETS='hip:gfx1032' ..

then I have the following errors during build (cmake --build .):

[ 41%] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/domdec/cellsizes.cpp.o
In file included from /home/myuser/src/gromacs-2024.2/src/gromacs/nbnxm/sycl/nbnxm_gpu_buffer_ops_internal_sycl.cpp:48:
In file included from /home/myuser/src/gromacs-2024.2/src/gromacs/nbnxm/sycl/nbnxm_sycl_types.h:46:
In file included from /home/myuser/src/gromacs-2024.2/src/gromacs/gpu_utils/devicebuffer_sycl.h:56:
/home/myuser/src/gromacs-2024.2/src/gromacs/gpu_utils/gputraits_sycl.h:55:7: error: type alias redefinition with different types ('void *' vs 'cl_event' (aka '_cl_event *'))
using CommandEvent = void*;
      ^
/home/myuser/src/gromacs-2024.2/src/gromacs/gpu_utils/gputraits_ocl.h:53:7: note: previous definition is here
using CommandEvent = cl_event;
      ^
In file included from /home/myuser/src/gromacs-2024.2/src/gromacs/nbnxm/sycl/nbnxm_gpu_buffer_ops_internal_sycl.cpp:48:
In file included from /home/myuser/src/gromacs-2024.2/src/gromacs/nbnxm/sycl/nbnxm_sycl_types.h:46:
In file included from /home/myuser/src/gromacs-2024.2/src/gromacs/gpu_utils/devicebuffer_sycl.h:56:
/home/myuser/src/gromacs-2024.2/src/gromacs/gpu_utils/gputraits_sycl.h:59:7: error: type alias redefinition with different types ('sycl::float4' (aka 'vec<float, 4>') vs 'cl_float4')
using Float4 = sycl::float4;

Maybe some conflicts due to rocm llvm or to some compile options I’ve added to solve other compile issue?
Any suggestions?

Best regards.

Hi!

Could you try clearing your build directory?

By any chance, have you tried building GROMACS with OpenCL earlier? Looks like the build system / configuration is trying to use both SYCL/ACpp and OpenCL

yes!
I’ve compiled using openCL (in main gromacs source folder): with clean source folder the building process arrive at 100%.

Thanks!