diff --git a/cmake/presets/oneapi.cmake b/cmake/presets/oneapi.cmake new file mode 100644 index 0000000000..d45fc253c1 --- /dev/null +++ b/cmake/presets/oneapi.cmake @@ -0,0 +1,18 @@ +# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes) + +set(CMAKE_CXX_COMPILER "icpx" CACHE STRING "" FORCE) +set(CMAKE_C_COMPILER "icx" CACHE STRING "" FORCE) +set(CMAKE_Fortran_COMPILER "ifort" CACHE STRING "" FORCE) +set(MPI_CXX "icpx" CACHE STRING "" FORCE) +set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) +unset(HAVE_OMP_H_INCLUDE CACHE) + +set(OpenMP_C "icx" CACHE STRING "" FORCE) +set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE) +set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE) +set(OpenMP_CXX "icpx" CACHE STRING "" FORCE) +set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE) +set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE) +set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE) +set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE) + diff --git a/doc/src/Build_basics.rst b/doc/src/Build_basics.rst index 5e2235e29b..3d0fa6f874 100644 --- a/doc/src/Build_basics.rst +++ b/doc/src/Build_basics.rst @@ -234,6 +234,8 @@ LAMMPS. cmake ../cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran # Building with Intel Compilers: cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort + # Building with Intel oneAPI Compilers: + cmake ../cmake -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DCMAKE_Fortran_COMPILER=ifort # Building with LLVM/Clang Compilers: cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang # Building with PGI/Nvidia Compilers: @@ -243,8 +245,10 @@ LAMMPS. provided that can be loaded with `-C ../cmake/presets/clang.cmake`. Similarly, `-C ../cmake/presets/intel.cmake` should switch the compiler - toolchain to the Intel compilers and `-C ../cmake/presets/pgi.cmake` - should switch the compiler to the PGI compilers. + toolchain to the legacy Intel compilers, `-C ../cmake/presets/oneapi.cmake` + will switch to the LLVM based oneAPI Intel compilers, + and `-C ../cmake/presets/pgi.cmake` + will switch the compiler to the PGI compilers. In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add compiler flags to tune for optimal performance on given hosts. By diff --git a/doc/src/Howto_cmake.rst b/doc/src/Howto_cmake.rst index c23113b0a5..655c90bfd9 100644 --- a/doc/src/Howto_cmake.rst +++ b/doc/src/Howto_cmake.rst @@ -411,10 +411,10 @@ interface (``ccmake`` or ``cmake-gui``). .. note:: Using a preset to select a compiler package (``clang.cmake``, - ``gcc.cmake``, or ``intel.cmake``) are an exception to the option - of updating the configuration incrementally, as they will trigger - a reset of cached internal CMake settings and thus reset them to - their default values. + ``gcc.cmake``, ``intel.cmake``, ``oneapi.cmake``, or ``pgi.cmake``) + are an exception to the mechanism of updating the configuration incrementally, + as they will trigger a reset of cached internal CMake settings and thus + reset settings to their default values. Compilation and build targets -----------------------------