[lammps-users] Compiling Lammps with Intel Package

Dear LAMMPS users

I am trying to compile lammps version 10Feb21 on my Linux machine with Intel package. However, I got the following error:
"

[100%] Built target ocl_get_devices
[100%] Linking CXX executable lmp_intel

ld: liblammps_intel.a(verlet_lrt_intel.cpp.o): undefined reference to symbol ‘pthread_create@@GLIBC_2.2.5
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
"

These are the commands I use to compile lammps:
"

#!/bin/bash
source /opt/intel/oneapi/setvars.sh
cd ~/Downloads/lammps-10Feb21
sudo rm -rf build8
mkdir build8
cd build8
sudo cmake -C …/cmake/presets/myIntel.cmake BUILD_MPI=on -D BUILD_OMP=on -D INTEL_ARCH=cpu -D INTEL_LRT_MODE=c++11 -D LAMMPS_MACHINE=intel …/cmake
sudo make -j 40
sudo make install

"

And this is my *.cmake file:
"

set(ALL_PACKAGES CLASS2 GPU MANYBODY MC MISC MOLECULE RIGID KSPACE
USER-MISC USER-REAXC USER-SMD USER-INTEL)

foreach(PKG {ALL_PACKAGES}) set(PKG_{PKG} ON CACHE BOOL “” FORCE)
endforeach()

preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes)

set(CMAKE_CXX_COMPILER “/opt/intel/oneapi/compiler/2021.1.2/linux/bin/intel64/icpc” CACHE STRING “” FORCE)
set(CMAKE_C_COMPILER “/opt/intel/oneapi/compiler/2021.1.2/linux/bin/intel64/icc” CACHE STRING “” FORCE)
set(CMAKE_Fortran_COMPILER “/opt/intel/oneapi/compiler/2021.1.2/linux/bin/intel64/ifort” CACHE STRING “” FORCE)
set(MPI_CXX “mpicxx” CACHE STRING “” FORCE)
set(MPI_CXX_COMPILER “mpicxx” CACHE STRING “” FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)

set(OpenMP_C “/opt/intel/oneapi/compiler/2021.1.2/linux/bin/intel64/icc” CACHE STRING “” FORCE)
set(OpenMP_C_FLAGS “-qopenmp” CACHE STRING “” FORCE)
set(OpenMP_C_LIB_NAMES “omp” CACHE STRING “” FORCE)
set(OpenMP_CXX “/opt/intel/oneapi/compiler/2021.1.2/linux/bin/intel64/icpc” 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)

"

My OS is ubuntu 18.04 LTS and my icc and icpc versions are “2021.1.2 20201208”.
Any help is highly appreciated.

Best
Mahdi

first of all: never ever compile anything using “sudo”. there is no need to it and the tiniest typo can result in serious damages to your linux installation. sudo should be used with great care.

this seems like an oversight in the CMake configuration for the USER-INTEL package. as a workaround you should either use INTEL_LRT_MODE=threads or not enable this feature at all (you are not very likely to use it anyway).

axel.

Sorry for replying to you directly instead of sending to the list.

So, I have resent the email to the mailing list:

"Dear Axel

Thanks very much for the quick reply.

Now, it gives me the following error message:

"
– Appending /opt/intel/oneapi/tbb/2021.1.1/env/…/lib/intel64/gcc4.8:/opt/intel/oneapi/dnnl/2021.1.1/cpu_dpcpp_gpu_dpcpp/lib:/opt/intel/oneapi/compiler/2021.1.2/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/2021.1.2/linux/lib:/opt/intel/oneapi/clck/2021.1.1/lib/intel64:/opt/intel/oneapi/ippcp/2021.1.1/lib/intel64:/opt/intel/oneapi/mkl/latest/lib/intel64:/opt/intel/oneapi/vpl/2021.1.1/lib:/opt/intel/oneapi/ipp/2021.1.1/lib/intel64:/opt/intel/oneapi/dal/2021.1.1/lib/intel64:/opt/intel/oneapi/ccl/2021.1.1/lib/cpu_gpu_dpcpp:/opt/intel/oneapi/mpi/2021.1.1//libfabric/lib:/opt/intel/oneapi/mpi/2021.1.1//lib/release:/opt/intel/oneapi/mpi/2021.1.1//lib to CMAKE_LIBRARY_PATH: /opt/intel/oneapi/tbb/2021.1.1/env/…/lib/intel64/gcc4.8:/opt/intel/oneapi/dnnl/2021.1.1/cpu_dpcpp_gpu_dpcpp/lib:/opt/intel/oneapi/compiler/2021.1.2/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/2021.1.2/linux/lib:/opt/intel/oneapi/clck/2021.1.1/lib/intel64:/opt/intel/oneapi/ippcp/2021.1.1/lib/intel64:/opt/intel/oneapi/mkl/latest/lib/intel64:/opt/intel/oneapi/vpl/2021.1.1/lib:/opt/intel/oneapi/ipp/2021.1.1/lib/intel64:/opt/intel/oneapi/dal/2021.1.1/lib/intel64:/opt/intel/oneapi/ccl/2021.1.1/lib/cpu_gpu_dpcpp:/opt/intel/oneapi/mpi/2021.1.1//libfabric/lib:/opt/intel/oneapi/mpi/2021.1.1//lib/release:/opt/intel/oneapi/mpi/2021.1.1//lib
– Running check for auto-generated files from make-based build system
CMake Error in /home/hadi/Downloads/lammps-10Feb21/build8/CMakeFiles/CMakeTmp/CMakeLists.txt:
Imported target “MPI::MPI_CXX” includes non-existent path

“/home/hadi/Downloads/lammps-10Feb21/cmake/’/opt/intel/oneapi/mpi/2021.1.1/include’”

in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

  • The path was deleted, renamed, or moved to another location.

  • An install or uninstall procedure did not complete successfully.

  • The installation package was faulty and references files it does not
    provide."

Mahdi"

first of all: never ever compile anything using “sudo”. there is no need to it and the tiniest typo can result in serious damages to your linux installation. sudo should be used with great care.

this seems like an oversight in the CMake configuration for the USER-INTEL package. as a workaround you should either use INTEL_LRT_MODE=threads or not enable this feature at all (you are not very likely to use it anyway).

axel.

This looks like you have a typo in either your command line or your custom cmake file(s) or your environment variables.
What to look for is quite obvious from the error message.
Axel.

Dear Axel

Thanksfor the reply.
As you mentioned I changed the “INTEL_LRT_MODE” to “threads” and also added the following line to the *.cmake file to correct the possible typo in the environmental variables:

set(MPI_CXX_ADDITIONAL_INCLUDE_DIRS “/opt/intel/oneapi/mpi/2021.1.1/include” CACHE STRING “” FORCE)

Thanks
Mahdi