Skip to content

Refactor MKL and oneDPL find package and add MKL_VERSION_2024 variable #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,43 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DPCTL_MODULE_PATH})


find_package(IntelDPCPP REQUIRED)
find_package(TBB REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
find_package(TBB QUIET)
if(TBB_FOUND)
find_package(TBB REQUIRED)
else()
find_package(TBB REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()

set(MKL_ARCH "intel64")
set(MKL_LINK "dynamic")
set(MKL_INTERFACE_FULL "intel_ilp64")
set(MKL_THREADING "tbb_thread")
find_package(MKL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
set(MKL_VERSION_2024 FALSE)
find_package(MKL QUIET)
if(MKL_FOUND)
if(MKL_VERSION VERSION_GREATER_EQUAL "2024.0.0")
set(MKL_VERSION_2024 TRUE)
set(MKL_INTERFACE "ilp64")
find_package(MKL REQUIRED)
endif()
endif()

if(NOT MKL_VERSION_2024)
set(MKL_INTERFACE_FULL "intel_ilp64")
find_package(MKL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()

set(ONEDPL_PAR_BACKEND tbb)
find_package(oneDPL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
find_package(oneDPL QUIET)
if(oneDPL_FOUND)
if(oneDPL_VERSION VERSION_GREATER_EQUAL "2022.3.0")
find_package(oneDPL REQUIRED)
else()
find_package(oneDPL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()
else()
find_package(oneDPL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()


include(GNUInstallDirs)

Expand Down
7 changes: 6 additions & 1 deletion dpnp/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ if(DPNP_GENERATE_COVERAGE)
target_link_options(${_trgt} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
endif()

target_link_libraries(${_trgt} PUBLIC MKL::MKL_DPCPP)
if (MKL_VERSION_2024)
target_link_libraries(${_trgt} PUBLIC MKL::MKL_SYCL)
else()
target_link_libraries(${_trgt} PUBLIC MKL::MKL_DPCPP)
endif()

target_link_libraries(${_trgt} PUBLIC oneDPL)

if (UNIX)
Expand Down
6 changes: 5 additions & 1 deletion dpnp/backend/extensions/lapack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ if (DPNP_GENERATE_COVERAGE)
target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
endif()

target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
if (MKL_VERSION_2024)
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::LAPACK)
else()
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
endif()

install(TARGETS ${python_module_name}
DESTINATION "dpnp/backend/extensions/lapack"
Expand Down
6 changes: 5 additions & 1 deletion dpnp/backend/extensions/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ if (DPNP_GENERATE_COVERAGE)
target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
endif()

target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
if (MKL_VERSION_2024)
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::VM)
else()
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
endif()

install(TARGETS ${python_module_name}
DESTINATION "dpnp/backend/extensions/vm"
Expand Down