Skip to content
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
22 changes: 21 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ endif()
option(ENABLE_CUBLAS_BACKEND "" OFF)
option(ENABLE_CURAND_BACKEND "" OFF)
option(ENABLE_NETLIB_BACKEND "" OFF)
set(ONEMKL_SYCL_IMPLEMENTATION "dpc++" CACHE STRING "Name of the SYCL compiler")

## Domains
set(DOMAINS_LIST "")
Expand Down Expand Up @@ -131,7 +132,26 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if(WIN32)
add_library(ONEMKL::SYCL::SYCL INTERFACE IMPORTED)
else()
find_package(Compiler REQUIRED)
# Find necessary packages
if(ONEMKL_SYCL_IMPLEMENTATION)
string( TOLOWER "${ONEMKL_SYCL_IMPLEMENTATION}" ONEMKL_SYCL_IMPLEMENTATION)
if (ONEMKL_SYCL_IMPLEMENTATION STREQUAL "hipsycl")
message(STATUS "Looking for hipSYCL")
find_package(hipSYCL CONFIG REQUIRED)
set(USE_ADD_SYCL_TO_TARGET_INTEGRATION true)
add_library(ONEMKL::SYCL::SYCL INTERFACE IMPORTED)
elseif(ONEMKL_SYCL_IMPLEMENTATION STREQUAL "dpc++")
message(STATUS "Looking for dpc++")
set(USE_ADD_SYCL_TO_TARGET_INTEGRATION false)
find_package(Compiler REQUIRED)
else()
message(FATAL_ERROR "SYCL implementation ${ONEMKL_SYCL_IMPLEMENTATION} is not known")
endif()
else()
message(STATUS "Looking for dpc++")
set(USE_ADD_SYCL_TO_TARGET_INTEGRATION false)
find_package(Compiler REQUIRED)
endif()
endif()

# Add source directory and output to bin/
Expand Down
6 changes: 5 additions & 1 deletion src/blas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ target_compile_options(onemkl_blas PRIVATE ${ONEMKL_BUILD_COPT})
set_target_properties(onemkl_blas PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
target_link_libraries(onemkl_blas PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET onemkl_blas SOURCES blas_loader.cpp)
else()
target_link_libraries(onemkl_blas PUBLIC ONEMKL::SYCL::SYCL)
endif()

endif()
23 changes: 12 additions & 11 deletions src/blas/backends/cublas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@
set(LIB_NAME onemkl_blas_cublas)
set(LIB_OBJ ${LIB_NAME}_obj)
find_package(cuBLAS REQUIRED)

set(SOURCES cublas_level1.cpp
cublas_level2.cpp
cublas_level3.cpp
cublas_batch.cpp
cublas_extensions.cpp
cublas_scope_handle.cpp
$<$<BOOL:${BUILD_SHARED_LIBS}>: cublas_wrappers.cpp>)
add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT
cublas_level1.cpp
cublas_level2.cpp
cublas_level3.cpp
cublas_batch.cpp
cublas_extensions.cpp
cublas_scope_handle.cpp
$<$<BOOL:${BUILD_SHARED_LIBS}>: cublas_wrappers.cpp>
)
add_library(${LIB_OBJ} OBJECT ${SOURCES})

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src/include
Expand All @@ -43,7 +42,9 @@ set_target_properties(${LIB_OBJ} PROPERTIES
POSITION_INDEPENDENT_CODE ON)

target_link_libraries(${LIB_NAME} PUBLIC ${LIB_OBJ})

