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()
49
49
option (ENABLE_CUBLAS_BACKEND "" OFF )
50
50
option (ENABLE_CURAND_BACKEND "" OFF )
51
51
option (ENABLE_NETLIB_BACKEND "" OFF )
52
+ set (ONEMKL_SYCL_IMPLEMENTATION "dpc++" CACHE STRING "Specifiy the SYCL implementation against which oneMKL should be built" )
52
53
53
54
## Domains
54
55
set (DOMAINS_LIST "" )
@@ -119,7 +120,19 @@ add_subdirectory(cmake)
119
120
list (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR} /cmake" )
120
121
121
122
# 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 ()
123
136
124
137
# Add source directory and output to bin/
125
138
add_subdirectory (src bin )
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ if(BUILD_SHARED_LIBS)
48
48
$< BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} >
49
49
$< INSTALL_INTERFACE:include>
50
50
)
51
+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION )
52
+ add_sycl_to_target (TARGET onemkl )
53
+ endif ()
51
54
set_target_properties (onemkl PROPERTIES
52
55
SOVERSION ${PROJECT_VERSION_MAJOR}
53
56
)
Original file line number Diff line number Diff line change @@ -31,12 +31,16 @@ target_include_directories(onemkl_blas
31
31
${CMAKE_BINARY_DIR} /bin
32
32
$< TARGET_FILE_DIR:onemkl>
33
33
)
34
-
35
34
target_compile_options (onemkl_blas PRIVATE ${ONEMKL_BUILD_COPT} )
36
35
37
36
set_target_properties (onemkl_blas PROPERTIES
38
37
POSITION_INDEPENDENT_CODE ON
39
38
)
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
+
41
45
endif ()
42
46
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ set_target_properties(${LIB_OBJ} PROPERTIES
42
42
POSITION_INDEPENDENT_CODE ON )
43
43
44
44
target_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 ()
46
49
# Add major version to the library
47
50
set_target_properties (${LIB_NAME} PROPERTIES
48
51
SOVERSION ${PROJECT_VERSION_MAJOR}
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ add_library(${LIB_OBJ} OBJECT
28
28
mklcpu_level1.cpp mklcpu_level2.cpp mklcpu_level3.cpp mklcpu_batch.cpp mklcpu_extensions.cpp
29
29
$< $< BOOL:${BUILD_SHARED_LIBS} > : mklcpu_wrappers.cpp>
30
30
)
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 ()
31
35
32
36
target_include_directories (${LIB_OBJ}
33
37
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})
37
37
set_target_properties (onemkl_rng PROPERTIES
38
38
POSITION_INDEPENDENT_CODE ON
39
39
)
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
+
41
46
endif ()
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ set_target_properties(${LIB_OBJ} PROPERTIES
42
42
)
43
43
44
44
target_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 ()
46
49
# Add major version to the library
47
50
set_target_properties (${LIB_NAME} PROPERTIES
48
51
SOVERSION ${PROJECT_VERSION_MAJOR}
Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ target_include_directories(${LIB_OBJ}
38
38
)
39
39
40
40
target_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 ()
42
45
target_link_libraries (${LIB_OBJ} PUBLIC ONEMKL::SYCL::SYCL ${MKL_LINK_C} )
43
46
44
47
set_target_properties (${LIB_OBJ} PROPERTIES
Original file line number Diff line number Diff line change @@ -109,7 +109,9 @@ foreach(domain ${TARGET_DOMAINS})
109
109
ONEMKL::SYCL::SYCL
110
110
${${domain}_TEST_LIST_CT}
111
111
)
112
-
112
+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION )
113
+ add_sycl_to_target (TARGET test_main_${domain}_ct )
114
+ endif ()
113
115
string (TOUPPER ${domain} DOMAIN_PREFIX )
114
116
115
117
if (BUILD_SHARED_LIBS )
@@ -130,5 +132,8 @@ foreach(domain ${TARGET_DOMAINS})
130
132
PROPERTIES TEST_PREFIX ${DOMAIN_PREFIX} /CT/
131
133
DISCOVERY_TIMEOUT 30
132
134
)
135
+ if (USE_ADD_SYCL_TO_TARGET_INTEGRATION )
136
+ add_sycl_to_target (TARGET test_main_${domain}_rt )
137
+ endif ()
133
138
134
139
endforeach ()
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ if(BUILD_SHARED_LIBS)
32
32
PUBLIC ${CBLAS_INCLUDE}
33
33
)
34
34
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 ()
35
40
endif ()
36
41
37
42
add_library (blas_batch_ct OBJECT ${BATCH_SOURCES} )
@@ -45,3 +50,8 @@ target_include_directories(blas_batch_ct
45
50
PUBLIC ${CBLAS_INCLUDE}
46
51
)
47
52
target_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