Issue with SYCL compiler not supporting OpenMP

GROMACS version: Latest
GROMACS modification: Yes/No

(Installation guide for exotic configurations - GROMACS 2024.1 documentation)
Regarding the SYCL oneApi build having OpenMP issue, there is following suggestion:

For oneAPI 2024.x: -DCMAKE_C_FLAGS="-isystem /opt/intel/oneapi/compiler/latest/opt/compiler/include" -DCMAKE_CXX_FLAGS="-isystem /opt/intel/oneapi/compiler/latest/opt/compiler/include"

However, I’m using open source dpc++ which does not have the suggested paths. Any ideas what I should use instead?

Thanks

Hi! If you’re building DPC++ itself, just build it with OpenMP:

python3 ../buildbot/configure.py --llvm-external-projects=openmp [whatever other options]

After building and installing it, GROMACS should detect OpenMP support without any extra flags (you might want to purge GROMACS’s CMake cache in the build directory).

Note: Open-source DPC++ and Unified Runtime are moving fast, so beware of bugs or API changes when using the tip of sycl branch (or any of the nightly snapshots for that matter).

Hey,

After trying that, I’m still having the same issue. (Tried to make a fresh build)

CMake Error at cmake/gmxManageOpenMP.cmake:50 (message):
The compiler you are using does not support OpenMP parallelism.  This might
hurt your performance a lot, in particular with GPUs.  Try using a more
recent version, or a different compiler.  If you don't want to use OpenMP,
disable it explicitly with -DGMX_OPENMP=OFF
Call Stack (most recent call first):
CMakeLists.txt:432 (include)

There seems to be something off with the dpc++ build as I cannot find libomp.so anywhere.

That’s weird.

I just made a clean build of the open-source Intel LLVM compiler (07bf3c11ebeafbbb408708dd79f578ec7c974423) using

python3 ../buildbot/configure.py --cuda --hip -t release --llvm-external-projects=openmp

After building, I have ./projects/openmp/runtime/src/omp.h and ./lib/libomp.so in the build directory. Installing puts them to {install_prefix}/lib/clang/19/include/omp.h and {install_prefix}/lib/x86_64-unknown-linux-gnu/libomp.so.

Hmm, I’m really bad at setting up LLVM, but here is what I got
(with ad59feb6210ae8dab5e73f61e05631261039498b):

$ python3 configure.py -o ../build_default --llvm-external-projects=openmp -t Release
$ python3 compile.py -o ../build_default -j 70

I have omp.h at /build_default/projects/openmp/runtime/src

No libomp.so at /build_default/lib

No omp.h at /build_default/install/lib/clang/19/include

No libomp.so (and not any directories) at /build_default/install/lib

By looking at ccmake, I have CLANG_DEFAULT_OPENMP_RUNTIME libomp, LLVM_ENABLE_PROJECTS clang;sycl;llvm-spirv;opencl;xpti;xptifw;libdevice;sycl-jit;openmp

Could openmp library be somehow statically linked? Anyway, gromacs still complains about the lacking support.

Could openmp library be somehow statically linked?

The OpenMP library could perhaps be statically linked to the application (GROMACS), but building Clang should still produce a library file (libomp.so or libomp.a) for that linking to happen. We’re not linking OpenMP to Clang; we build OpenMP library that should later be linked to GROMACS.

Hmm, I’m really bad at setting up LLVM, but here is what I got

IMO, that is a question better answered at intel/llvm · Discussions · GitHub. The problem is that LLVM does not build OpenMP, that’s not related to GROMACS.

That said, compared to your example, I usually directly call

cmake --build . && cmake --build . --target sycl-toolchain sycl-sanitize sycl-trace install deploy-sycl-toolchain

in the build directory instead of using compile.py.

Yeah, I agree. Thanks!