if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET ${LIB_OBJ} SOURCES ${SOURCES})
endif()
# Add major version to the library
set_target_properties(${LIB_NAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
Expand Down
13 changes: 7 additions & 6 deletions src/blas/backends/mklcpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ set(LIB_NAME onemkl_blas_mklcpu)
set(LIB_OBJ ${LIB_NAME}_obj)

find_package(MKL REQUIRED)

add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT
mklcpu_common.hpp
set(SOURCES mklcpu_common.hpp
mklcpu_level1.cpp mklcpu_level2.cpp mklcpu_level3.cpp mklcpu_batch.cpp mklcpu_extensions.cpp
$<$<BOOL:${BUILD_SHARED_LIBS}>: mklcpu_wrappers.cpp>
)
$<$<BOOL:${BUILD_SHARED_LIBS}>: mklcpu_wrappers.cpp>)
add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT ${SOURCES})
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET ${LIB_OBJ} SOURCES ${SOURCES})
endif()

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
Expand Down
7 changes: 6 additions & 1 deletion src/rng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,10 @@ target_compile_options(onemkl_rng PRIVATE ${ONEMKL_BUILD_COPT})
set_target_properties(onemkl_rng PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
target_link_libraries(onemkl_rng PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET onemkl_rng SOURCES rng_loader.cpp)
else()
target_link_libraries(onemkl_rng PUBLIC ONEMKL::SYCL::SYCL)
endif()

endif()
14 changes: 8 additions & 6 deletions src/rng/backends/curand/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ set(LIB_NAME onemkl_rng_curand)
set(LIB_OBJ ${LIB_NAME}_obj)
find_package(cuRAND REQUIRED)

add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT
philox4x32x10.cpp
set(SOURCES philox4x32x10.cpp
mrg32k3a.cpp
$<$<BOOL:${BUILD_SHARED_LIBS}>: mkl_rng_curand_wrappers.cpp>
)
$<$<BOOL:${BUILD_SHARED_LIBS}>: mkl_rng_curand_wrappers.cpp>)

add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT ${SOURCES})

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
Expand All @@ -81,7 +81,9 @@ set_target_properties(${LIB_OBJ} PROPERTIES
)

target_link_libraries(${LIB_NAME} PUBLIC ${LIB_OBJ})

if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET ${LIB_OBJ} SOURCES ${SOURCES})
endif()
# Add major version to the library
set_target_properties(${LIB_NAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
Expand Down
10 changes: 6 additions & 4 deletions src/rng/backends/mklcpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ set(LIB_OBJ ${LIB_NAME}_obj)

find_package(MKL REQUIRED)

add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT
cpu_common.hpp
set(SOURCES cpu_common.hpp
philox4x32x10.cpp
mrg32k3a.cpp
$<$<BOOL:${BUILD_SHARED_LIBS}>: mkl_rng_cpu_wrappers.cpp>
)

add_library(${LIB_NAME})
add_library(${LIB_OBJ} OBJECT ${SOURCES})
target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
Expand All @@ -38,7 +38,9 @@ target_include_directories(${LIB_OBJ}
)

target_compile_options(${LIB_OBJ} PRIVATE ${ONEMKL_BUILD_COPT} ${MKL_COPT})

if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET ${LIB_OBJ} SOURCES ${SOURCES})
endif()
target_link_libraries(${LIB_OBJ} PUBLIC ONEMKL::SYCL::SYCL ${MKL_LINK_C})

set_target_properties(${LIB_OBJ} PROPERTIES
Expand Down
13 changes: 12 additions & 1 deletion tests/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ foreach(domain ${TARGET_DOMAINS})

add_executable(test_main_${domain}_ct main_test.cpp)
target_include_directories(test_main_${domain}_ct PUBLIC ${GTEST_INCLUDE_DIR})
target_compile_options(test_main_${domain}_ct PRIVATE -fsycl)

if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET test_main_${domain}_ct SOURCES main_test.cpp)
else()
target_compile_options(test_main_${domain}_ct PRIVATE -fsycl)
endif()

if(BUILD_SHARED_LIBS)
add_executable(test_main_${domain}_rt main_test.cpp)
Expand All @@ -83,6 +88,9 @@ foreach(domain ${TARGET_DOMAINS})
onemkl
${${domain}_TEST_LIST_RT}
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET test_main_${domain}_rt SOURCES main_test.cpp)
endif()
endif()

if(ENABLE_MKLCPU_BACKEND)
Expand Down Expand Up @@ -140,5 +148,8 @@ foreach(domain ${TARGET_DOMAINS})
PROPERTIES TEST_PREFIX ${DOMAIN_PREFIX}/CT/
DISCOVERY_TIMEOUT 30
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET test_main_${domain}_rt)
endif()

