Hi LAMMPS folks,
I’m trying to compile lammps latest stable release from 29 sept 2021 with Intel oneAPI toolkit integrated to Visual Studio. I saw there is a preset file oneapi.cmake in the camke folder, but since the preferred method of setting preset cacheVairables, according to the visual studio official documentation is using CmakePresets.json, I made the following configuration preset copying vars from oneapi.cmake:
{
"name": "x64-Debug-oneApi",
"displayName": "x64 Debug oneApi",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Debug)",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "set"
},
"toolset": {
"value": "Intel C++ Compiler 2022",
"strategy": "set"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_COMPILER": "icpx",
"CMAKE_C_COMPILER": "icx",
"CMAKE_Fortran_COMPILER": "ifx",
"CMAKE_CXX_FLAGS_DEBUG": "-Wall -Wextra -g",
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-Wall -Wextra -g -O2 -DNDEBUG",
"CMAKE_CXX_FLAGS_RELEASE": "-O3 -DNDEBUG",
"CMAKE_Fortran_FLAGS_DEBUG": "-Wall -Wextra -g",
"CMAKE_Fortran_FLAGS_RELWITHDEBINFO": "-Wall -Wextra -g -O2 -DNDEBUG",
"CMAKE_Fortran_FLAGS_RELEASE": "-O3 -DNDEBUG",
"CMAKE_C_FLAGS_DEBUG": "-Wall -Wextra -g",
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-Wall -Wextra -g -O2 -DNDEBUG",
"CMAKE_C_FLAGS_RELEASE": "-O3 -DNDEBUG",
"MPI_CXX": "icpx",
"MPI_CXX_COMPILER": "mpicxx",
"HAVE_OMP_H_INCLUDE": true,
"OpenMP_C": "icx",
"OpenMP_C_FLAGS": "-qopenmp",
"OpenMP_C_LIB_NAMES": "omp",
"OpenMP_CXX": "icpx",
"OpenMP_CXX_FLAGS": "-qopenmp",
"OpenMP_CXX_LIB_NAMES": "omp",
"OpenMP_Fortran_FLAGS": "-qopenmp",
"OpenMP_omp_LIBRARY": "libiomp5.so"
}
}
The configuration cache is generated and vscode *.vcxproj files are generated. But when I build the default target item “Debug/lmp.exe” I run into the following error:
clang-cl: : warning : unknown argument ignored in clang-cl: '-restrict' [-Wunknown-argument] [E:\Sainath\lammps-29Sep2021\cmake\out\build\x64-Debug-oneApi\mpi_stubs.vcxproj]
clang-cl: : warning : unknown argument ignored in clang-cl: '-g' [-Wunknown-argument] [E:\Sainath\lammps-29Sep2021\cmake\out\build\x64-Debug-oneApi\mpi_stubs.vcxproj]
clang-cl: : warning : argument unused during compilation: '-Qstd=c++11' [-Wunused-command-line-argument] [E:\Sainath\lammps-29Sep2021\cmake\out\build\x64-Debug-oneApi\mpi_stubs.vcxproj]
E:\Sainath\lammps-29Sep2021\src\STUBS\mpi.cpp(24,10): : error : 'sys/time.h' file not found [E:\Sainath\lammps-29Sep2021\cmake\out\build\x64-Debug-oneApi\mpi_stubs.vcxproj]
#include <sys/time.h>
^~~~~~~~~~~~
1 error generated.
I’m not sure if I’m missing something here like setting up any environment variables or include directories? MPI libraries are available in oneAPI toolkit and I already setup the oneAPI environment by running the following command on dev terminal:
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
I know the alternate way to do this is using a WSL or remote linux system. But I want to make this work on windows with oneApi. I kindly request you to help, I tried many things and am in a desperate situation. The cmake config log is attached for reference.
cmake.log (15.4 KB)