Skip to content

Commit 083de5d

Browse files
authored
[mklcpu][mklgpu] use dynamic link for oneMKL, add MKLCPU_THREAD_OMP (#718)
1 parent 8f302d1 commit 083de5d

6 files changed

Lines changed: 18 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ option(ENABLE_MKLCPU_BACKEND "Enable the Intel oneMKL CPU backend for supported
3939
option(ENABLE_MKLGPU_BACKEND "Enable the Intel oneMKL GPU backend for supported interfaces" ON)
4040
if(ENABLE_MKLCPU_BACKEND)
4141
option(ENABLE_MKLCPU_THREAD_TBB "Enable the use of Intel TBB with the oneMath CPU backend" ON)
42+
option(ENABLE_MKLCPU_THREAD_OMP "Enable the use of Intel OpenMP with the oneMath CPU backend" OFF)
4243
endif()
4344

4445
option(ENABLE_ARMPL_BACKEND "Enable the ArmPl backend for BLAS/LAPACK interface" OFF)
@@ -256,14 +257,12 @@ if(ENABLE_MKLGPU_BACKEND OR ENABLE_MKLCPU_BACKEND)
256257
set(MKL_INTERFACE ilp64)
257258
if(ENABLE_MKLCPU_THREAD_TBB)
258259
set(MKL_THREADING tbb_thread)
260+
elseif(ENABLE_MKLCPU_THREAD_OMP)
261+
set(MKL_THREADING intel_thread)
259262
else()
260263
set(MKL_THREADING sequential)
261264
endif()
262-
if(BUILD_SHARED_LIBS AND NOT WIN32)
263-
set(MKL_LINK dynamic)
264-
else()
265-
set(MKL_LINK static)
266-
endif()
265+
set(MKL_LINK dynamic)
267266
# Enable SYCL API
268267
set(DPCPP_COMPILER ON)
269268
set(SYCL_COMPILER ON)
@@ -320,6 +319,8 @@ endif()
320319
if(DEFINED REF_BLAS_ROOT OR DEFINED REF_LAPACK_ROOT)
321320
find_file(ONEMATH_REF_BLAS_LIBNAME NAMES blas.dll libblas.so HINTS ${REF_BLAS_ROOT} ${REF_LAPACK_ROOT} PATH_SUFFIXES lib lib64)
322321
find_file(ONEMATH_REF_CBLAS_LIBNAME NAMES cblas.dll libcblas.so HINTS ${REF_BLAS_ROOT} ${REF_LAPACK_ROOT} PATH_SUFFIXES lib lib64)
322+
find_file(ONEMATH_REF_LAPACKE_LIBNAME NAMES lapacke64.dll liblapacke64.so HINTS ${REF_LAPACK_ROOT} PATH_SUFFIXES lib lib64)
323+
find_file(ONEMATH_REF_LAPACK_LIBNAME NAMES lapack64.dll liblapack64.so HINTS ${REF_LAPACK_ROOT} PATH_SUFFIXES lib lib64)
323324
endif()
324325

325326
# Add source directory and output to bin/

docs/building_the_project_with_adaptivecpp.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ The most important supported build options are:
104104
- False
105105
* - ENABLE_MKLCPU_THREAD_TBB
106106
- True, False
107-
- True
107+
- True
108+
* - ENABLE_MKLCPU_THREAD_OMP
109+
- True, False
110+
- False
108111
* - BUILD_FUNCTIONAL_TESTS
109112
- True, False
110113
- True

docs/building_the_project_with_dpcpp.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ The most important supported build options are:
135135
- False
136136
* - ENABLE_MKLCPU_THREAD_TBB
137137
- True, False
138-
- True
138+
- True
139+
* - ENABLE_MKLCPU_THREAD_OMP
140+
- True, False
141+
- False
139142
* - ENABLE_GENERIC_BLAS_BACKEND
140143
- True, False
141144
- False

src/lapack/backends/mklcpu/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ target_include_directories(${LIB_OBJ}
3939
target_compile_options(${LIB_OBJ} PRIVATE ${ONEMATH_BUILD_COPT})
4040

4141
if(TARGET MKL::MKL_SYCL::LAPACK)
42-
target_link_libraries(${LIB_OBJ} PUBLIC ONEMATH::SYCL::SYCL MKL::MKL_SYCL::LAPACK)
42+
target_link_libraries(${LIB_OBJ} PUBLIC ONEMATH::SYCL::SYCL MKL::MKL_SYCL::LAPACK MKL::MKL_SYCL::BLAS)
4343
else()
4444
target_link_libraries(${LIB_OBJ} PUBLIC ONEMATH::SYCL::SYCL MKL::MKL_DPCPP)
4545
endif()

src/lapack/backends/mklgpu/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ target_include_directories(${LIB_OBJ}
3939
target_compile_options(${LIB_OBJ} PRIVATE ${ONEMATH_BUILD_COPT})
4040

4141
if(TARGET MKL::MKL_SYCL::LAPACK)
42-
target_link_libraries(${LIB_OBJ} PUBLIC ONEMATH::SYCL::SYCL MKL::MKL_SYCL::LAPACK)
42+
target_link_libraries(${LIB_OBJ} PUBLIC ONEMATH::SYCL::SYCL MKL::MKL_SYCL::LAPACK MKL::MKL_SYCL::BLAS)
4343
else()
4444
target_link_libraries(${LIB_OBJ} PUBLIC ONEMATH::SYCL::SYCL MKL::MKL_DPCPP)
4545
endif()

tests/unit_tests/lapack/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818
#===============================================================================
1919
add_compile_definitions(
20-
ONEMATH_REF_LAPACK_LIBNAME="${LAPACK64_file}"
21-
ONEMATH_REF_LAPACKE_LIBNAME="${LAPACKE64_file}"
20+
ONEMATH_REF_LAPACK_LIBNAME="${ONEMATH_REF_LAPACK_LIBNAME}"
21+
ONEMATH_REF_LAPACKE_LIBNAME="${ONEMATH_REF_LAPACKE_LIBNAME}"
2222
ONEMATH_REF_CBLAS_LIBNAME="${ONEMATH_REF_CBLAS_LIBNAME}")
2323
add_subdirectory(source)
2424
add_subdirectory(common)

0 commit comments

Comments
 (0)