Skip to content

Commit 620fe8d

Browse files
authored
[cmake] Allow to use clang++ -fsycl (#639)
1 parent b8b5244 commit 620fe8d

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

cmake/FindCompiler.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ check_cxx_compiler_flag("-fsycl" is_dpcpp)
2525
if(is_dpcpp)
2626
# Workaround for internal compiler error during linking if -fsycl is used
2727
get_filename_component(SYCL_BINARY_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
28-
find_library(SYCL_LIBRARY NAMES sycl PATHS "${SYCL_BINARY_DIR}/../lib" "${SYCL_BINARY_DIR}/lib" ENV LIBRARY_PATH ENV PATH)
28+
find_library(SYCL_LIBRARY NAMES sycl
29+
PATHS
30+
"${SYCL_BINARY_DIR}/lib"
31+
"${SYCL_BINARY_DIR}/../lib"
32+
"${SYCL_BINARY_DIR}/../../lib"
33+
ENV LIBRARY_PATH
34+
ENV PATH
35+
)
2936
if(NOT SYCL_LIBRARY)
3037
message(FATAL_ERROR "SYCL library is not found in ${SYCL_BINARY_DIR}/../lib, PATH, and LIBRARY_PATH")
3138
endif()

cmake/FindcuBLAS.cmake

+7-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ find_package(CUDA 10.0 REQUIRED)
2121
get_filename_component(SYCL_BINARY_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
2222
# the OpenCL include file from cuda is opencl 1.1 and it is not compatible with DPC++
2323
# the OpenCL include headers 1.2 onward is required. This is used to bypass NVIDIA OpenCL headers
24-
find_path(OPENCL_INCLUDE_DIR CL/cl.h OpenCL/cl.h
25-
HINTS
26-
${OPENCL_INCLUDE_DIR}
27-
${SYCL_BINARY_DIR}/../include/sycl/
28-
${SYCL_BINARY_DIR}/../../include/sycl/
29-
${SYCL_BINARY_DIR}/../include/
24+
find_path(OPENCL_INCLUDE_DIR
25+
NAMES CL/cl.h OpenCL/cl.h
26+
HINTS
27+
${OPENCL_INCLUDE_DIR}
28+
${SYCL_BINARY_DIR}/../include/
29+
${SYCL_BINARY_DIR}/../../include/
30+
PATH_SUFFIXES sycl
3031
)
3132
# this is work around to avoid duplication half creation in both cuda and SYCL
3233
add_compile_definitions(CUDA_NO_HALF)

cmake/FindcuRAND.cmake

+7-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ get_filename_component(SYCL_BINARY_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
6262
if (NOT (ONEMATH_SYCL_IMPLEMENTATION STREQUAL "hipsycl"))
6363
# the OpenCL include file from cuda is opencl 1.1 and it is not compatible with DPC++
6464
# the OpenCL include headers 1.2 onward is required. This is used to bypass NVIDIA OpenCL headers
65-
find_path(OPENCL_INCLUDE_DIR CL/cl.h OpenCL/cl.h
66-
HINTS
67-
${OPENCL_INCLUDE_DIR}
68-
${SYCL_BINARY_DIR}/../include/sycl/
69-
${SYCL_BINARY_DIR}/../include/
65+
find_path(OPENCL_INCLUDE_DIR
66+
NAMES CL/cl.h OpenCL/cl.h
67+
HINTS
68+
${OPENCL_INCLUDE_DIR}
69+
${SYCL_BINARY_DIR}/../include/
70+
${SYCL_BINARY_DIR}/../../include/
71+
PATH_SUFFIXES sycl
7072
)
7173
endif()
7274

cmake/FindcuSOLVER.cmake

+7-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ find_package(CUDA 10.0 REQUIRED)
2121
get_filename_component(SYCL_BINARY_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
2222
# the OpenCL include file from cuda is opencl 1.1 and it is not compatible with DPC++
2323
# the OpenCL include headers 1.2 onward is required. This is used to bypass NVIDIA OpenCL headers
24-
find_path(OPENCL_INCLUDE_DIR CL/cl.h OpenCL/cl.h
25-
HINTS
26-
${OPENCL_INCLUDE_DIR}
27-
${SYCL_BINARY_DIR}/../include/sycl/
28-
${SYCL_BINARY_DIR}/../include/
24+
find_path(OPENCL_INCLUDE_DIR
25+
NAMES CL/cl.h OpenCL/cl.h
26+
HINTS
27+
${OPENCL_INCLUDE_DIR}
28+
${SYCL_BINARY_DIR}/../include/
29+
${SYCL_BINARY_DIR}/../../include/
30+
PATH_SUFFIXES sycl
2931
)
3032
# this is work around to avoid duplication half creation in both cuda and SYCL
3133
add_compile_definitions(CUDA_NO_HALF)

0 commit comments

Comments
 (0)