File tree Expand file tree Collapse file tree 16 files changed +122
-17
lines changed Expand file tree Collapse file tree 16 files changed +122
-17
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ endif()
4949option (ENABLE_CUBLAS_BACKEND "" OFF )
5050option (ENABLE_CURAND_BACKEND "" OFF )
5151option (ENABLE_NETLIB_BACKEND "" OFF )
52+ set (ONEMKL_SYCL_IMPLEMENTATION "dpc++" CACHE STRING "Specifiy the SYCL implementation against which oneMKL should be built" )
5253
5354## Domains
5455set (DOMAINS_LIST "" )
@@ -119,7 +120,19 @@ add_subdirectory(cmake)
119120list (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR} /cmake" )
120121
121122# Find necessary packages
122- find_package (Compiler REQUIRED)
123+ if (ONEMKL_SYCL_IMPLEMENTATION STREQUAL "hipSYCL" )
124+ message (STATUS "Looking for hipSYCL" )
125+ find_package (hipSYCL CONFIG PATHS /opt/hipSYCL/lib/cmake/ REQUIRED)
126+ set (CMAKE_CXX_STANDARD 17)
127+ set (USE_ADD_SYCL_TO_TARGET_INTEGRATION true )
128+ add_library (ONEMKL::SYCL::SYCL INTERFACE IMPORTED )
129+ elseif (ONEMKL_SYCL_IMPLEMENTATION STREQUAL "dpc++" )
130+ message (STATUS "Looking for dpc++" )
131+ set (USE_ADD_SYCL_TO_TARGET_INTEGRATION false )
132+ find_package (Compiler REQUIRED)
133+ else ()
134+ message (FATAL_ERROR "SYCL implementation ${ONEMKL_SYCL_IMPLEMENTATION} is not known" )
135+ endif ()
123136
124137# Add source directory and output to bin/
125138add_subdirectory (src bin)
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ if(BUILD_SHARED_LIBS)
4848 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} >
4949 $<INSTALL_INTERFACE:include >
5050 )
51+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
52+ add_sycl_to_target(TARGET onemkl)
53+ endif ()
5154 set_target_properties (onemkl PROPERTIES
5255 SOVERSION ${PROJECT_VERSION_MAJOR}
5356 )
Original file line number Diff line number Diff line change @@ -31,12 +31,16 @@ target_include_directories(onemkl_blas
3131 ${CMAKE_BINARY_DIR} /bin
3232 $<TARGET_FILE_DIR:onemkl>
3333)
34-
3534target_compile_options (onemkl_blas PRIVATE ${ONEMKL_BUILD_COPT} )
3635
3736set_target_properties (onemkl_blas PROPERTIES
3837 POSITION_INDEPENDENT_CODE ON
3938)
40- target_link_libraries (onemkl_blas PUBLIC ONEMKL::SYCL::SYCL)
39+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
40+ add_sycl_to_target(TARGET onemkl_blas)
41+ else ()
42+ target_link_libraries (onemkl_blas PUBLIC ONEMKL::SYCL::SYCL)
43+ endif ()
44+
4145endif ()
4246
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ set_target_properties(${LIB_OBJ} PROPERTIES
4242 POSITION_INDEPENDENT_CODE ON )
4343
4444target_link_libraries (${LIB_NAME} PUBLIC ${LIB_OBJ} )
45-
45+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
46+ add_sycl_to_target(TARGET ${LIB_NAME} )
47+ add_sycl_to_target(TARGET ${LIB_OBJ} )
48+ endif ()
4649# Add major version to the library
4750set_target_properties (${LIB_NAME} PROPERTIES
4851 SOVERSION ${PROJECT_VERSION_MAJOR}
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ add_library(${LIB_OBJ} OBJECT
2828 mklcpu_level1.cpp mklcpu_level2.cpp mklcpu_level3.cpp mklcpu_batch.cpp mklcpu_extensions.cpp
2929 $<$<BOOL :${BUILD_SHARED_LIBS} >: mklcpu_wrappers.cpp>
3030)
31+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
32+ add_sycl_to_target(TARGET ${LIB_NAME} )
33+ add_sycl_to_target(TARGET ${LIB_OBJ} )
34+ endif ()
3135
3236target_include_directories (${LIB_OBJ}
3337 PRIVATE ${PROJECT_SOURCE_DIR} /include
Original file line number Diff line number Diff line change @@ -37,5 +37,10 @@ target_compile_options(onemkl_rng PRIVATE ${ONEMKL_BUILD_COPT})
3737set_target_properties (onemkl_rng PROPERTIES
3838 POSITION_INDEPENDENT_CODE ON
3939)
40- target_link_libraries (onemkl_rng PUBLIC ONEMKL::SYCL::SYCL)
40+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
41+ add_sycl_to_target(TARGET onemkl_rng)
42+ else ()
43+ target_link_libraries (onemkl_rng PUBLIC ONEMKL::SYCL::SYCL)
44+ endif ()
45+
4146endif ()
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ set_target_properties(${LIB_OBJ} PROPERTIES
4242)
4343
4444target_link_libraries (${LIB_NAME} PUBLIC ${LIB_OBJ} )
45-
45+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
46+ add_sycl_to_target(TARGET ${LIB_OBJ} )
47+ add_sycl_to_target(TARGET ${LIB_NAME} )
48+ endif ()
4649# Add major version to the library
4750set_target_properties (${LIB_NAME} PROPERTIES
4851 SOVERSION ${PROJECT_VERSION_MAJOR}
Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ target_include_directories(${LIB_OBJ}
3838)
3939
4040target_compile_options (${LIB_OBJ} PRIVATE ${ONEMKL_BUILD_COPT} ${MKL_COPT} )
41-
41+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
42+ add_sycl_to_target(TARGET ${LIB_OBJ} )
43+ add_sycl_to_target(TARGET ${LIB_NAME} )
44+ endif ()
4245target_link_libraries (${LIB_OBJ} PUBLIC ONEMKL::SYCL::SYCL ${MKL_LINK_C} )
4346
4447set_target_properties (${LIB_OBJ} PROPERTIES
Original file line number Diff line number Diff line change @@ -109,7 +109,9 @@ foreach(domain ${TARGET_DOMAINS})
109109 ONEMKL::SYCL::SYCL
110110 ${${domain} _TEST_LIST_CT}
111111 )
112-
112+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
113+ add_sycl_to_target(TARGET test_main_${domain} _ct)
114+ endif ()
113115 string (TOUPPER ${domain} DOMAIN_PREFIX)
114116
115117 if (BUILD_SHARED_LIBS )
@@ -130,5 +132,8 @@ foreach(domain ${TARGET_DOMAINS})
130132 PROPERTIES TEST_PREFIX ${DOMAIN_PREFIX} /CT/
131133 DISCOVERY_TIMEOUT 30
132134 )
135+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
136+ add_sycl_to_target(TARGET test_main_${domain} _rt)
137+ endif ()
133138
134139endforeach ()
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ if(BUILD_SHARED_LIBS)
3232 PUBLIC ${CBLAS_INCLUDE}
3333 )
3434 target_link_libraries (blas_batch_rt PUBLIC ONEMKL::SYCL::SYCL)
35+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
36+ add_sycl_to_target(TARGET blas_batch_rt)
37+ else ()
38+ target_link_libraries (blas_batch_rt PUBLIC ONEMKL::SYCL::SYCL)
39+ endif ()
3540endif ()
3641
3742add_library (blas_batch_ct OBJECT ${BATCH_SOURCES} )
@@ -45,3 +50,8 @@ target_include_directories(blas_batch_ct
4550 PUBLIC ${CBLAS_INCLUDE}
4651)
4752target_link_libraries (blas_batch_ct PUBLIC ONEMKL::SYCL::SYCL)
53+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
54+ add_sycl_to_target(TARGET blas_batch_ct)
55+ else ()
56+ target_link_libraries (blas_batch_ct PUBLIC ONEMKL::SYCL::SYCL)
57+ endif ()
You can’t perform that action at this time.
0 commit comments