Skip to content
Snippets Groups Projects
Commit 99ed7388 authored by Boman Romain's avatar Boman Romain
Browse files

solve mkl_intel_thread problem

parent 80339e04
No related branches found
No related tags found
No related merge requests found
Pipeline #7103 passed
......@@ -59,6 +59,14 @@ IF(FEM_USE_MKL)
MESSAGE(STATUS "MKL_INCLUDE_DIRS=${MKL_INCLUDE_DIRS}")
# library (mkl_rt.so) searched using LIBRARY_PATH (Linux/macOS) or LIB (windows)
FIND_LIBRARY(MKL_LIBRARIES mkl_rt PATHS ENV LIBRARY_PATH)
IF(MSVC)
# with MSVC+MKL, we must link to intel OpenMP so that we have only 1 OpenMP lib
FIND_LIBRARY(INTEL_OPENMP libiomp5md)
MESSAGE(STATUS "INTEL_OPENMP=${INTEL_OPENMP}")
IF(NOT INTEL_OPENMP)
MESSAGE(FATAL_ERROR "libiomp5md library not found!")
ENDIF()
ENDIF()
# IF(MINGW)
# FIND_LIBRARY(MKL_LIB1 mkl_intel_lp64_dll PATHS ENV LIBRARY_PATH)
# FIND_LIBRARY(MKL_LIB2 mkl_intel_thread_dll PATHS ENV LIBRARY_PATH)
......@@ -88,9 +96,9 @@ ENDIF()
# OpenMP --
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
MESSAGE ("OpenMP enabled (CXX_FLAGS=${OpenMP_CXX_FLAGS})")
MESSAGE (STATUS "OpenMP enabled (CXX_FLAGS=${OpenMP_CXX_FLAGS})")
ELSE()
MESSAGE ("OpenMP disabled.")
MESSAGE (STATUS "OpenMP disabled.")
ENDIF()
# Python --
......
FILE(GLOB SRCS *.cpp)
ADD_LIBRARY(fem SHARED ${SRCS})
TARGET_LINK_LIBRARIES(fem PUBLIC ${GMSH_LIBRARIES})
......@@ -9,4 +8,9 @@ ENDIF()
IF(FEM_USE_MKL)
TARGET_LINK_LIBRARIES(fem PUBLIC ${MKL_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(fem PUBLIC ${MKL_INCLUDE_DIRS})
# with MSVC+MKL, we must link to intel OpenMP so that we have only 1 OpenMP lib
IF(MSVC)
TARGET_LINK_OPTIONS(fem PUBLIC -NODEFAULTLIB:"vcomp" -NODEFAULTLIB:"vcompd")
TARGET_LINK_LIBRARIES(fem PUBLIC ${INTEL_OPENMP})
ENDIF()
ENDIF()
\ No newline at end of file
@echo off
:: This file opens a terminal which allows you to compile the code with
:: Microsoft Visual Studio 2017 (x64) on Windows
::
:: HOW TO USE THIS FILE?
:: [run this file]
:: mkdir build
:: cd build
:: cmake -A x64 ..
:: cmake --build . --config Release
:: [executables are built in the bin/Release folder]
:: ctest -C Release
:: Microsoft Visual Studio 2019 (x64) on Windows
:: set the location of gmsh SDK / mingw compiler
set "GMSHSDK=%~dp0..\lib\gmsh-sdk"
set "EIGEN=%~dp0..\lib\eigen"
set COMPILERPATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build"
:: perform some tests...
IF NOT EXIST "%GMSHSDK%" (
ECHO - gmsh-sdk NOT found in %GMSHSDK%!!
PAUSE
EXIT /B
) ELSE (
ECHO - gmsh-sdk found.
)
IF NOT EXIST "%EIGEN%" (
ECHO - eigen NOT found in %EIGEN%!!
PAUSE
EXIT /B
) ELSE (
ECHO - eigen found.
)
IF NOT EXIST %COMPILERPATH% (
ECHO - compiler NOT found in %COMPILERPATH%!!
PAUSE
EXIT /B
) ELSE (
ECHO - compiler found.
)
:: Intel MKL
set "INTELPATH=C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.5.281\windows"
set LIB=%INTELPATH%\mkl\lib\intel64_win;%INTELPATH%\compiler\lib\intel64_win;%LIB%
set INCLUDE=%INTELPATH%\mkl\include;%INCLUDE%
:: does not always work
@REM call %INTELPATH%\mkl\bin\mklvars.bat intel64 vs2019
:: where is gmsh.exe and gmsh-**.dll ?
set PATH=%GMSHSDK%\bin;%GMSHSDK%\lib;%PATH%
:: where is gmsh.h ?
set INCLUDE=%EIGEN%;%GMSHSDK%\include;%INCLUDE%
:: where is gmsh.lib ?
set LIB=%GMSHSDK%\lib;%LIB%
:: where is gmsh.py ? (required only if you want to use the python API)
set PYTHONPATH=%GMSHSDK%\lib;%PYTHONPATH%
@REM set LIB=%INTELPATH%\mkl\lib\intel64_win;%INTELPATH%\compiler\lib\intel64_win;%LIB%
@REM set INCLUDE=%INTELPATH%\mkl\include;%INCLUDE%
call "%INTELPATH%\mkl\bin\mklvars.bat" intel64 vs2019
:: set the environment of the msvc compiler
CD /d "%~dp0"
CD ..
:: problem with mkl_rt (mkl_intel_thread cannot be loaded)
:: %comspec% /k "%COMPILERPATH%\vcvars64.bat"
%comspec% /k
%comspec% /k "%COMPILERPATH%\vcvars64.bat"
......@@ -176,12 +176,12 @@ def setup_pythonpath():
'build', 'bin', 'Release')) # msvc
# allows this script to be run without setting env
rm_folder_from_path('gmsh')
rm_folder_from_pypath('gmsh')
add_folder2pypath(os.path.join(this_script_dir, 'lib',
'gmsh-sdk', 'lib')) # msvc
add_folder2path(os.path.join(this_script_dir, 'lib',
'gmsh-sdk', 'bin')) # gmsh
# rm_folder_from_path('gmsh')
# rm_folder_from_pypath('gmsh')
# add_folder2pypath(os.path.join(this_script_dir, 'lib',
# 'gmsh-sdk', 'lib')) # msvc
# add_folder2path(os.path.join(this_script_dir, 'lib',
# 'gmsh-sdk', 'bin')) # gmsh
# print(f'sys.path={sys.path}')
......@@ -217,10 +217,6 @@ if __name__ == "__main__":
# add main program folder and binaries dir to the PYTHONPATH
setup_pythonpath()
# preload some modules (vtk before gmsh)
import vtk
import gmsh
# redirect C++ streams to Python
import cxxfem
redirect = cxxfem.StdOutErr2Py()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment