Skip to content

Commit 132f587

Browse files
Use IntelSYCL instead of IntelDPCPP compiler CMake script
1 parent c4a5b2c commit 132f587

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Publications/GPU-Opt-Guide/CMakeLists.txt

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
1212
include(CheckLanguage)
1313
enable_testing()
1414

15-
find_package(IntelDPCPP REQUIRED)
15+
find_package(IntelSYCL REQUIRED)
1616

1717
if (BUILD_FOTRAN_EXAMPLES)
1818
check_language(Fortran)
@@ -39,36 +39,44 @@ string(CONCAT WARNING_CXX_FLAGS_STR
3939
string(REPLACE " " ";" COMMON_CXX_FLAGS "${WARNING_CXX_FLAGS_STR}")
4040

4141
function(add_example_with_mkl name)
42-
add_executable(${name} ${name}.cpp)
42+
set(_sources ${name}.cpp)
43+
add_executable(${name} ${_sources})
44+
add_sycl_to_target(TARGET ${_name} SOURCES ${_sources})
4345
target_compile_options(${name} PRIVATE ${COMMON_CXX_FLAGS})
4446
target_compile_options(${name} PRIVATE -fiopenmp -fopenmp-targets=spir64 -qmkl)
45-
target_link_libraries(${name} PRIVATE MKL::MKL_DPCPP)
47+
target_link_libraries(${name} PRIVATE MKL::MKL_SYCL)
4648
target_link_options(${name} PRIVATE -fiopenmp -fopenmp-targets=spir64 -qmkl -lOpenCL)
4749
add_test(NAME ${name} COMMAND ${name} ${ARGN})
4850
endfunction(add_example_with_mkl)
4951

5052
function(add_fortran_example_with_mkl name)
5153
if(CMAKE_Fortran_COMPILER)
52-
add_executable(${name} ${name}.f)
54+
set(_sources ${name}.f)
55+
add_executable(${name} ${_sources})
56+
add_sycl_to_target(TARGET ${name} SOURCES ${_sources})
5357
target_compile_options(${name} PRIVATE -warn all)
5458
target_compile_options(${name} PRIVATE -fiopenmp -fopenmp-targets=spir64 -qmkl -fpp -free)
5559
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE Fortran)
56-
target_link_libraries(${name} PUBLIC MKL::MKL_DPCPP)
60+
target_link_libraries(${name} PUBLIC MKL::MKL_MKL)
5761
target_link_options(${name} PRIVATE -fiopenmp -fopenmp-targets=spir64 -qmkl -lOpenCL)
5862
add_test(NAME ${name} COMMAND ${name} ${ARGN})
5963
endif()
6064
endfunction(add_fortran_example_with_mkl)
6165

6266
function(add_example name)
63-
add_executable(${name} ${name}.cpp)
67+
set(_sources ${name}.cpp)
68+
add_executable(${name} ${_sources})
69+
add_sycl_to_target(TARGET ${name} SOURCES ${_sources})
6470
target_compile_options(${name} PRIVATE ${COMMON_CXX_FLAGS})
6571
target_link_options(${name} PRIVATE -fsycl-device-code-split=per_kernel)
6672
add_test(NAME ${name} COMMAND ${name} ${ARGN})
6773
endfunction(add_example)
6874

6975
function(add_fortran_example name)
7076
if(CMAKE_Fortran_COMPILER)
71-
add_executable(${name} ${name}.f90)
77+
set(_sources ${name}.f90)
78+
add_executable(${name} ${_sources})
79+
add_sycl_to_target(TARGET ${name} SOURCES ${_sources})
7280
target_compile_options(${name} PRIVATE -warn all)
7381
target_compile_options(${name} PRIVATE -fiopenmp -fopenmp-targets=spir64)
7482
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE Fortran)
@@ -79,7 +87,9 @@ endfunction(add_fortran_example)
7987

8088
function(add_mpi_example name)
8189
if(MPI_FOUND)
82-
add_executable(${name} ${name}.cpp)
90+
set(_sources ${name}.cpp)
91+
add_executable(${name} ${_sources})
92+
add_sycl_to_target(TARGET ${name} SOURCES ${_sources})
8393
target_compile_options(${name} PRIVATE -O3 -fiopenmp -fopenmp-targets=spir64)
8494
target_link_options(${name} PRIVATE -O3 -fiopenmp -fopenmp-targets=spir64)
8595
target_link_libraries(${name} PRIVATE MPI::MPI_CXX)

0 commit comments

Comments
 (0)