Skip to content

Commit

Permalink
Merge Add icpx support and Deprecate GINKGO_BUILD_DPCPP by GINKGO_BUI…
Browse files Browse the repository at this point in the history
…LD_SYCL

This PR adds the icpx compiler support for DPCPP backend(SYCL) and deprecates `GINKGO_BUILD_DPCPP` in favor of `GINKGO_BUILD_SYCL`

If the build uses `GINKGO_BUILD_DPCPP`, it will be copied to `GINKGO_BUILD_SYCL`.
If both are specified the same value, show the warning. Otherwise, throw the error.

Related PR: #1350
  • Loading branch information
yhmtsai authored Oct 14, 2023
2 parents 1451321 + acf7a82 commit 2f3720f
Show file tree
Hide file tree
Showing 22 changed files with 142 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bot-pr-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.author_association == 'COLLABORATOR' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'OWNER'
env:
CMAKE_FLAGS: -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=DEBUG -DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_BENCHMARKS=OFF -DGINKGO_BUILD_HWLOC=OFF -DGINKGO_BUILD_REFERENCE=OFF -DGINKGO_BUILD_OMP=OFF -DGINKGO_BUILD_CUDA=OFF -DGINKGO_BUILD_HIP=OFF -DGINKGO_BUILD_DPCPP=OFF
CMAKE_FLAGS: -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=DEBUG -DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_BENCHMARKS=OFF -DGINKGO_BUILD_HWLOC=OFF -DGINKGO_BUILD_REFERENCE=OFF -DGINKGO_BUILD_OMP=OFF -DGINKGO_BUILD_CUDA=OFF -DGINKGO_BUILD_HIP=OFF -DGINKGO_BUILD_SYCL=OFF
steps:
- name: Checkout the new code (shallow clone)
uses: actions/checkout@v3
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
fail-fast: false
matrix:
config:
- {build_type: "Release", name: "intel/release/shared", "mixed": "ON"}
- {compiler: "dpcpp", build_type: "Release", name: "intel/dpcpp/release/shared", mixed: "ON"}
- {compiler: "icpx", build_type: "Release", name: "intel/icpx/release/shared", mixed: "OFF"}
name: ${{ matrix.config.name }}
runs-on: [gpu_intel]