endforeach()
12 changes: 10 additions & 2 deletions tests/unit_tests/blas/batch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ if(BUILD_SHARED_LIBS)
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_batch_rt PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_batch_rt SOURCES ${BATCH_SOURCES})
else()
target_link_libraries(blas_batch_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_batch_ct OBJECT ${BATCH_SOURCES})
Expand All @@ -44,4 +48,8 @@ target_include_directories(blas_batch_ct
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_batch_ct PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_batch_ct SOURCES ${BATCH_SOURCES})
else()
target_link_libraries(blas_batch_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
12 changes: 10 additions & 2 deletions tests/unit_tests/blas/extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ if(BUILD_SHARED_LIBS)
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_extensions_rt PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_extensions_rt SOURCES ${EXTENSIONS_SOURCES})
else()
target_link_libraries(blas_extensions_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_extensions_ct OBJECT ${EXTENSIONS_SOURCES})
Expand All @@ -44,4 +48,8 @@ target_include_directories(blas_extensions_ct
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_extensions_ct PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_extensions_ct SOURCES ${EXTENSIONS_SOURCES})
else()
target_link_libraries(blas_extensions_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
12 changes: 10 additions & 2 deletions tests/unit_tests/blas/level1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ if(BUILD_SHARED_LIBS)
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_level1_rt PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level1_rt SOURCES ${L1_SOURCES})
else()
target_link_libraries(blas_level1_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_level1_ct OBJECT ${L1_SOURCES})
Expand All @@ -44,4 +48,8 @@ target_include_directories(blas_level1_ct
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_level1_ct PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level1_ct SOURCES ${L1_SOURCES})
else()
target_link_libraries(blas_level1_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
12 changes: 10 additions & 2 deletions tests/unit_tests/blas/level2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ if(BUILD_SHARED_LIBS)
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_level2_rt PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level2_rt SOURCES ${L2_SOURCES})
else()
target_link_libraries(blas_level2_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_level2_ct OBJECT ${L2_SOURCES})
Expand All @@ -44,5 +48,9 @@ target_include_directories(blas_level2_ct
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_level2_ct PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level2_ct SOURCES ${L2_SOURCES})
else()
target_link_libraries(blas_level2_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()

12 changes: 10 additions & 2 deletions tests/unit_tests/blas/level3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ if(BUILD_SHARED_LIBS)
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_level3_rt PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level3_rt SOURCES ${L3_SOURCES})
else()
target_link_libraries(blas_level3_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_level3_ct OBJECT ${L3_SOURCES})
Expand All @@ -44,6 +48,10 @@ target_include_directories(blas_level3_ct
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
)
target_link_libraries(blas_level3_ct PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level3_ct SOURCES ${L3_SOURCES})
else()
target_link_libraries(blas_level3_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()


12 changes: 10 additions & 2 deletions tests/unit_tests/rng/service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ if(BUILD_SHARED_LIBS)
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(rng_service_rt PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET rng_service_rt SOURCES ${SERVICE_TESTS_SOURCES})
else()
target_link_libraries(rng_service_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(rng_service_ct OBJECT ${SERVICE_TESTS_SOURCES})
Expand All @@ -42,4 +46,8 @@ target_include_directories(rng_service_ct
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(rng_service_ct PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET rng_service_ct SOURCES ${SERVICE_TESTS_SOURCES})
else()
target_link_libraries(rng_service_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
12 changes: 10 additions & 2 deletions tests/unit_tests/rng/statistics_check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ if(BUILD_SHARED_LIBS)
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(rng_statistics_rt PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET rng_statistics_rt SOURCES ${STATS_CHECK_SOURCES})
else()
target_link_libraries(rng_statistics_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(rng_statistics_ct OBJECT ${STATS_CHECK_SOURCES})
Expand All @@ -42,4 +46,8 @@ target_include_directories(rng_statistics_ct
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(rng_statistics_ct PUBLIC ONEMKL::SYCL::SYCL)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET rng_statistics_ct SOURCES ${STATS_CHECK_SOURCES})
else()
target_link_libraries(rng_statistics_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()