# Compile Gromacs with GPU/AdaptiveCpp support on PC

**URL:** <https://gromacs.bioexcel.eu/t/compile-gromacs-with-gpu-adaptivecpp-support-on-pc/9311>\
**Category:** User discussions\
**Tags:** gpu, installation-error\
**Created:** [June 5, 2024, 12:46pm UTC](https://gromacs.bioexcel.eu/t/compile-gromacs-with-gpu-adaptivecpp-support-on-pc/9311 "2024-06-05T12:46:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Beer](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Alex\_Beer](https://gromacs.bioexcel.eu/u/Alex_Beer)\
**Post date:** [June 5, 2024, 12:46pm UTC](https://gromacs.bioexcel.eu/t/compile-gromacs-with-gpu-adaptivecpp-support-on-pc/9311/1 "2024-06-05T12:46:59Z")

</div>

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:

```auto
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:

```auto
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:

```auto
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 .):

```auto
[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.

---

<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:** [June 5, 2024, 3:51pm UTC](https://gromacs.bioexcel.eu/t/compile-gromacs-with-gpu-adaptivecpp-support-on-pc/9311/2 "2024-06-05T15:51:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alex\_Beer](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Alex\_Beer](https://gromacs.bioexcel.eu/u/Alex_Beer)\
**Post date:** [June 5, 2024, 5:01pm UTC](https://gromacs.bioexcel.eu/t/compile-gromacs-with-gpu-adaptivecpp-support-on-pc/9311/3 "2024-06-05T17:01:32Z")

</div>

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

Thanks!