Expand All @@ -35,7 +36,7 @@ jobs:
spack find --loaded
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=install_ginkgo -DGINKGO_COMPILER_FLAGS="-ffp-model=precise" -DCMAKE_CXX_COMPILER=dpcpp -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DGINKGO_MIXED_PRECISION=${{ matrix.config.mixed }} -DGINKGO_DPCPP_SINGLE_MODE=ON
cmake .. -DCMAKE_INSTALL_PREFIX=install_ginkgo -DGINKGO_COMPILER_FLAGS="-ffp-model=precise" -DCMAKE_CXX_COMPILER=${{ matrix.config.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DGINKGO_MIXED_PRECISION=${{ matrix.config.mixed }} -DGINKGO_DPCPP_SINGLE_MODE=ON
make -j8
ONEAPI_DEVICE_SELECTOR=level_zero:gpu ctest -j10 --output-on-failure
Expand Down
29 changes: 22 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ build/nocuda-nomixed/nompi/clang/omp/debug/static:
BUILD_SHARED_LIBS: "OFF"
MIXED_PRECISION: "OFF"

build/dpcpp/2022-1/cpu/release/static:
build/dpcpp/2022-1/cpu/release/shared:
extends:
- .build_and_test_template
- .default_variables
Expand All @@ -590,7 +590,7 @@ build/dpcpp/2022-1/cpu/release/static:
variables:
C_COMPILER: "gcc"
CXX_COMPILER: "dpcpp"
BUILD_DPCPP: "ON"
BUILD_SYCL: "ON"
GKO_COMPILER_FLAGS: "-ffp-model=precise"
BUILD_TYPE: "Release"
BUILD_SHARED_LIBS: "ON"
Expand All @@ -609,7 +609,7 @@ build/dpcpp/igpu/release/shared:
variables:
C_COMPILER: "gcc"
CXX_COMPILER: "dpcpp"
BUILD_DPCPP: "ON"
BUILD_SYCL: "ON"
GKO_COMPILER_FLAGS: "-ffp-model=precise"
BUILD_TYPE: "Release"
BUILD_SHARED_LIBS: "ON"
Expand All @@ -626,7 +626,7 @@ build/dpcpp/igpu/release/shared:
# variables:
# C_COMPILER: "gcc"
# CXX_COMPILER: "dpcpp"
# BUILD_DPCPP: "ON"
# BUILD_SYCL: "ON"
# GKO_COMPILER_FLAGS: "-ffp-model=precise"
# BUILD_TYPE: "Debug"
# BUILD_SHARED_LIBS: "ON"
Expand All @@ -643,7 +643,7 @@ build/dpcpp/dgpu/release/static:
variables:
C_COMPILER: "gcc"
CXX_COMPILER: "dpcpp"
BUILD_DPCPP: "ON"
BUILD_SYCL: "ON"
GKO_COMPILER_FLAGS: "-ffp-model=precise"
BUILD_TYPE: "Release"
BUILD_SHARED_LIBS: "OF"
Expand All @@ -659,7 +659,22 @@ build/dpcpp/level_zero_dgpu/release/shared:
variables:
C_COMPILER: "gcc"
CXX_COMPILER: "dpcpp"
BUILD_DPCPP: "ON"
BUILD_SYCL: "ON"
GKO_COMPILER_FLAGS: "-ffp-model=precise"
BUILD_TYPE: "Release"
DPCPP_SINGLE_MODE: "ON"
ONEAPI_DEVICE_SELECTOR: "level_zero:gpu"

build/icpx/level_zero_dgpu/release/shared:
extends:
- .build_and_test_template
- .default_variables
- .quick_test_condition
- .use_gko-oneapi-dgpu
variables:
C_COMPILER: "icx"
CXX_COMPILER: "icpx"
BUILD_SYCL: "ON"
GKO_COMPILER_FLAGS: "-ffp-model=precise"
BUILD_TYPE: "Release"
DPCPP_SINGLE_MODE: "ON"
Expand Down Expand Up @@ -819,7 +834,7 @@ gh-pages:
-DCMAKE_CUDA_COMPILER=${CUDA_COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
-DBUILD_SHARED_LIBS=ON ${EXTRA_CMAKE_FLAGS} -DGINKGO_DEVEL_TOOLS=OFF
-DGINKGO_BUILD_REFERENCE=OFF -DGINKGO_BUILD_OMP=OFF -DGINKGO_BUILD_CUDA=OFF
-DGINKGO_BUILD_HIP=OFF -DGINKGO_BUILD_DPCPP=OFF -DGINKGO_BUILD_MPI=OFF
-DGINKGO_BUILD_HIP=OFF -DGINKGO_BUILD_SYCL=OFF -DGINKGO_BUILD_MPI=OFF
-DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF
-DGINKGO_BUILD_DOC=ON -DGINKGO_DOC_GENERATE_PDF=ON
- make usr
Expand Down
4 changes: 2 additions & 2 deletions .gitlab/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
-DGINKGO_COMPILER_FLAGS=${GKO_COMPILER_FLAGS}
-DGINKGO_DEVEL_TOOLS=OFF -DGINKGO_BUILD_REFERENCE=${BUILD_REFERENCE}
-DGINKGO_BUILD_OMP=${BUILD_OMP} -DGINKGO_BUILD_CUDA=${BUILD_CUDA}
-DGINKGO_BUILD_HIP=${BUILD_HIP}
-DGINKGO_BUILD_HIP=${BUILD_HIP} -DGINKGO_BUILD_SYCL=${BUILD_SYCL}
-DGINKGO_BUILD_MPI=${BUILD_MPI} ${MPI_STR}
-DGINKGO_BUILD_HWLOC=${BUILD_HWLOC}
-DGINKGO_BUILD_PAPI_SDE=${BUILD_PAPI_SDE}
Expand Down Expand Up @@ -85,7 +85,7 @@
-DGINKGO_COMPILER_FLAGS=${GKO_COMPILER_FLAGS}
-DGINKGO_DEVEL_TOOLS=OFF -DGINKGO_BUILD_REFERENCE=${BUILD_REFERENCE}
-DGINKGO_BUILD_OMP=${BUILD_OMP} -DGINKGO_BUILD_CUDA=${BUILD_CUDA}
-DGINKGO_BUILD_HIP=${BUILD_HIP}
-DGINKGO_BUILD_HIP=${BUILD_HIP} -DGINKGO_BUILD_SYCL=${BUILD_SYCL}
-DGINKGO_BUILD_MPI=${BUILD_MPI} ${MPI_STR}
-DGINKGO_BUILD_HWLOC=${BUILD_HWLOC}
-DGINKGO_BUILD_PAPI_SDE=${BUILD_PAPI_SDE}
Expand Down
1 change: 1 addition & 0 deletions .gitlab/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
BUILD_OMP: "OFF"
BUILD_CUDA: "OFF"
BUILD_HIP: "OFF"
BUILD_SYCL: "OFF"
BUILD_HWLOC: "ON"
BUILD_PAPI_SDE: "OFF"
BUILD_MPI: "OFF"
Expand Down
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ include(cmake/autodetect_executors.cmake)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/")
include(cmake/autodetect_system_libs.cmake)

# rename helper
include(cmake/rename.cmake)

# Ginkgo configuration options
option(GINKGO_DEVEL_TOOLS "Add development tools to the build system" OFF)
option(GINKGO_BUILD_TESTS "Generate build files for unit tests" ON)
Expand All @@ -21,8 +24,9 @@ option(GINKGO_BUILD_BENCHMARKS "Build Ginkgo's benchmarks" ON)
option(GINKGO_BUILD_REFERENCE "Compile reference CPU kernels" ON)
option(GINKGO_BUILD_OMP "Compile OpenMP kernels for CPU" ${GINKGO_HAS_OMP})
option(GINKGO_BUILD_MPI "Compile the MPI module" ${GINKGO_HAS_MPI})
option(GINKGO_BUILD_DPCPP
"Compile DPC++ kernels for Intel GPUs or other DPC++ enabled hardware" ${GINKGO_HAS_DPCPP})
gko_rename_cache(GINKGO_BUILD_DPCPP GINKGO_BUILD_SYCL BOOL "Compile SYCL kernels for Intel GPUs or other SYCL enabled hardware")
option(GINKGO_BUILD_SYCL
"Compile SYCL kernels for Intel GPUs or other SYCL enabled hardware" ${GINKGO_HAS_SYCL})
option(GINKGO_BUILD_CUDA "Compile kernels for NVIDIA GPUs" ${GINKGO_HAS_CUDA})
option(GINKGO_BUILD_HIP "Compile kernels for AMD or NVIDIA GPUs" ${GINKGO_HAS_HIP})
option(GINKGO_BUILD_DOC "Generate documentation" OFF)
Expand Down Expand Up @@ -50,7 +54,7 @@ set(GINKGO_VERBOSE_LEVEL "1" CACHE STRING
if(MSVC)
set(GINKGO_COMPILER_FLAGS "" CACHE STRING
"Set the required CXX compiler flags, mainly used for warnings. Current default is ``")
elseif(GINKGO_BUILD_DPCPP OR CMAKE_CXX_COMPILER MATCHES "dpcpp")
elseif(GINKGO_BUILD_SYCL OR CMAKE_CXX_COMPILER MATCHES "dpcpp|icpx")
# For now always use `-ffp-model=precise` with DPC++. This can be removed when
# the floating point issues are fixed.
set(GINKGO_COMPILER_FLAGS "-Wpedantic;-ffp-model=precise" CACHE STRING
Expand Down Expand Up @@ -99,6 +103,9 @@ endif()
if(GINKGO_BUILD_HIP)
include(cmake/hip.cmake)
endif()
if(GINKGO_BUILD_SYCL)
include(cmake/sycl.cmake)
endif()
if(GINKGO_BUILD_OMP)
find_package(OpenMP 3.0 REQUIRED)
endif()
Expand Down Expand Up @@ -295,7 +302,7 @@ if(MSVC)
endif()
endif()

if(GINKGO_BUILD_DPCPP)
if(GINKGO_BUILD_SYCL)
ginkgo_extract_dpcpp_version(${CMAKE_CXX_COMPILER} GINKGO_DPCPP_MAJOR_VERSION __LIBSYCL_MAJOR_VERSION)
ginkgo_extract_dpcpp_version(${CMAKE_CXX_COMPILER} GINKGO_DPCPP_VERSION __SYCL_COMPILER_VERSION)
else()
Expand All @@ -318,7 +325,7 @@ endif()
if(GINKGO_BUILD_HIP)
add_subdirectory(hip) # High-performance kernels for AMD or NVIDIA GPUs
endif()
if(GINKGO_BUILD_DPCPP)
if(GINKGO_BUILD_SYCL)
add_subdirectory(dpcpp) # High-performance DPC++ kernels
endif()
if(GINKGO_BUILD_OMP)
Expand Down
7 changes: 4 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ Ginkgo adds the following additional switches to control what is being built:
* `-DGINKGO_BUILD_CUDA={ON, OFF}` builds optimized cuda versions of the kernels
(requires CUDA), default is `ON` if a CUDA compiler could be detected,
`OFF` otherwise.
* `-DGINKGO_BUILD_DPCPP={ON, OFF}` builds optimized DPC++ versions of the
kernels (requires `CMAKE_CXX_COMPILER` to be set to the `dpcpp` compiler).
The default is `ON` if `CMAKE_CXX_COMPILER` is a DPC++ compiler, `OFF`
* `-DGINKGO_BUILD_DPCPP={ON, OFF}` is deprecated. Please use `GINKGO_BUILD_SYCL` instead.
* `-DGINKGO_BUILD_SYCL={ON, OFF}` builds optimized SYCL versions of the
kernels (requires `CMAKE_CXX_COMPILER` to be set to the `dpcpp` or `icpx` compiler).
The default is `ON` if `CMAKE_CXX_COMPILER` is a SYCL compiler, `OFF`
otherwise.
* `-DGINKGO_BUILD_HIP={ON, OFF}` builds optimized HIP versions of the kernels
(requires HIP), default is `ON` if an installation of HIP could be detected,
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Ginkgo is a high-performance linear algebra library for manycore systems, with a
focus on the solution of sparse linear systems. It is implemented using modern C++
(you will need an at least C++14 compliant compiler to build it), with GPU kernels
implemented in CUDA, HIP, and DPC++.
implemented in CUDA, HIP, and DPC++(SYCL).


Performance
Expand Down Expand Up @@ -62,10 +62,10 @@ The Ginkgo HIP module has the following __additional__ requirements:
* _10.1 <= CUDA < 11_ backend
* if the hipFFT package is available, it is used to implement the FFT LinOps.

The Ginkgo DPC++ module has the following __additional__ requirements:
The Ginkgo DPC++(SYCL) module has the following __additional__ requirements:

* _OneAPI 2021.3+_
* Set `dpcpp` as the `CMAKE_CXX_COMPILER`
* Set `dpcpp` or `icpx` as the `CMAKE_CXX_COMPILER`
* `c++17` is used to compile Ginkgo
* The following oneAPI packages should be available:
* oneMKL
Expand Down Expand Up @@ -123,7 +123,7 @@ cmake -G "Unix Makefiles" .. && make
By default, `GINKGO_BUILD_REFERENCE` is enabled. You should be able to run
examples with this executor. By default, Ginkgo tries to enable the relevant
modules depending on your machine environment (present of CUDA, ...). You can
also explicitly compile with the OpenMP, CUDA, HIP or DPC++ modules enabled to
also explicitly compile with the OpenMP, CUDA, HIP or DPC++(SYCL) modules enabled to
run the examples with these executors. Please refer to the [Installation
page](./INSTALL.md) for more details.

Expand Down
8 changes: 5 additions & 3 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function(ginkgo_add_single_benchmark_executable name use_lib_linops macro_def ty
target_compile_definitions("${name}" PRIVATE HAS_HIP_TIMER=1)
target_link_libraries("${name}" hip_timer)
endif()
if (GINKGO_BUILD_DPCPP)
if (GINKGO_BUILD_SYCL)
target_compile_definitions("${name}" PRIVATE HAS_DPCPP_TIMER=1)
target_link_libraries("${name}" dpcpp_timer)
endif()
Expand All @@ -87,7 +87,7 @@ function(ginkgo_add_single_benchmark_executable name use_lib_linops macro_def ty
target_compile_definitions("${name}" PRIVATE HAS_HIP=1)
target_link_libraries("${name}" hipsparse_linops_${type})
endif()
if (GINKGO_BUILD_DPCPP)
if (GINKGO_BUILD_SYCL)
target_compile_definitions("${name}" PRIVATE HAS_DPCPP=1)
target_link_libraries("${name}" onemkl_linops_${type})
endif()
Expand Down Expand Up @@ -134,12 +134,14 @@ if (GINKGO_BUILD_HIP)
target_link_libraries(hip_timer ginkgo)
endif()

if (GINKGO_BUILD_DPCPP)
if (GINKGO_BUILD_SYCL)
ginkgo_benchmark_onemkl_linops(d GKO_BENCHMARK_USE_DOUBLE_PRECISION)
ginkgo_benchmark_onemkl_linops(s GKO_BENCHMARK_USE_SINGLE_PRECISION)
ginkgo_benchmark_onemkl_linops(z GKO_BENCHMARK_USE_DOUBLE_COMPLEX_PRECISION)
ginkgo_benchmark_onemkl_linops(c GKO_BENCHMARK_USE_SINGLE_COMPLEX_PRECISION)
add_library(dpcpp_timer utils/dpcpp_timer.dp.cpp)
target_compile_options(dpcpp_timer PRIVATE ${GINKGO_DPCPP_FLAGS})
gko_add_sycl_to_target(TARGET dpcpp_timer SOURCES utils/dpcpp_timer.dp.cpp)
target_link_libraries(dpcpp_timer ginkgo)
endif()

Expand Down
4 changes: 2 additions & 2 deletions cmake/GinkgoConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(GINKGO_BUILD_OMP @GINKGO_BUILD_OMP@)
set(GINKGO_BUILD_CUDA @GINKGO_BUILD_CUDA@)
set(GINKGO_BUILD_HIP @GINKGO_BUILD_HIP@)
set(GINKGO_BUILD_MPI @GINKGO_BUILD_MPI@)
set(GINKGO_BUILD_DPCPP @GINKGO_BUILD_DPCPP@)
set(GINKGO_BUILD_SYCL @GINKGO_BUILD_SYCL@)

set(GINKGO_DEVEL_TOOLS @GINKGO_DEVEL_TOOLS@)
set(GINKGO_BUILD_TESTS @GINKGO_BUILD_TESTS@)
Expand Down Expand Up @@ -184,7 +184,7 @@ if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_BUILD_HIP)
endif()
endif()

if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_BUILD_DPCPP)
if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_BUILD_SYCL)
find_package(MKL CONFIG REQUIRED HINTS "${GINKGO_MKL_ROOT}")
find_package(oneDPL REQUIRED HINTS "${GINKGO_DPL_ROOT}")
endif()
Expand Down
10 changes: 7 additions & 3 deletions cmake/autodetect_executors.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(GINKGO_HAS_OMP OFF)
set(GINKGO_HAS_MPI OFF)
set(GINKGO_HAS_CUDA OFF)
set(GINKGO_HAS_DPCPP OFF)
set(GINKGO_HAS_SYCL OFF)
set(GINKGO_HAS_HIP OFF)

include(CheckLanguage)
Expand Down Expand Up @@ -37,12 +37,16 @@ if (NOT DEFINED GINKGO_BUILD_HIP)
endif()
endif()

if (NOT DEFINED GINKGO_BUILD_DPCPP)
if (NOT DEFINED GINKGO_BUILD_DPCPP AND NOT DEFINED GINKGO_BUILD_SYCL)
try_compile(GKO_CAN_COMPILE_DPCPP ${PROJECT_BINARY_DIR}/dpcpp
SOURCES ${PROJECT_SOURCE_DIR}/dpcpp/test_dpcpp.dp.cpp
# try_compile will pass the project CMAKE_CXX_FLAGS so passing -DCMAKE_CXX_FLAGS does not affect it.
# They append COMPILE_DEFINITIONS into CMAKE_CXX_FLAGS.
# Note. it is different from try_compile COMPILE_DEFINITIONS affect
CMAKE_FLAGS -DCOMPILE_DEFINITIONS=-fsycl
CXX_STANDARD 17)
if (GKO_CAN_COMPILE_DPCPP)
message(STATUS "Enabling DPCPP executor")
set(GINKGO_HAS_DPCPP ON)
set(GINKGO_HAS_SYCL ON)
endif()
endif()
3 changes: 2 additions & 1 deletion cmake/build_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ function(ginkgo_extract_dpcpp_version DPCPP_COMPILER GINKGO_DPCPP_VERSION MACRO_
"int main() {std::cout << ${MACRO_VAR} << '\\n'\;"
"return 0\;}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/extract_dpcpp_ver.cpp" ${DPCPP_VERSION_PROG})
execute_process(COMMAND ${DPCPP_COMPILER} ${CMAKE_CURRENT_BINARY_DIR}/extract_dpcpp_ver.cpp
# we always add -fsycl
execute_process(COMMAND ${DPCPP_COMPILER} -fsycl ${CMAKE_CURRENT_BINARY_DIR}/extract_dpcpp_ver.cpp
-o ${CMAKE_CURRENT_BINARY_DIR}/extract_dpcpp_ver
ERROR_VARIABLE DPCPP_EXTRACT_VER_ERROR)
execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/extract_dpcpp_ver
Expand Down
8 changes: 6 additions & 2 deletions cmake/create_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function(ginkgo_create_dpcpp_test test_name)
add_executable(${test_target_name} ${test_name}.dp.cpp)
target_compile_features(${test_target_name} PUBLIC cxx_std_17)
target_compile_options(${test_target_name} PRIVATE ${GINKGO_DPCPP_FLAGS})
gko_add_sycl_to_target(TARGET ${test_target_name} SOURCES ${test_name}.dp.cpp)
target_link_options(${test_target_name} PRIVATE -fsycl-device-code-split=per_kernel)
ginkgo_set_test_target_properties(${test_target_name} "_dpcpp" ${ARGN})
ginkgo_add_test(${test_name} ${test_target_name} ${ARGN} RESOURCE_TYPE sycl)
Expand Down Expand Up @@ -246,7 +247,7 @@ function(ginkgo_create_common_test test_name)
if(GINKGO_BUILD_CUDA)
ginkgo_create_common_test_internal(${test_name} CudaExecutor cuda ${ARGN})
endif()
if(GINKGO_BUILD_DPCPP)
if(GINKGO_BUILD_SYCL)
ginkgo_create_common_test_internal(${test_name} DpcppExecutor dpcpp ${ARGN})
endif()
endfunction(ginkgo_create_common_test)
Expand Down Expand Up @@ -294,10 +295,13 @@ endfunction(ginkgo_create_common_test_internal)
function(ginkgo_create_common_device_test test_name)
cmake_parse_arguments(PARSE_ARGV 1 common_device_test "" "${gko_test_single_args}" "${gko_test_multi_args}")
ginkgo_build_test_name(${test_name} test_target_name)
if(GINKGO_BUILD_DPCPP)
if(GINKGO_BUILD_SYCL)
ginkgo_create_common_test_internal(${test_name} DpcppExecutor dpcpp ${ARGN})
target_compile_features(${test_target_name}_dpcpp PRIVATE cxx_std_17)
target_compile_options(${test_target_name}_dpcpp PRIVATE ${GINKGO_DPCPP_FLAGS})
# We need to use a new file to avoid sycl setting in other backends because add_sycl_to_target will change the source property.
configure_file(${test_name}.cpp ${test_name}.dp.cpp COPYONLY)
gko_add_sycl_to_target(TARGET ${test_target_name}_dpcpp SOURCES ${test_name}.dp.cpp)
target_link_options(${test_target_name}_dpcpp PRIVATE -fsycl-device-lib=all -fsycl-device-code-split=per_kernel)
endif()
if(GINKGO_BUILD_OMP)
Expand Down
4 changes: 2 additions & 2 deletions cmake/get_info.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ foreach(log_type ${log_types})
ginkgo_print_module_footer(${${log_type}} "User configuration:")
ginkgo_print_module_footer(${${log_type}} " Enabled modules:")
ginkgo_print_foreach_variable(${${log_type}}
"GINKGO_BUILD_OMP;GINKGO_BUILD_MPI;GINKGO_BUILD_REFERENCE;GINKGO_BUILD_CUDA;GINKGO_BUILD_HIP;GINKGO_BUILD_DPCPP")
"GINKGO_BUILD_OMP;GINKGO_BUILD_MPI;GINKGO_BUILD_REFERENCE;GINKGO_BUILD_CUDA;GINKGO_BUILD_HIP;GINKGO_BUILD_SYCL")
ginkgo_print_module_footer(${${log_type}} " Enabled features:")
ginkgo_print_foreach_variable(${${log_type}}
"GINKGO_MIXED_PRECISION;GINKGO_HAVE_GPU_AWARE_MPI")
Expand Down Expand Up @@ -167,7 +167,7 @@ IF(GINKGO_BUILD_HIP)
include(hip/get_info.cmake)
ENDIF()

IF(GINKGO_BUILD_DPCPP)
IF(GINKGO_BUILD_SYCL)
include(dpcpp/get_info.cmake)
ENDIF()

Expand Down
20 changes: 20 additions & 0 deletions cmake/rename.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Only for CACHE variable (option)
macro(gko_rename_cache deprecated actual type doc_string)
if(DEFINED ${deprecated})
if(DEFINED ${actual})
message("actual ${actual} and deprecated ${deprecated}")
if("${${actual}}" STREQUAL "${${deprecated}}")
# They are the same, so only throw warning
message(WARNING "${deprecated} was deprecated, please only use ${actual} instead.")
else()
# They are different
message(FATAL_ERROR "Both ${deprecated} and ${actual} were specified differently, please only use ${actual} instead.")
endif()
else()
# Only set `deprecated`, move it to `actual`.
message(WARNING "${deprecated} was deprecated, please use ${actual} instead. "
"We copy ${${deprecated}} to ${actual}")
set(${actual} ${${deprecated}} CACHE ${type} "${doc_string}")
endif()
endif()
endmacro()
Loading

0 comments on commit 2f3720f

Please sign in to comment.