Installation with GPU

GROMACS version: 2023.3
GROMACS modification: Yes/No
Here post your question

Im trying to install gromacs with SYCL GPU suport using

$ cmake … -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=SYCL -DGMX_SYCL_HIPSYCL=on

but I got the error

CMake Error at cmake/gmxManageSYCL.cmake:77 (message):
HipSYCL build requires Clang compiler, but GNU is used
Call Stack (most recent call first):
CMakeLists.txt:667 (include)

and I don’t know how to solve. What am I doing wrong?

Hi!

When compiling GROMACS with hipSYCL, you must set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the same clang/clang++ used in hipSYCL. You can check which one it is by running syclcc --hipsycl-version | grep default-clang.

Our installation guide recommends using amdclang for both hipSYCL and GROMACS, but any recent Clang should work as long as it is the same version.

I already have the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER, and I have a Intel GPUs using [Intel oneAPI DPC++]. Can’t identify the problem that makes the installation impossible.

I already have the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER

Please, double-check your flags. As you can see in the error message, CMake is using GCC compiler. If you have set the flags earlier, perhaps they were reset, or you had a typo somewhere.

Intel GPUs using [Intel oneAPI DPC++]

In this case, please set -DGMX_SYCL_HIPSYCL=OFF. GROMACS does not support using hipSYCL/AdaptiveCpp for Intel devices.

So how can I install gromacs with GPU acceleration in this case?

If you have Intel GPU, please follow our installation guide for Intel GPUs: https://manual.gromacs.org/current/install-guide/index.html#sycl-gpu-acceleration-for-intel-gpus:

  1. Install oneAPI basekit: Download the Intel® oneAPI Base Toolkit. We are recommending oneAPI 2022.3 there, since it’s the most tested. But any newer version should work.
  2. Make sure it’s loaded into your current console session, so the compilers etc are properly detected: source /opt/intel/oneapi/setvars.sh
  3. Configure GROMACS with cmake .. -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGMX_GPU=SYCL. You might have to remove your old CMakeCache.txt first.

I followed the instructions in the installation guide and it still got errors.
Don’t know what is going wrong once the C and CXX compilers is already installed.

As follow:

– The C compiler identification is unknown
– The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:82 (project):
The CMAKE_C_COMPILER:

icx

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable “CC” or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.

CMake Error at CMakeLists.txt:82 (project):
The CMAKE_CXX_COMPILER:

icpx

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable “CXX” or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

– Configuring incomplete, errors occurred!
See also “/home/cae/Downloads/gromacs-2023.3/build/CMakeFiles/CMakeOutput.log”.
See also “/home/cae/Downloads/gromacs-2023.3/build/CMakeFiles/CMakeError.log”.

Does simply running icx or icpx in the same shell works? If yes, try removing CMakeCache.txt and trying again

If not: The Intel compilers, by default, are installed in a non-standard location. Make sure you run source /opt/intel/oneapi/setvars.sh in the same terminal session as CMake. Even after the compilers are installed, this sourcing should be done every time you open a new shell (or you can add this command to the end of your .bashrc or the like).

Yes, I have run the source for intel oneapi before the comands for gromacs installation in the guide for Intel GPUs like following, and I removed the CMakeCache.txt.


:: initializing oneAPI environment ...
   -bash: BASH_VERSION = 5.1.16(1)-release
   args: Using "$@" for setvars.sh arguments:
:: advisor -- latest
:: ccl -- latest
:: compiler -- latest
:: dal -- latest
:: debugger -- latest
:: dev-utilities -- latest
:: dnnl -- latest
:: dpcpp-ct -- latest
:: dpl -- latest
:: ipp -- latest
:: ippcp -- latest
:: mkl -- latest
:: mpi -- latest
:: tbb -- latest
:: vtune -- latest
:: oneAPI environment initialized ::

cae@ROBSONSANTOS:~/Downloads/gromacs-2023.3/build$

 Simply running icx or icpx does'nt work, it says no input files

cae@ROBSONSANTOS:~/Downloads/gromacs-2023.3/build$ icx
icx: error: no input files
cae@ROBSONSANTOS:~/Downloads/gromacs-2023.3/build$ icpx
icpx: error: no input files

Ok, thanks for checking. Could you please share your CMakeError.log file? You can attach it to the post here or upload to a file-sharing service.

