Compiling GROMACS 2023 with Intel LLVM compilers

GROMACS version: 2023.1
GROMACS modification: No

I’m trying to compile GROMACS 2023 using Intel’s LLVM compilers and have run into a number of issues. The first is that they don’t seem to play nicely with nvcc because of a bug with the way nvcc sets C++ standard version (see this post). The post suggests that by setting the standard to c++17 in the nvcc flags, there shouldn’t be compatibility issues. I verified that I can compile the test code included with GROMACS with:

nvcc --compiler-bindir=mpiicpx --std=c++17 --allow-unsupported-compiler  /u/epoppleton/software/gromacs-2023.1/cmake/TestCUDA.cu

However I cannot figure out how to append multiple compiler flags to the nvcc command so I ended up just hardcoding them in gromacs/cmake/gmxManageNvccConfig.cmake.

Anyway, if I do that, the cmake step completes successfully, but make fails with:

icx: error: cannot specify -o when generating multiple output files
CMake Error at libgromacs_generated_gpuhaloexchange_impl_gpu.cu.o.Release.cmake:220 (message):
  Error generating
  /u/epoppleton/software/gromacs-2023.1/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/./libgromacs_generated_gpuhaloexchange_impl_gpu.cu.o

This is my first time trying to compile something this complicated, so I’m probably doing something stupid, but I am very stuck on this one.

Here is my cmake command:

cmake -DGMX_BUILD_OWN_FFTW=ON -DGMX_GPU=CUDA -DGMX_MPI=ON -DGMX_OPENMP=ON -DGMX_FFT_LIBRARY=mkl -DCMAKE_C_COMPILER=mpiicx -DCMAKE_CXX_COMPILER=mpiicpx -DCMAKE_CXX_STANDARD=17 ..

And relevant compilers/libraries:
mpiicx/mpiicpx : 2023.1.0
CUDA : 11.6
MKL : October 2022
GCC/G++ : 12.1.0
openMPI : 4.1
IMPI : 2021.9

Hi!

Is there any specific reason you’re trying to use icpx and not gcc/g++? As you have seen from the error message, CUDA is not officially supported with Intel compilers.

You can try running VERBOSE=1 make to get the exact compiler commands used, and try to figure out from there what goes wrong.

But you should have a much smoother experience if you use GCC, which is properly supported by NVCC. I see that you have GCC 12.1, which should work fine, but be aware that there are known issues with GCC 11.2 and CUDA 11.6.

Thanks. I ended up just compiling with GCC 12.1 and CUDA 12.1 and that worked.