build: switch oneMKL threading layer to TBB
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
|||||||
# Pin the original backend ABI/link/thread choices rather than package defaults.
|
# Pin the original backend ABI/link/thread choices rather than package defaults.
|
||||||
set(MKL_INTERFACE ilp64)
|
set(MKL_INTERFACE ilp64)
|
||||||
set(MKL_LINK dynamic)
|
set(MKL_LINK dynamic)
|
||||||
set(MKL_THREADING intel_thread)
|
set(MKL_THREADING tbb_thread)
|
||||||
include(cmake/FesaDependencies.cmake)
|
include(cmake/FesaDependencies.cmake)
|
||||||
find_package(Doxygen QUIET)
|
find_package(Doxygen QUIET)
|
||||||
if(Doxygen_FOUND)
|
if(Doxygen_FOUND)
|
||||||
|
|||||||
@@ -44,6 +44,15 @@ if(NOT TARGET TBB::tbb)
|
|||||||
message(FATAL_ERROR "The oneTBB CONFIG package did not define TBB::tbb")
|
message(FATAL_ERROR "The oneTBB CONFIG package did not define TBB::tbb")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(FESA_MKL_THREAD_TARGET MKL::mkl_tbb_thread)
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(FESA_MKL_THREAD_TARGET MKL::mkl_tbb_threadd)
|
||||||
|
endif()
|
||||||
|
# HDF5 requires the Intel math runtime independently of MKL threading.
|
||||||
|
set(FESA_INTEL_MATH_RUNTIME "$ENV{FESA_OMP_ROOT}/bin/libmmd.dll")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Prefer the packaged shared C runtime when both variants exist. The Windows
|
# Prefer the packaged shared C runtime when both variants exist. The Windows
|
||||||
# static archive may carry compiler-runtime requirements that are not part of
|
# static archive may carry compiler-runtime requirements that are not part of
|
||||||
# the HDF5 imported target's transitive link interface.
|
# the HDF5 imported target's transitive link interface.
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
<IntDir>$(FesaBuildRoot)obj\$(MSBuildProjectName)\</IntDir>
|
<IntDir>$(FesaBuildRoot)obj\$(MSBuildProjectName)\</IntDir>
|
||||||
<TargetName Condition="'$(MSBuildProjectName)'=='fesa_cli'">fesa</TargetName>
|
<TargetName Condition="'$(MSBuildProjectName)'=='fesa_cli'">fesa</TargetName>
|
||||||
<TbbSuffix Condition="'$(Configuration)'=='Debug'">_debug</TbbSuffix>
|
<TbbSuffix Condition="'$(Configuration)'=='Debug'">_debug</TbbSuffix>
|
||||||
|
<FesaMklThreadName>mkl_tbb_thread</FesaMklThreadName>
|
||||||
|
<FesaMklThreadName Condition="'$(Configuration)'=='Debug'">mkl_tbb_threadd</FesaMklThreadName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<FesaExternalOptions Condition="'$(MSBuildProjectName)'=='fesa_solver'">/external:I"$(FESA_MKL_ROOT)\include" /external:I"$(FESA_TBB_ROOT)\include" /external:I"$(FESA_HDF5_ROOT)\include" /external:W0</FesaExternalOptions>
|
<FesaExternalOptions Condition="'$(MSBuildProjectName)'=='fesa_solver'">/external:I"$(FESA_MKL_ROOT)\include" /external:I"$(FESA_TBB_ROOT)\include" /external:I"$(FESA_HDF5_ROOT)\include" /external:W0</FesaExternalOptions>
|
||||||
@@ -56,8 +58,8 @@
|
|||||||
<OptimizeReferences Condition="'$(Configuration)'=='Release' And '$(MSBuildProjectName)'=='fesa_cli'">true</OptimizeReferences>
|
<OptimizeReferences Condition="'$(Configuration)'=='Release' And '$(MSBuildProjectName)'=='fesa_cli'">true</OptimizeReferences>
|
||||||
<EnableCOMDATFolding Condition="'$(Configuration)'=='Release' And '$(MSBuildProjectName)'=='fesa_cli'">true</EnableCOMDATFolding>
|
<EnableCOMDATFolding Condition="'$(Configuration)'=='Release' And '$(MSBuildProjectName)'=='fesa_cli'">true</EnableCOMDATFolding>
|
||||||
<GenerateDebugInformation Condition="'$(Configuration)'=='Debug'">true</GenerateDebugInformation>
|
<GenerateDebugInformation Condition="'$(Configuration)'=='Debug'">true</GenerateDebugInformation>
|
||||||
<AdditionalLibraryDirectories>$(FESA_MKL_ROOT)\lib;$(FESA_OMP_ROOT)\lib;$(FESA_TBB_ROOT)\lib;$(FESA_HDF5_ROOT)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(FESA_MKL_ROOT)\lib;$(FESA_TBB_ROOT)\lib;$(FESA_HDF5_ROOT)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>mkl_intel_ilp64_dll.lib;mkl_intel_thread_dll.lib;mkl_core_dll.lib;libiomp5md.lib;tbb12$(TbbSuffix).lib;hdf5.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>mkl_intel_ilp64_dll.lib;$(FesaMklThreadName)_dll.lib;mkl_core_dll.lib;tbb12$(TbbSuffix).lib;hdf5.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(MSBuildProjectName)'=='fesa_solver'">
|
<ItemDefinitionGroup Condition="'$(MSBuildProjectName)'=='fesa_solver'">
|
||||||
|
|||||||
@@ -4,18 +4,19 @@
|
|||||||
<Error Condition="'$(Platform)'!='x64'" Text="FESA requires MSVC x64." />
|
<Error Condition="'$(Platform)'!='x64'" Text="FESA requires MSVC x64." />
|
||||||
<Error Condition="!Exists('$(FESA_GTEST_SOURCE_DIR)\googletest\src\gtest-all.cc')" Text="Set FESA_GTEST_SOURCE_DIR to the approved local GoogleTest source checkout." />
|
<Error Condition="!Exists('$(FESA_GTEST_SOURCE_DIR)\googletest\src\gtest-all.cc')" Text="Set FESA_GTEST_SOURCE_DIR to the approved local GoogleTest source checkout." />
|
||||||
<Error Condition="!Exists('$(FESA_MKL_ROOT)\lib\mkl_intel_ilp64_dll.lib')" Text="Set FESA_MKL_ROOT to the oneMKL installation root." />
|
<Error Condition="!Exists('$(FESA_MKL_ROOT)\lib\mkl_intel_ilp64_dll.lib')" Text="Set FESA_MKL_ROOT to the oneMKL installation root." />
|
||||||
|
<Error Condition="!Exists('$(FESA_MKL_ROOT)\lib\$(FesaMklThreadName)_dll.lib')" Text="The selected oneMKL TBB-thread import library was not resolved." />
|
||||||
<Error Condition="!Exists('$(FESA_TBB_ROOT)\lib\tbb12$(TbbSuffix).lib')" Text="Set FESA_TBB_ROOT to the oneTBB installation root." />
|
<Error Condition="!Exists('$(FESA_TBB_ROOT)\lib\tbb12$(TbbSuffix).lib')" Text="Set FESA_TBB_ROOT to the oneTBB installation root." />
|
||||||
<Error Condition="!Exists('$(FESA_HDF5_ROOT)\lib\hdf5.lib')" Text="Set FESA_HDF5_ROOT to the shared HDF5 installation root." />
|
<Error Condition="!Exists('$(FESA_HDF5_ROOT)\lib\hdf5.lib')" Text="Set FESA_HDF5_ROOT to the shared HDF5 installation root." />
|
||||||
<Error Condition="!Exists('$(FESA_OMP_ROOT)\bin\libiomp5md.dll') Or !Exists('$(FESA_OMP_ROOT)\bin\libmmd.dll')" Text="Set FESA_OMP_ROOT to the Intel compiler runtime installation root." />
|
<Error Condition="!Exists('$(FESA_OMP_ROOT)\bin\libmmd.dll')" Text="Set FESA_OMP_ROOT to the Intel compiler runtime installation root required by HDF5." />
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="StageFesaRuntime" AfterTargets="Build" Condition="'$(ConfigurationType)'=='Application'">
|
<Target Name="StageFesaRuntime" AfterTargets="Build" Condition="'$(ConfigurationType)'=='Application'">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<FesaMklThread Include="$(FESA_MKL_ROOT)\bin\mkl_intel_thread.*.dll" />
|
<FesaMklThread Include="$(FESA_MKL_ROOT)\bin\$(FesaMklThreadName).*.dll" />
|
||||||
<FesaMklCore Include="$(FESA_MKL_ROOT)\bin\mkl_core.*.dll" />
|
<FesaMklCore Include="$(FESA_MKL_ROOT)\bin\mkl_core.*.dll" />
|
||||||
<FesaMklDispatch Include="$(FESA_MKL_ROOT)\bin\mkl_def.*.dll" />
|
<FesaMklDispatch Include="$(FESA_MKL_ROOT)\bin\mkl_def.*.dll" />
|
||||||
<FesaRuntime Include="@(FesaMklThread);@(FesaMklCore);@(FesaMklDispatch);$(FESA_TBB_ROOT)\bin\tbb12$(TbbSuffix).dll;$(FESA_OMP_ROOT)\bin\libiomp5md.dll;$(FESA_OMP_ROOT)\bin\libmmd.dll;$(FESA_HDF5_ROOT)\bin\hdf5.dll" />
|
<FesaRuntime Include="@(FesaMklThread);@(FesaMklCore);@(FesaMklDispatch);$(FESA_TBB_ROOT)\bin\tbb12$(TbbSuffix).dll;$(FESA_OMP_ROOT)\bin\libmmd.dll;$(FESA_HDF5_ROOT)\bin\hdf5.dll" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Error Condition="'@(FesaMklThread)'==''" Text="The oneMKL Intel-thread runtime DLL was not resolved." />
|
<Error Condition="'@(FesaMklThread)'==''" Text="The selected oneMKL TBB-thread runtime DLL was not resolved." />
|
||||||
<Error Condition="'@(FesaMklCore)'==''" Text="The oneMKL core runtime DLL was not resolved." />
|
<Error Condition="'@(FesaMklCore)'==''" Text="The oneMKL core runtime DLL was not resolved." />
|
||||||
<Error Condition="'@(FesaMklDispatch)'==''" Text="The oneMKL default-dispatch runtime DLL was not resolved." />
|
<Error Condition="'@(FesaMklDispatch)'==''" Text="The oneMKL default-dispatch runtime DLL was not resolved." />
|
||||||
<Copy SourceFiles="@(FesaRuntime)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true" />
|
<Copy SourceFiles="@(FesaRuntime)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true" />
|
||||||
|
|||||||
@@ -159,11 +159,10 @@ target_link_options(fesa_cli PRIVATE
|
|||||||
unset(_fesa_target)
|
unset(_fesa_target)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(NOT TARGET MKL::mkl_intel_thread OR NOT TARGET MKL::mkl_core OR
|
if(NOT TARGET ${FESA_MKL_THREAD_TARGET} OR NOT TARGET MKL::mkl_core)
|
||||||
NOT OMP_DLL_DIR OR NOT OMP_DLLNAME)
|
|
||||||
message(FATAL_ERROR "The oneMKL runtime files required by fesa.exe were not resolved")
|
message(FATAL_ERROR "The oneMKL runtime files required by fesa.exe were not resolved")
|
||||||
endif()
|
endif()
|
||||||
if(NOT EXISTS "${OMP_DLL_DIR}/libmmd.dll")
|
if(NOT EXISTS "${FESA_INTEL_MATH_RUNTIME}")
|
||||||
message(FATAL_ERROR "The Intel runtime required by the selected HDF5 DLL was not resolved")
|
message(FATAL_ERROR "The Intel runtime required by the selected HDF5 DLL was not resolved")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -182,16 +181,13 @@ if(WIN32)
|
|||||||
"$<TARGET_FILE:TBB::tbb>"
|
"$<TARGET_FILE:TBB::tbb>"
|
||||||
"$<TARGET_FILE_DIR:fesa_cli>"
|
"$<TARGET_FILE_DIR:fesa_cli>"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
"$<TARGET_FILE:MKL::mkl_intel_thread>"
|
"$<TARGET_FILE:${FESA_MKL_THREAD_TARGET}>"
|
||||||
"$<TARGET_FILE_DIR:fesa_cli>"
|
"$<TARGET_FILE_DIR:fesa_cli>"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
"$<TARGET_FILE:MKL::mkl_core>"
|
"$<TARGET_FILE:MKL::mkl_core>"
|
||||||
"$<TARGET_FILE_DIR:fesa_cli>"
|
"$<TARGET_FILE_DIR:fesa_cli>"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
"${OMP_DLL_DIR}/${OMP_DLLNAME}"
|
"${FESA_INTEL_MATH_RUNTIME}"
|
||||||
"$<TARGET_FILE_DIR:fesa_cli>"
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
|
||||||
"${OMP_DLL_DIR}/libmmd.dll"
|
|
||||||
"$<TARGET_FILE_DIR:fesa_cli>"
|
"$<TARGET_FILE_DIR:fesa_cli>"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
"${_fesa_cli_mkl_dispatch_dll}"
|
"${_fesa_cli_mkl_dispatch_dll}"
|
||||||
|
|||||||
@@ -180,11 +180,10 @@ target_compile_definitions(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(NOT TARGET MKL::mkl_intel_thread OR NOT TARGET MKL::mkl_core OR
|
if(NOT TARGET ${FESA_MKL_THREAD_TARGET} OR NOT TARGET MKL::mkl_core)
|
||||||
NOT OMP_DLL_DIR OR NOT OMP_DLLNAME)
|
|
||||||
message(FATAL_ERROR "The oneMKL runtime files required by tests were not resolved")
|
message(FATAL_ERROR "The oneMKL runtime files required by tests were not resolved")
|
||||||
endif()
|
endif()
|
||||||
if(NOT EXISTS "${OMP_DLL_DIR}/libmmd.dll")
|
if(NOT EXISTS "${FESA_INTEL_MATH_RUNTIME}")
|
||||||
message(FATAL_ERROR "The Intel runtime required by the selected HDF5 DLL was not resolved")
|
message(FATAL_ERROR "The Intel runtime required by the selected HDF5 DLL was not resolved")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -205,16 +204,13 @@ if(WIN32)
|
|||||||
"$<TARGET_FILE:TBB::tbb>"
|
"$<TARGET_FILE:TBB::tbb>"
|
||||||
"$<TARGET_FILE_DIR:${target_name}>"
|
"$<TARGET_FILE_DIR:${target_name}>"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
"$<TARGET_FILE:MKL::mkl_intel_thread>"
|
"$<TARGET_FILE:${FESA_MKL_THREAD_TARGET}>"
|
||||||
"$<TARGET_FILE_DIR:${target_name}>"
|
"$<TARGET_FILE_DIR:${target_name}>"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
"$<TARGET_FILE:MKL::mkl_core>"
|
"$<TARGET_FILE:MKL::mkl_core>"
|
||||||
"$<TARGET_FILE_DIR:${target_name}>"
|
"$<TARGET_FILE_DIR:${target_name}>"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
"${OMP_DLL_DIR}/${OMP_DLLNAME}"
|
"${FESA_INTEL_MATH_RUNTIME}"
|
||||||
"$<TARGET_FILE_DIR:${target_name}>"
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
|
||||||
"${OMP_DLL_DIR}/libmmd.dll"
|
|
||||||
"$<TARGET_FILE_DIR:${target_name}>"
|
"$<TARGET_FILE_DIR:${target_name}>"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
||||||
"${_fesa_mkl_dispatch_dll}"
|
"${_fesa_mkl_dispatch_dll}"
|
||||||
|
|||||||
Reference in New Issue
Block a user