Thank you for your attention and support, the requested file is attached to this message.
CMakeError.log (9.3 KB)

I provided the path to the compiler with `sudo cmake … -DCMAKE_C_COMPILER=/opt/intel/oneapi/compiler/2024.0/bin/icx -DCMAKE_CXX_COMPILER=/opt/intel/oneapi/compiler/2024.0/bin/icpx -DGMX_GPU=SYCL´ but an error still occurred.

sudo cmake … -DCMAKE_C_COMPILER=/opt/intel/oneapi/compiler/2024.0/bin/icx -DCMAKE_CXX_COMPILER=/opt/intel/oneapi/compiler/2024.0/bin/icpx -DGMX_GPU=SYCL

– The C compiler identification is IntelLLVM 2024.0.2
– The CXX compiler identification is IntelLLVM 2024.0.2
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /opt/intel/oneapi/compiler/2024.0/bin/icx - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /opt/intel/oneapi/compiler/2024.0/bin/icpx - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Performing Test CXX17_COMPILES_SIMPLY
– Performing Test CXX17_COMPILES_SIMPLY - Success
– Found Python3: /usr/bin/python3.10 (found suitable version “3.10.12”, minimum required is “3.7”) found components: Interpreter Development Development.Module Development.Embed
– Selected GPU FFT library - MKL
– Found OpenMP_C: -fiopenmp
– Found OpenMP_CXX: -fiopenmp
– Found OpenMP: TRUE
– Performing Test CFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS
– Performing Test CFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS - Success
– Performing Test CXXFLAGS_WARN_NO_RESERVED_IDENTIFIER
– Performing Test CXXFLAGS_WARN_NO_RESERVED_IDENTIFIER - Success
– Performing Test CXXFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS
– Performing Test CXXFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS - Success
– Performing Test CXXFLAGS_NO_UNROLL_WARNING
– Performing Test CXXFLAGS_NO_UNROLL_WARNING - Success
– Looking for include file unistd.h
– Looking for include file unistd.h - found
– Looking for include file pwd.h
– Looking for include file pwd.h - found
– Looking for include file dirent.h
– Looking for include file dirent.h - found
– Looking for include file time.h
– Looking for include file time.h - found
– Looking for include file sys/time.h
– Looking for include file sys/time.h - found
– Looking for include file io.h
– Looking for include file io.h - not found
– Looking for include file sched.h
– Looking for include file sched.h - found
– Looking for include file xmmintrin.h
– Looking for include file xmmintrin.h - found
– Looking for gettimeofday
– Looking for gettimeofday - found
– Looking for sysconf
– Looking for sysconf - found
– Looking for nice
– Looking for nice - found
– Looking for fsync
– Looking for fsync - found
– Looking for _fileno
– Looking for _fileno - not found
– Looking for fileno
– Looking for fileno - found
– Looking for _commit
– Looking for _commit - not found
– Looking for sigaction
– Looking for sigaction - found
– Performing Test HAVE_BUILTIN_CLZ
– Performing Test HAVE_BUILTIN_CLZ - Success
– Performing Test HAVE_BUILTIN_CLZLL
– Performing Test HAVE_BUILTIN_CLZLL - Success
– Looking for clock_gettime in rt
– Looking for clock_gettime in rt - found
– Looking for feenableexcept in m
– Looking for feenableexcept in m - found
– Looking for fedisableexcept in m
– Looking for fedisableexcept in m - found
– Checking for sched.h GNU affinity API
– Performing Test sched_affinity_compile
– Performing Test sched_affinity_compile - Success
– Looking for include file mm_malloc.h
– Looking for include file mm_malloc.h - found
– Looking for include file malloc.h
– Looking for include file malloc.h - found
– Checking for _mm_malloc()
– Checking for _mm_malloc() - supported
– Looking for posix_memalign
– Looking for posix_memalign - found
– Looking for memalign
– Looking for memalign - not found
– GROMACS is being built without library MPI support (-DGMX_MPI=no). However MPI is potentially useful for the gmxapi Python API, so we will search for MPI anyway. If this causes problems, disable the check with -DCMAKE_DISABLE_FIND_PACKAGE_MPI=on.
– Found MPI_C: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so (found version “3.1”)
– Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version “3.1”)
– Found MPI: TRUE (found version “3.1”)
– Using default binary suffix: “”
– Using default library suffix: “”
– Looking for pthread.h
– Looking for pthread.h - found
– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
– Found Threads: TRUE
– Looking for C++ include pthread.h
– Looking for C++ include pthread.h - found
– Performing Test TEST_ATOMICS
– Performing Test TEST_ATOMICS - Success
– Atomic operations found
– Performing Test PTHREAD_SETAFFINITY
– Performing Test PTHREAD_SETAFFINITY - Success
– Detecting best SIMD instructions for this CPU
– Checking for GCC x86 inline asm
– Checking for GCC x86 inline asm - supported
– Detected build CPU features - aes apic avx avx2 avx512f avx512cd avx512bw avx512vl avx512secondFMA clfsh cmov cx8 cx16 f16c fma htt intel lahf mmx msr nonstop_tsc pcid pclmuldq pdpe1gb popcnt pse rdrnd rdtscp sha sse2 sse3 sse4.1 sse4.2 ssse3 tdt x2apic
– Detected build CPU brand - 11th Gen Intel(R) Core™ i5-1135G7 @ 2.40GHz
– Performing Test C_xCORE_AVX512_qopt_zmm_usage_high_FLAG_ACCEPTED
– Performing Test C_xCORE_AVX512_qopt_zmm_usage_high_FLAG_ACCEPTED - Success
– Performing Test C_xCORE_AVX512_qopt_zmm_usage_high_COMPILE_WORKS
– Performing Test C_xCORE_AVX512_qopt_zmm_usage_high_COMPILE_WORKS - Success
– Performing Test CXX_xCORE_AVX512_qopt_zmm_usage_high_FLAG_ACCEPTED
– Performing Test CXX_xCORE_AVX512_qopt_zmm_usage_high_FLAG_ACCEPTED - Success
– Performing Test CXX_xCORE_AVX512_qopt_zmm_usage_high_COMPILE_WORKS
– Performing Test CXX_xCORE_AVX512_qopt_zmm_usage_high_COMPILE_WORKS - Success
– This is an Intel CPU with only 1 AVX-512 FMA unit, so AVX2 will be faster.
– Detected best SIMD instructions for this CPU - AVX2_256
– Performing Test C_mavx2_mfma_FLAG_ACCEPTED
– Performing Test C_mavx2_mfma_FLAG_ACCEPTED - Success
– Performing Test C_mavx2_mfma_COMPILE_WORKS
– Performing Test C_mavx2_mfma_COMPILE_WORKS - Success
– Performing Test CXX_mavx2_mfma_FLAG_ACCEPTED
– Performing Test CXX_mavx2_mfma_FLAG_ACCEPTED - Success
– Performing Test CXX_mavx2_mfma_COMPILE_WORKS
– Performing Test CXX_mavx2_mfma_COMPILE_WORKS - Success
– Enabling 256-bit AVX2 SIMD instructions using CXX flags: -mavx2 -mfma
– Performing Test _Wno_unused_command_line_argument_FLAG_ACCEPTED
– Performing Test _Wno_unused_command_line_argument_FLAG_ACCEPTED - Success
– Performing Test _callconv___vectorcall
– Performing Test _callconv___vectorcall - Success
– Checking for flags to enable SYCL
– Performing Test SYCL_CXX_FLAGS_RESULT
– Performing Test SYCL_CXX_FLAGS_RESULT - Failed

CMake Error at cmake/gmxManageSYCL.cmake:384 (message):
Cannot compile a SYCL program with -fsycl. Try a different compiler or
disable SYCL.
Call Stack (most recent call first):
CMakeLists.txt:667 (include)

– Configuring incomplete, errors occurred!

After many attempts I managed to find a solution. Below I leave a step by step guide, in case anyone faces the same problem to install gromacs with Intel GPU support, since there is no detailed tutorial for this.

STEP 1: INSTALL INTEL ONE API BASE TOOLKIT

$ cd ~
sudo apt-get install libnotify4 xdg-utils libxcb-dri3-0 libgbm1 libnss3 libgtk-3-0 libatspi2.0-0 g++
sudo apt -y install ncurses-term

$ cd ~/Downloads
wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/163da6e4-56eb-4948-aba3-debcec61c064/l_BaseKit_p_2024.0.1.46_offline.sh
sudo sh ./l_BaseKit_p_2024.0.1.46_offline.sh

STEP 2: GET NEO DRIVER (Releases · intel/compute-runtime · GitHub)

$ apt install ocl-icd-libopencl1

$ cd ~/Downloads
mkdir neo
cd neo
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.15136.4/intel-igc-core_1.0.15136.4_amd64.deb
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.15136.4/intel-igc-opencl_1.0.15136.4_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.35.27191.9/intel-level-zero-gpu-dbgsym_1.3.27191.9_amd64.ddeb
wget https://github.com/intel/compute-runtime/releases/download/23.35.27191.9/intel-level-zero-gpu_1.3.27191.9_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.35.27191.9/intel-opencl-icd-dbgsym_23.35.27191.9_amd64.ddeb
wget https://github.com/intel/compute-runtime/releases/download/23.35.27191.9/intel-opencl-icd_23.35.27191.9_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.35.27191.9/libigdgmm12_22.3.11.ci17747749_amd64.deb

$ wget https://github.com/intel/compute-runtime/releases/download/23.35.27191.9/ww35.sum
sha256sum -c ww35.sum

$ sudo dpkg -i *.deb

STEP 3: CLONE SYCL FROM SYCL-ACADEMY ON GITHUB

cd ~/

sudo git clone --recurse-submodules GitHub - codeplaysoftware/syclacademy: SYCL Academy, a set of learning materials for SYCL heterogeneous programming

STEP 4: GET GROMACS INSTALLATION FILES

$ cd ~/Downloads
wget ftp://ftp.gromacs.org/gromacs/gromacs-2023.3.tar.gz
tar xfz gromacs-2023.3.tar.gz
cd gromacs-2023.3
mkdir build
cd build

STEP 5: COPY THE FILES ‘source.cpp’ AND ‘solucion.cpp’ (FROM Exercise_01_Compiling_with_SYCL) AND ‘catch2’ (FROM single_include) TO THE build DIRECTORY FOR GROMACS INSTALLATION

$ cd ~/syclacademy/External/Catch2/single_include/
cp -r catch2 ~/Downloads/gromacs-2023.3/build
cd ~/Downloads/gromacs-2023.3/build
ls
cd ~/syclacademy/Code_Exercises/Exercise_01_Compiling_with_SYCL
cp -r source.cpp ~/Downloads/gromacs-2023.3/build
cd ~/Downloads/gromacs-2023.3/build
ls

STEP 6: EDIT THE FILE ‘source.cpp’, WHERE IS <catch2/catch.hpp> CHANGE TO “catch2/catch.hpp” AND SAVE

withou exit the build directory activate the environment of one api using the following comand:

$ source /opt/intel/oneapi/setvars.sh
icpx -fsycl -I ~/syclacademy/External/Catch2/single_include -o a.out source.cpp
ls

this should create a file called a.out in the build directory

STEP 7: INSTALL THE REQUIRES

cd ~/
sudo apt install gcc cmake libpomp-dev hwloc libhwloc-dev
cd ~/Downloads/gromacs-2023.3/build

STEP 8: INSTALL GROMACS ON ROOT

sudo su source /opt/intel/oneapi/setvars.sh
$ cmake … -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGMX_GPU=SYCL -DGMX_HWLOC=ON -DCMAKE_INSTALL_PREFIX=/opt/gromacs-23
make -j 8
make check
make install

STEP 9: TO PERFORM GROMAC SIMULATION

  1. open the work directory
  2. run as root
  3. open the intel environment with: $ source /opt/intel/oneapi/setvars.sh
  4. activate gromacs with: $ source /opt/gromacs-23/bin/GMXRC

Hi! Were you running cmake with sudo before? That is not only unnecessary, but, furthermore, sudo resets all the environment changes done by source /opt/intel/oneapi/setvars.sh, which could explain why compiler could not be found (and, even if you provide the full path, device detection etc can fail later).

As you discovered, one solution is to run sudo su, to open a new session and do environment setup and cmake from there. But a better way (since running CMake as root is not recommended from security standpoint) would be simply to run cmake without sudo. Only the last step, make install, needs superuser permissions.

If I run the installation without root the comand icpx and icx is not found.