1- ## Authors: Alexander Van Craen, Marcel Breyer
2- ## Copyright (C): 2018-today The PLSSVM project - All Rights Reserved
3- ## License: This file is part of the PLSSVM project which is released under the MIT license.
4- ## See the LICENSE.md file in the project root for full license information.
1+ # Authors: Alexander Van Craen, Marcel Breyer
2+ # Copyright (C): 2018-today The PLSSVM project - All Rights Reserved
3+ # License: This file is part of the PLSSVM project which is released under the MIT license.
4+ # See the LICENSE.md file in the project root for full license information.
55########################################################################################################################
66
77list (APPEND CMAKE_MESSAGE_INDENT "Kokkos: " )
@@ -40,7 +40,7 @@ if (Kokkos_ENABLE_SYCL)
4040 if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "IntelLLVM" )
4141 message (FATAL_ERROR "For Kokkos::SYCL to work, the compiler must be IntelLLVM, but is ${CMAKE_CXX_COMPILER} !" )
4242 endif ()
43-
43+
4444 # set icpx specific compiler flags based on the provided PLSSVM_TARGET_PLATFORMS
4545 set (PLSSVM_KOKKOS_SYCL_FSYCL_TARGETS "" )
4646 # cpu targets
@@ -73,34 +73,38 @@ if (Kokkos_ENABLE_SYCL)
7373 list (JOIN PLSSVM_KOKKOS_SYCL_FSYCL_TARGETS "," PLSSVM_KOKKOS_SYCL_FSYCL_TARGETS_STRING)
7474 target_compile_options (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -sycl-std=2020 -fsycl -fsycl-targets=${PLSSVM_KOKKOS_SYCL_FSYCL_TARGETS_STRING} )
7575 target_link_options (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -fsycl -fsycl-targets=${PLSSVM_KOKKOS_SYCL_FSYCL_TARGETS_STRING} )
76-
76+
7777 # add option for IntelLLVM Ahead-of-Time (AOT) compilation
7878 option (PLSSVM_KOKKOS_BACKEND_INTEL_LLVM_ENABLE_AOT "Enables Ahead-of-Time compilation for the Kokkos::SYCL execution space using IntelLLVM." ON )
7979 if (PLSSVM_KOKKOS_BACKEND_INTEL_LLVM_ENABLE_AOT)
8080 message (STATUS "Enabled Ahead-of-Time (AOT) compilation for the Kokkos::SYCL execution space using IntelLLVM." )
8181 target_compile_definitions (${PLSSVM_BASE_LIBRARY_NAME} PRIVATE PLSSVM_KOKKOS_BACKEND_INTEL_LLVM_ENABLE_AOT)
8282 target_compile_definitions (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PUBLIC PLSSVM_KOKKOS_BACKEND_INTEL_LLVM_ENABLE_AOT)
83- ## set AOT compiler flags
84- # cpu targets
83+ # set AOT compiler flags
8584 if (DEFINED PLSSVM_CPU_TARGET_ARCHS)
86- # add target specific flags for AOT
85+ # add CPU target specific flags for AOT
8786 if (PLSSVM_NUM_CPU_TARGET_ARCHS EQUAL 1)
8887 target_compile_options (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -Xsycl-target -backend=spir64_x86_64 "-march=${PLSSVM_CPU_TARGET_ARCHS} " )
8988 target_link_options (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -Xsycl-target -backend=spir64_x86_64 "-march=${PLSSVM_CPU_TARGET_ARCHS} " )
9089 endif ()
9190 endif ()
92- # nvidia targets
9391 if (DEFINED PLSSVM_NVIDIA_TARGET_ARCHS)
94- # add target specific flags for AOT
92+ # add NVIDIA GPU target specific flags for AOT
9593 if (NOT PLSSVM_NUM_NVIDIA_TARGET_ARCHS EQUAL 1)
96- message (SEND_ERROR "IntelLLVM currently only supports a single NVIDIA architecture specification for AOT but ${PLSSVM_NUM_NVIDIA_TARGET_ARCHS} were provided!" )
94+ message (
95+ SEND_ERROR
96+ "IntelLLVM currently only supports a single NVIDIA architecture specification for AOT but ${PLSSVM_NUM_NVIDIA_TARGET_ARCHS} were provided!"
97+ )
9798 endif ()
98- target_compile_options (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -Xsycl-target -backend=nvptx64-nvidia-cuda --offload-arch=${PLSSVM_NVIDIA_TARGET_ARCHS} )
99- target_link_options (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -Xsycl-target -backend=nvptx64-nvidia-cuda --offload-arch=${PLSSVM_NVIDIA_TARGET_ARCHS} )
99+ target_compile_options (
100+ ${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -Xsycl-target -backend=nvptx64-nvidia-cuda --offload-arch=${PLSSVM_NVIDIA_TARGET_ARCHS}
101+ )
102+ target_link_options (
103+ ${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -Xsycl-target -backend=nvptx64-nvidia-cuda --offload-arch=${PLSSVM_NVIDIA_TARGET_ARCHS}
104+ )
100105 endif ()
101- # intel targets
102106 if (DEFINED PLSSVM_INTEL_TARGET_ARCHS)
103- # add target specific flags for AOT
107+ # add Intel GPU target specific flags for AOT
104108 list (JOIN PLSSVM_INTEL_TARGET_ARCHS "," PLSSVM_INTEL_TARGET_ARCHS_STRING)
105109 target_compile_options (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -Xsycl-target -backend=spir64_gen "-device ${PLSSVM_INTEL_TARGET_ARCHS_STRING} " )
106110 target_link_options (${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} PRIVATE -Xsycl-target -backend=spir64_gen "-device ${PLSSVM_INTEL_TARGET_ARCHS_STRING} " )
@@ -121,9 +125,11 @@ target_link_libraries(${PLSSVM_ALL_LIBRARY_NAME} INTERFACE ${PLSSVM_KOKKOS_BACKE
121125# mark backend library as install target
122126append_local_and_parent(PLSSVM_TARGETS_TO_INSTALL ${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME} )
123127
128+ # ~~~
124129# assemble Kokkos available execution space string
125130# also set compile definitions -> can't use KOKKOS_ENABLE_* directly inside the "constexpr_available_execution_space.hpp"
126131# header since we can't include "Kokkos_Core.hpp" there (transitively used in the base library that doesn't know anything about Kokkos
132+ # ~~~
127133set (PLSSVM_KOKKOS_BACKEND_AVAILABLE_EXECUTION_SPACES "" )
128134if (Kokkos_ENABLE_CUDA)
129135 target_compile_definitions (${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_KOKKOS_BACKEND_ENABLE_CUDA)
@@ -163,10 +169,14 @@ if (Kokkos_ENABLE_SERIAL)
163169endif ()
164170set (PLSSVM_KOKKOS_BACKEND_AVAILABLE_EXECUTION_SPACES "${PLSSVM_KOKKOS_BACKEND_AVAILABLE_EXECUTION_SPACES} " PARENT_SCOPE)
165171
172+ # ~~~
166173# also set the number of available Kokkos execution spaces to explicitly set the type of the used std::array
167174# -> necessary if NO Kokkos execution space is available and, therefore, the size of the std::array would be 0 (can't automatically be deduced)
175+ # ~~~
168176list (LENGTH PLSSVM_KOKKOS_BACKEND_AVAILABLE_EXECUTION_SPACES PLSSVM_KOKKOS_BACKEND_NUM_AVAILABLE_EXECUTION_SPACES)
169- target_compile_definitions (${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_KOKKOS_BACKEND_NUM_AVAILABLE_EXECUTION_SPACES=${PLSSVM_KOKKOS_BACKEND_NUM_AVAILABLE_EXECUTION_SPACES} )
177+ target_compile_definitions (
178+ ${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_KOKKOS_BACKEND_NUM_AVAILABLE_EXECUTION_SPACES=${PLSSVM_KOKKOS_BACKEND_NUM_AVAILABLE_EXECUTION_SPACES}
179+ )
170180
171181# generate summary string
172182set (PLSSVM_KOKKOS_BACKEND_SUMMARY_STRING_COMPILER " - Kokkos (${PLSSVM_KOKKOS_BACKEND_AVAILABLE_EXECUTION_SPACES} ):" )
@@ -179,4 +189,4 @@ string(REPLACE " (${PLSSVM_AMD_TARGET_ARCHS})" "" PLSSVM_KOKKOS_BACKEND_SUMMARY_
179189string (REPLACE " (${PLSSVM_INTEL_TARGET_ARCHS} )" "" PLSSVM_KOKKOS_BACKEND_SUMMARY_STRING_ARCHS "${PLSSVM_KOKKOS_BACKEND_SUMMARY_STRING_ARCHS} " )
180190set (PLSSVM_KOKKOS_BACKEND_SUMMARY_STRING "${PLSSVM_KOKKOS_BACKEND_SUMMARY_STRING_COMPILER}${PLSSVM_KOKKOS_BACKEND_SUMMARY_STRING_ARCHS} " PARENT_SCOPE)
181191
182- list (POP_BACK CMAKE_MESSAGE_INDENT)
192+ list (POP_BACK CMAKE_MESSAGE_INDENT)
0 commit comments