Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
675e173
Add new Kokkos backend to the backend_types enumeration.
breyerml Oct 14, 2024
4781224
Add specialized exception type.
breyerml Oct 14, 2024
40ec682
Stub implementation of the pinned_memory class.
breyerml Oct 14, 2024
dd69990
Stub implementation of the Kokkos csvm class.
breyerml Oct 14, 2024
b1dcb5a
Add Kokkos to the build.
breyerml Oct 14, 2024
0cf9e36
Kokkos device_ptr stub tests.
breyerml Oct 14, 2024
7559525
First (maybe) functional Kokkos device_ptr implementation.
breyerml Oct 16, 2024
690014f
Merge branch 'develop' into Kokkos
breyerml Oct 17, 2024
0a318dc
Add Kokkos CMake preset.
breyerml Oct 17, 2024
d254a5b
Further improve implementation and add more placeholder functions.
breyerml Oct 17, 2024
752afd4
Don't hardcoded test against nullptr, but the default constructed dev…
breyerml Oct 18, 2024
820c431
Implement missing device_ptr functionality.
breyerml Oct 21, 2024
2fc2616
Add total_size function to dim_type struct.
breyerml Oct 21, 2024
83dd160
Add first working (but WIP) Kokkos backend implementation.
breyerml Oct 21, 2024
bc47002
Add missing parameterized test suites.
breyerml Oct 21, 2024
dfbb0cc
Add first Kokkos backend tests.
breyerml Oct 21, 2024
5cba91d
Update and refactor implementation.
breyerml Oct 22, 2024
90ff272
Create get_device_list function and add missing documentation.
breyerml Oct 22, 2024
3f4bf8d
Move Kokkos::View typedefs to custom header.
breyerml Oct 22, 2024
33ecfe9
Add additional execution_space query function and tests.
breyerml Oct 22, 2024
4ed8bac
Add typedef tests.
breyerml Oct 22, 2024
ee9705c
Add standard layout tuple tests.
breyerml Oct 22, 2024
8a90949
Add stub tests.
breyerml Oct 22, 2024
fc021ae
Rename function.
breyerml Oct 22, 2024
a5ee4ef
Add TODOs and first utility tests.
breyerml Oct 22, 2024
01f2793
Reduce code duplication be moving similar code to a common header file.
breyerml Oct 22, 2024
fd6473e
Support switching between different Kokkos::ExecutionSpaces at runtim…
breyerml Oct 28, 2024
2b1f0a4
Update documentation.
breyerml Oct 28, 2024
c13a420
Fix compilation error.
breyerml Oct 29, 2024
f4c7441
Fix Kokkos warning regarding implicit conversions.
breyerml Oct 29, 2024
d72f8a6
Add missing header.
breyerml Oct 29, 2024
fba8361
Fix problems when using multiple GPUs.
breyerml Oct 31, 2024
1c75216
First try implementing map for Kokkos's SYCL backend.
breyerml Oct 31, 2024
7417b14
Merge branch 'develop' into Kokkos
breyerml Oct 31, 2024
bb89a07
Also set Kokkos backend to be OFF per default.
breyerml Oct 31, 2024
61b3833
Add missing device (i.e., Kokkos::ExecutionSpace instance) to Kokkos:…
breyerml Nov 2, 2024
8064363
Remove unused include.
breyerml Nov 2, 2024
3cb4a99
Use Kokkos::ScopeGuard to be sure that Kokkos::finalize is called cor…
breyerml Nov 2, 2024
cf52ebc
Improve memset implementation.
breyerml Nov 2, 2024
275da84
Handle the Kokkos backend in some more tests.
breyerml Nov 2, 2024
4d44b56
Move the Kokkos initialization to the general test main.cpp file (gua…
breyerml Nov 2, 2024
7ad8d1c
Remove now unused directory documentation.
breyerml Nov 4, 2024
f551364
Fix failing test.
breyerml Nov 5, 2024
b064677
Add new conditional execution macro.
breyerml Nov 5, 2024
b5174df
Add missing break statements.
breyerml Nov 5, 2024
25105eb
Add missing make_device_view_wrapper test.
breyerml Nov 5, 2024
a1a2fdb
Remove dim_type::total_size in favor of Kokkos specific dim_type_to_n…
breyerml Nov 5, 2024
208055e
Fix maximum grid size problems when using Kokkos (since Kokkos only s…
breyerml Nov 5, 2024
2d82a24
Fix TODO.
breyerml Nov 5, 2024
b130e15
Enable the Kokkos CSVM in the Python bindings.
breyerml Nov 5, 2024
f0fc6ae
Improve documentation.
breyerml Nov 5, 2024
2b69199
Add missing const.
breyerml Nov 5, 2024
0f5663f
Change wrong Kokkos::Hip to Kokkos::HIP.
breyerml Nov 6, 2024
0bcd6d7
Add missing namespace qualifiers and function call parenthesis.
breyerml Nov 6, 2024
f38fe37
Add missing switch break.
breyerml Nov 6, 2024
c9cd1c5
Fix usage of wrong Kokkos HPX namespace.
breyerml Nov 6, 2024
eb5cd36
Implement SYCL specific device selection (supporting potentially mult…
breyerml Nov 6, 2024
c88d156
Use icpx specific compilation flags.
breyerml Nov 6, 2024
ff1bb24
Add return code checks.
breyerml Nov 6, 2024
0ab2f64
Move CMake functionality inside correct if.
breyerml Nov 6, 2024
9b7736e
Remove old test implementation.
breyerml Nov 6, 2024
a1d13d9
Fix TODO in documentation.
breyerml Nov 7, 2024
a0af87c
Correctly use the Kokkos::Experimental::OpenMPTarget namespace.
breyerml Nov 7, 2024
39e447c
Add support for more Kokkos execution spaces. NOTE: OpenMPTarget and …
breyerml Nov 7, 2024
63d3814
Correctly use Kokkos::Experimental::OpenACC instead of Kokkos::OpenACC.
breyerml Nov 7, 2024
b673f28
Split execution_space header in multiple headers such that the Kokkos…
breyerml Nov 7, 2024
29feaea
Add new automatic execution space.
breyerml Nov 7, 2024
d7f5423
Add the possibility to explicitly specify the Kokkos execution space …
breyerml Nov 7, 2024
46da12f
Update manpage.
breyerml Nov 7, 2024
85c581d
Add available Kokkos execution spaces to the Kokkos CMake summary str…
breyerml Nov 7, 2024
5ed9e53
Update README to also include the new Kokkos backend.
breyerml Nov 7, 2024
66dfee6
Add support for the Kokkos backend as PLSSVM install component.
breyerml Nov 7, 2024
e30677f
Update manpages to include the Kokkos backend.
breyerml Nov 7, 2024
7be8170
Add kokkos to the --help examples.
breyerml Nov 7, 2024
f967c47
Add missing include documentation.
breyerml Nov 7, 2024
d56397a
Add kokkos_execution_space named parameter to the Kokkos python bindi…
breyerml Nov 7, 2024
2809daa
Allow Kokkos to be built in the all preset.
breyerml Nov 7, 2024
dcbbe10
Update TODOs.
breyerml Nov 7, 2024
9a53e7f
Add missing Kokkos related performance tracking entries.
breyerml Nov 7, 2024
5636ea1
Add missing Kokkos entry to Python bindings backend type enumeration.
breyerml Nov 7, 2024
c187ec0
Add missing operator<< output for the new kokkos_execution_space option.
breyerml Nov 7, 2024
de69b87
Fix using wrong executable in cmd parser test.
breyerml Nov 7, 2024
6a18cc6
Update parameter and cmd parser tests to reflect new kokkos_execution…
breyerml Nov 7, 2024
0ac498b
Add missing command line parameters to tests.
breyerml Nov 8, 2024
c279435
Fix formatting.
breyerml Nov 8, 2024
9288a33
Fix failing tests.
breyerml Nov 8, 2024
1e36ab1
The execution space implementation must always be available -> moved …
breyerml Nov 8, 2024
1a8e092
Now the execution space file can also be compiled if Kokkos is not av…
breyerml Nov 8, 2024
7f7520f
Fix compilation error involving too many template instantiations.
breyerml Nov 8, 2024
6904c88
Use target_compile_options instead of directly changing CMAKE_CXX_FLAGS.
breyerml Nov 9, 2024
0566ba0
Additionally, output all additional_arguments (if any).
breyerml Nov 9, 2024
1d6b814
Fix wrong size of test array.
breyerml Nov 10, 2024
c4dc4ec
Test all available Kokkos execution spaces.
breyerml Nov 10, 2024
70dec59
Reformulate some template meta-programming parts from a recursive imp…
breyerml Nov 10, 2024
d57e619
Disable some tests if the Kokkos::Cuda execution space is enabled due…
breyerml Nov 10, 2024
6f210ff
Also test all available execution spaces for the device_ptr class in …
breyerml Nov 11, 2024
5bf3b00
Add missing [[nodiscard]] and fix nvcc related implicit conversion co…
breyerml Nov 11, 2024
e4a5cbb
Lift league size restrictions for the CPU based Kokkos execution spaces.
breyerml Nov 11, 2024
02dcd74
Fix typo.
breyerml Nov 11, 2024
e3bb207
Add assertion that the target_ must be set.
breyerml Nov 11, 2024
e1ec7db
Fix error not setting target_ in one case.
breyerml Nov 11, 2024
d68e86d
Fix formatting.
breyerml Nov 11, 2024
5e563ab
Fix a problem where the target_platform can't be determined, but no e…
breyerml Nov 11, 2024
3518e9e
Fix failing tests if a Kokkos execution space is available but no tar…
breyerml Nov 11, 2024
3c892d8
Increase recursive template instantiation limit fixing a compilation …
breyerml Nov 11, 2024
ae4d02e
Update some tests.
breyerml Nov 11, 2024
03bd55e
Do not pass argc and argv to the Kokkos initialization functions.
breyerml Nov 11, 2024
4e4be67
Use an atexit handler to fix segfault emerging with icpx in the tests…
breyerml Nov 11, 2024
cd36293
Add custom PLSSVM initialization and finalization functions including…
breyerml Nov 13, 2024
e5fd3c4
Change the order of available target platforms so that the correct on…
breyerml Nov 13, 2024
4bbea21
Add missing plssvmKokkosTargets.cmake file to install files.
breyerml Nov 14, 2024
3955b92
Merge branch 'develop' into Kokkos
breyerml Nov 15, 2024
c81fcfa
Add missing utility header entry after adding new exception type.
breyerml Nov 15, 2024
7065929
The new finalize function must not be enclosed in an if.
breyerml Nov 15, 2024
cd88378
Add missing detail:: namespace qualifier.
breyerml Nov 15, 2024
b5c8df0
Mark part of function as unreachable.
breyerml Nov 15, 2024
69eff96
Fix formatting errors.
breyerml Nov 15, 2024
07e85c2
Update format library and disable JSON support in our .clang-format.
breyerml Nov 25, 2024
7f8c5f5
Merge branch 'develop' into Kokkos
breyerml Nov 28, 2024
7907291
Fix merge error.
breyerml Nov 28, 2024
efd5f81
Increase backend number to fix failing tests.
breyerml Nov 28, 2024
a797616
Fix failing test due to floating point inaccuracies.
breyerml Nov 28, 2024
0ae874f
Do not expose the environment related functions in the Python binding…
breyerml Nov 28, 2024
eb45c5d
Fix Doxygen documentation warnings.
breyerml Nov 28, 2024
f8ae480
Merge branch 'develop' into Kokkos
breyerml Nov 28, 2024
5bd2828
Correctly implement is_initialization_necessary for HPX and Kokkos.
breyerml Dec 3, 2024
6bb7261
Add missing includes and update formatting.
breyerml Dec 3, 2024
cd6d31c
Specify latest supported Kokkos release.
breyerml Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
Language: Json
DisableFormat: true
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
Expand Down Expand Up @@ -79,7 +82,7 @@ IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"plssvm/'
Priority: 1
- Regex: '^"(cuda|hip|CL|sycl|omp|hpx)'
- Regex: '^"(cuda|hip|CL|sycl|omp|hpx|Kokkos)'
Priority: 2
- Regex: '^"(tests|bindings)/'
Priority: 3
Expand Down
27 changes: 25 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ endif ()
########################################################################################################################
## set base sources
set(PLSSVM_BASE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/plssvm/backends/Kokkos/execution_space.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plssvm/backends/SYCL/implementation_types.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plssvm/backends/SYCL/kernel_invocation_types.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plssvm/backends/stdpar/implementation_types.cpp
Expand Down Expand Up @@ -411,6 +412,13 @@ if (PLSSVM_ENABLE_SYCL_BACKEND MATCHES "AUTO" OR PLSSVM_ENABLE_SYCL_BACKEND)
add_subdirectory(src/plssvm/backends/SYCL)
endif ()

## check for Kokkos backend
set(PLSSVM_ENABLE_KOKKOS_BACKEND AUTO CACHE STRING "Enable SYCL Backend")
set_property(CACHE PLSSVM_ENABLE_KOKKOS_BACKEND PROPERTY STRINGS AUTO ON OFF)
if (PLSSVM_ENABLE_KOKKOS_BACKEND MATCHES "AUTO" OR PLSSVM_ENABLE_KOKKOS_BACKEND)
add_subdirectory(src/plssvm/backends/Kokkos)
endif ()

## check if ANY backend is available/has been enabled
get_target_property(PLSSVM_LINKED_BACKENDS ${PLSSVM_ALL_LIBRARY_NAME} INTERFACE_LINK_LIBRARIES)
if (NOT PLSSVM_LINKED_BACKENDS)
Expand Down Expand Up @@ -642,7 +650,7 @@ if (PLSSVM_ENABLE_FORMATTING)
list(APPEND CMAKE_MESSAGE_INDENT "Formatting: ")

## install library to add a clang-format target
set(PLSSVM_format_VERSION 7021abbf066e2e577926731c3fa4141f456c5024)
set(PLSSVM_format_VERSION d22c36043bea6ef85f3eb68b823f50703bd1cc21)
find_package(format QUIET)
if (format_FOUND)
message(STATUS "Found package format.")
Expand Down Expand Up @@ -734,6 +742,10 @@ if (TARGET ${PLSSVM_SYCL_BACKEND_LIBRARY_NAME})
endforeach ()
list(APPEND PLSSVM_BACKEND_NAME_LIST "sycl")
endif ()
if (TARGET ${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME})
message(STATUS "${PLSSVM_KOKKOS_BACKEND_SUMMARY_STRING}")
list(APPEND PLSSVM_BACKEND_NAME_LIST "kokkos")
endif ()
message(STATUS "")

########################################################################################################################
Expand All @@ -758,8 +770,8 @@ message(STATUS "Generating manpage files.")
string(TIMESTAMP PLSSVM_CURRENT_BUILD_TIME "%d. %B %Y")
string(REPLACE ";" "|" PLSSVM_PLATFORM_NAME_LIST "${PLSSVM_PLATFORM_NAME_LIST}")
string(REPLACE ";" "|" PLSSVM_BACKEND_NAME_LIST "${PLSSVM_BACKEND_NAME_LIST}")
string(REPLACE ";" "|" PLSSVM_SYCL_BACKEND_NAME_LIST "${PLSSVM_SYCL_BACKEND_NAME_LIST}")
if (TARGET ${PLSSVM_SYCL_BACKEND_LIBRARY_NAME})
string(REPLACE ";" "|" PLSSVM_SYCL_BACKEND_NAME_LIST "${PLSSVM_SYCL_BACKEND_NAME_LIST}")
set(PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY "
.TP
.B --sycl_implementation_type
Expand All @@ -772,6 +784,15 @@ choose the kernel invocation type when using SYCL as backend: automatic|nd_range
")
endif ()
set(PLSSVM_SYCL_MANPAGE_ENTRY "${PLSSVM_SYCL_KERNEL_INVOCATION_TYPE_MANPAGE_ENTRY}${PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY}")
## assemble the Kokkos manpage entry
if (TARGET ${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME})
string(REPLACE ";" "|" PLSSVM_KOKKOS_BACKEND_AVAILABLE_EXECUTION_SPACES "${PLSSVM_KOKKOS_BACKEND_AVAILABLE_EXECUTION_SPACES}")
set(PLSSVM_KOKKOS_MANPAGE_ENTRY "
.TP
.B --kokkos_execution_space
choose the Kokkos execution space to be used in the Kokkos backend: automatic|${PLSSVM_KOKKOS_BACKEND_AVAILABLE_EXECUTION_SPACES} (default: automatic)
")
endif ()
## assemble the performance tracker manpage entry
if (PLSSVM_ENABLE_PERFORMANCE_TRACKING)
set(PLSSVM_PERFORMANCE_TRACKER_MANPAGE_ENTRY "
Expand All @@ -787,6 +808,7 @@ configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-train.1
@ONLY
)
# update manpage entry since plssvm-predict can't recognize the SYCL kernel invocation type
set(PLSSVM_SYCL_MANPAGE_ENTRY "${PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY}")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-predict.1.in
Expand Down Expand Up @@ -866,6 +888,7 @@ install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/plssvm/plssvmHPXTargets.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/plssvm/plssvmAdaptiveCppTargets.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/plssvm/plssvmDPCPPTargets.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/plssvm/plssvmKokkosTargets.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/plssvm/plssvmstdparTargets.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/plssvm/cmake
)
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"cmake/presets/opencl.json",
"cmake/presets/acpp.json",
"cmake/presets/dpcpp.json",
"cmake/presets/kokkos.json",
"cmake/presets/all.json"
]
}
79 changes: 52 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ The main highlights of our SVM implementations are:
- [HIP](https://github.com/ROCm-Developer-Tools/HIP)
- [OpenCL](https://www.khronos.org/opencl/)
- [SYCL](https://www.khronos.org/sycl/) (supported implementations are [DPC++](https://github.com/intel/llvm) and [AdaptiveCpp](https://github.com/AdaptiveCpp/AdaptiveCpp) (formerly known as hipSYCL); specifically the versions [sycl-nightly/20231201](https://github.com/intel/llvm/tree/sycl-nightly/20230110) and AdaptiveCpp release [v24.06.0](https://github.com/AdaptiveCpp/AdaptiveCpp/releases/tag/v23.10.0))
- [Kokkos](https://github.com/kokkos/kokkos) (all execution spaces supported except `OpenMPTarget` and `OpenACC`); specifically the version [4.5.00](https://github.com/kokkos/kokkos/releases/tag/4.5.00)
3. Six different kernel functions to be able to classify a large variety of different problems:
- linear: $\vec{u}^T$ $\cdot$ $\vec{v}$
- polynomial: $(\gamma$ $\cdot$ $\vec{u}^T$ $\cdot$ $\vec{v}$ $+$ $coef0)^{d}$
Expand Down Expand Up @@ -128,6 +129,10 @@ Additional dependencies for the SYCL backend:

- the code must be compiled with a SYCL capable compiler; currently supported are [DPC++](https://github.com/intel/llvm) and [AdaptiveCpp](https://github.com/AdaptiveCpp/AdaptiveCpp)

Additional dependencies for the Kokkos backend:

- a Kokkos installation with the respective execution spaces enabled; currently all execution spaces are supported except `OpenMPTarget` and `OpenACC`

Additional dependencies for the stdpar backend:

- the code must be compiled with a stdpar capable compiler; currently supported are [nvc++](https://developer.nvidia.com/hpc-sdk), [roc-stdpar](https://github.com/ROCm/roc-stdpar), [icpx](https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html), [AdaptiveCpp](https://github.com/AdaptiveCpp/AdaptiveCpp), and [GNU GCC](https://gcc.gnu.org/))
Expand Down Expand Up @@ -243,6 +248,11 @@ The `[optional_options]` can be one or multiple of:
- `AUTO`: check for the OpenMP backend but **do not** fail if not available
- `OFF`: do not check for the OpenMP backend

- `PLSSVM_ENABLE_HPX_BACKEND=ON|OFF|AUTO` (default: `AUTO`):
- `ON`: check for the HPX backend and fail if not available
- `AUTO`: check for the HPX backend but **do not** fail if not available
- `OFF`: do not check for the HPX backend

- `PLSSVM_ENABLE_STDPAR_BACKEND=ON|OFF|AUTO` (default: `AUTO`):
- `ON`: check for the stdpar backend and fail if not available
- `AUTO`: check for the stdpar backend but **do not** fail if not available
Expand All @@ -268,6 +278,11 @@ The `[optional_options]` can be one or multiple of:
- `AUTO`: check for the SYCL backend but **do not** fail if not available
- `OFF`: do not check for the SYCL backend

- `PLSSVM_ENABLE_KOKKOS_BACKEND=ON|OFF|AUTO` (default: `AUTO`):
- `ON`: check for the Kokkos backend and fail if not available
- `AUTO`: check for the Kokkos backend but **do not** fail if not available
- `OFF`: do not check for the Kokkos backend

**Attention:** at least one backend must be enabled and available!

- `PLSSVM_ENABLE_FAST_MATH=ON|OFF` (default depending on `CMAKE_BUILD_TYPE`: `ON` for Release or RelWithDebInfo, `OFF` otherwise): enable `fast-math` compiler flags for all backends
Expand Down Expand Up @@ -344,6 +359,10 @@ If more than one SYCL implementation is available the environment variables `PLS

- `PLSSVM_SYCL_BACKEND_PREFERRED_IMPLEMENTATION` (`dpcpp`|`adaptivecpp`): specify the preferred SYCL implementation if the `sycl_implementation_type` option is set to `automatic`; additional the specified SYCL implementation is used in the `plssvm::sycl` namespace, the other implementations are available in the `plssvm::dpcpp` and `plssvm::adaptivecpp` namespace respectively

If the Kokkos backend is available the following additional option is available (**note**: this option takes only effect if the Kokkos SYCL execution space is available):

- `PLSSVM_KOKKOS_BACKEND_INTEL_LLVM_ENABLE_AOT` (default: `ON`): enable Ahead-of-Time (AOT) compilation for the specified target platforms

If the stdpar backend is available, an additional options can be set.

- `PLSSVM_STDPAR_BACKEND_IMPLEMENTATION` (default: `AUTO`): explicitly specify the used stdpar implementation; must be one of: `AUTO`, `NVHPC`, `roc-stdpar`, `IntelLLVM`, `ACPP`, `GNU_TBB`.
Expand All @@ -363,24 +382,6 @@ Available configure presets:
"hpx" - HPX backend
"hpx_python" - HPX backend + Python bindings
"hpx_test" - HPX backend tests
"cuda" - CUDA backend
"cuda_python" - CUDA backend + Python bindings
"cuda_test" - CUDA backend tests
"hip" - HIP backend
"hip_python" - HIP backend + Python bindings
"hip_test" - HIP backend tests
"opencl" - OpenCL backend
"opencl_python" - OpenCL backend + Python bindings
"opencl_test" - OpenCL backend tests
"acpp" - AdaptiveCpp SYCL backend
"acpp_python" - AdaptiveCpp SYCL backend + Python bindings
"acpp_test" - AdaptiveCpp SYCL backend tests
"dpcpp" - DPC++/icpx SYCL backend
"dpcpp_python" - DPC++/icpx backend + Python bindings
"dpcpp_test" - DPC++/icpx backend tests
"all" - All available backends
"all_python" - All available backends + Python bindings
"all_test" - All available backends tests
"stdpar" - stdpar backend
"stdpar_python" - stdpar backend + Python bindings
"stdpar_test" - stdpar backend tests
Expand All @@ -399,6 +400,27 @@ Available configure presets:
"stdpar_intelllvm" - stdpar IntelLLVM (icpx) backend
"stdpar_intelllvm_python" - stdpar IntelLLVM (icpx) backend + Python bindings
"stdpar_intelllvm_test" - stdpar IntelLLVM (icpx) backend tests
"cuda" - CUDA backend
"cuda_python" - CUDA backend + Python bindings
"cuda_test" - CUDA backend tests
"hip" - HIP backend
"hip_python" - HIP backend + Python bindings
"hip_test" - HIP backend tests
"opencl" - OpenCL backend
"opencl_python" - OpenCL backend + Python bindings
"opencl_test" - OpenCL backend tests
"acpp" - AdaptiveCpp SYCL backend
"acpp_python" - AdaptiveCpp SYCL backend + Python bindings
"acpp_test" - AdaptiveCpp SYCL backend tests
"dpcpp" - DPC++/icpx SYCL backend
"dpcpp_python" - DPC++/icpx backend + Python bindings
"dpcpp_test" - DPC++/icpx backend tests
"kokkos" - Kokkos backend
"kokkos_python" - Kokkos backend + Python bindings
"kokkos_test" - Kokkos backend tests
"all" - All available backends
"all_python" - All available backends + Python bindings
"all_test" - All available backends tests
```

With these presets, building and testing, e.g., our CUDA backend is as simple as typing (in the PLSSVM root directory):
Expand Down Expand Up @@ -553,12 +575,14 @@ Usage:
-i, --max_iter arg set the maximum number of CG iterations (default: num_features)
-l, --solver arg choose the solver: automatic|cg_explicit|cg_implicit (default: automatic)
-a, --classification arg the classification strategy to use for multi-class classification: oaa|oao (default: oaa)
-b, --backend arg choose the backend: automatic|openmp|hpx|cuda|hip|opencl|sycl|stdpar (default: automatic)
-b, --backend arg choose the backend: automatic|openmp|hpx|cuda|hip|opencl|sycl|kokkos|stdpar (default: automatic)
-p, --target_platform arg choose the target platform: automatic|cpu|gpu_nvidia|gpu_amd|gpu_intel (default: automatic)
--sycl_kernel_invocation_type arg
choose the kernel invocation type when using SYCL as backend: automatic|nd_range (default: automatic)
--sycl_implementation_type arg
choose the SYCL implementation to be used in the SYCL backend: automatic|dpcpp|adaptivecpp (default: automatic)
--kokkos_execution_space arg
choose the Kokkos execution space to be used in the Kokkos backend: automatic|Cuda|OpenMP|Serial (default: automatic)
--performance_tracking arg
the output YAML file where the performance tracking results are written to; if not provided, the results are dumped to stderr
--use_strings_as_labels use strings as labels instead of plane numbers
Expand Down Expand Up @@ -594,10 +618,10 @@ Another example targeting NVIDIA GPUs using the SYCL backend looks like:

The `--backend=automatic` option works as follows:

- if the `gpu_nvidia` target is available, check for existing backends in order `cuda` 🠦 `hip` 🠦 `opencl` 🠦 `sycl` 🠦 `stdpar`
- otherwise, if the `gpu_amd` target is available, check for existing backends in order `hip` 🠦 `opencl` 🠦 `sycl` 🠦 `stdpar`
- otherwise, if the `gpu_intel` target is available, check for existing backends in order `sycl` 🠦 `opencl` 🠦 `stdpar`
- otherwise, if the `cpu` target is available, check for existing backends in order `sycl` 🠦 `opencl` 🠦 `openmp` 🠦 `hpx` 🠦 `stdpar`
- if the `gpu_nvidia` target is available, check for existing backends in order `cuda` 🠦 `hip` 🠦 `opencl` 🠦 `sycl` 🠦 `kokkos` 🠦 `stdpar`
- otherwise, if the `gpu_amd` target is available, check for existing backends in order `hip` 🠦 `opencl` 🠦 `sycl` 🠦 `kokkos` 🠦 `stdpar`
- otherwise, if the `gpu_intel` target is available, check for existing backends in order `sycl` 🠦 `opencl` 🠦 `kokkos` 🠦 `stdpar`
- otherwise, if the `cpu` target is available, check for existing backends in order `sycl` 🠦 `kokkos` 🠦 `opencl` 🠦 `openmp` 🠦 `hpx` 🠦 `stdpar`

Note that during CMake configuration it is guaranteed that at least one of the above combinations does exist.

Expand All @@ -609,11 +633,13 @@ The `--target_platform=automatic` option works for the different backends as fol
- `HIP`: always selects an AMD GPU (if no AMD GPU is available, throws an exception)
- `OpenCL`: tries to find available devices in the following order: NVIDIA GPUs 🠦 AMD GPUs 🠦 Intel GPUs 🠦 CPU
- `SYCL`: tries to find available devices in the following order: NVIDIA GPUs 🠦 AMD GPUs 🠦 Intel GPUs 🠦 CPU
- `Kokkos`: checks which execution spaces are available and which target platforms they support and then tries to find available devices in the following order: NVIDIA GPUs 🠦 AMD GPUs 🠦 Intel GPUs 🠦 CPU
- `stdpar`: target device must be selected at compile time (using `PLSSVM_TARGET_PLATFORMS`) or using environment variables at runtime

The `--sycl_kernel_invocation_type` and `--sycl_implementation_type` flags are only used if the `--backend` is `sycl`, otherwise a warning is emitted on `stderr`.
If the `--sycl_kernel_invocation_type` is `automatic`, the `nd_range` invocation type is currently always used.
If the `--sycl_implementation_type` is `automatic`, the used SYCL implementation is determined by the `PLSSVM_SYCL_BACKEND_PREFERRED_IMPLEMENTATION` CMake flag.
If the `--kokkos_execution_space` is `automatic`, uses the best fitting execution space based on the provided and/or available target platforms.

### Predicting using `plssvm-predict`

Expand All @@ -628,10 +654,12 @@ LS-SVM with multiple (GPU-)backends
Usage:
./plssvm-predict [OPTION...] test_file model_file [output_file]
-b, --backend arg choose the backend: automatic|openmp|cuda|hip|opencl|sycl|stdpar (default: automatic)
-b, --backend arg choose the backend: automatic|openmp|hpx|cuda|hip|opencl|sycl|kokkos|stdpar (default: automatic)
-p, --target_platform arg choose the target platform: automatic|cpu|gpu_nvidia|gpu_amd|gpu_intel (default: automatic)
--sycl_implementation_type arg
choose the SYCL implementation to be used in the SYCL backend: automatic|dpcpp|adaptivecpp (default: automatic)
--kokkos_execution_space arg
choose the Kokkos execution space to be used in the Kokkos backend: automatic|Cuda|OpenMP|Serial (default: automatic)
--performance_tracking arg
the output YAML file where the performance tracking results are written to; if not provided, the results are dumped to stderr
--use_strings_as_labels use strings as labels instead of plane numbers
Expand Down Expand Up @@ -777,9 +805,6 @@ Roughly the same can be achieved using our Python bindings with the following Py
import plssvm
from sklearn.metrics import classification_report

# correctly initialize and finalize environments
environment_guard = plssvm.environment.ScopeGuard()

try:
# create a new C-SVM parameter set, explicitly overriding the default kernel function
params = plssvm.Parameter(kernel_type=plssvm.KernelFunctionType.POLYNOMIAL)
Expand Down
4 changes: 3 additions & 1 deletion bindings/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ set(PLSSVM_PYTHON_BINDINGS_SOURCES
${CMAKE_CURRENT_LIST_DIR}/classification_types.cpp
${CMAKE_CURRENT_LIST_DIR}/csvm.cpp
${CMAKE_CURRENT_LIST_DIR}/data_set.cpp
${CMAKE_CURRENT_LIST_DIR}/environment.cpp
${CMAKE_CURRENT_LIST_DIR}/file_format_types.cpp
${CMAKE_CURRENT_LIST_DIR}/gamma.cpp
${CMAKE_CURRENT_LIST_DIR}/kernel_function_types.cpp
Expand Down Expand Up @@ -98,6 +97,9 @@ endif ()
if (TARGET ${PLSSVM_SYCL_BACKEND_DPCPP_LIBRARY_NAME})
list(APPEND PLSSVM_PYTHON_BINDINGS_SOURCES ${CMAKE_CURRENT_LIST_DIR}/backends/dpcpp_csvm.cpp)
endif ()
if (TARGET ${PLSSVM_KOKKOS_BACKEND_LIBRARY_NAME})
list(APPEND PLSSVM_PYTHON_BINDINGS_SOURCES ${CMAKE_CURRENT_LIST_DIR}/backends/kokkos_csvm.cpp)
endif ()

# create pybind11 module
set(PLSSVM_PYTHON_BINDINGS_LIBRARY_NAME plssvm)
Expand Down
Loading
Loading