Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into spack
Browse files Browse the repository at this point in the history
  • Loading branch information
vancraar committed Nov 6, 2024
2 parents 63b7f5b + 0d3387c commit 2ee620e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
44 changes: 24 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,30 @@ if (PLSSVM_ENABLE_STL_DEBUG_MODE)
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC ${PLSSVM_STL_DEBUG_MODE_FLAGS})
endif ()

########################################################################################################################
## check for OpenMP (not for the backend!) ##
########################################################################################################################
find_package(OpenMP 4.0 QUIET)
if (OpenMP_FOUND)
message(STATUS "Found OpenMP ${OpenMP_CXX_VERSION} to speed-up library utilities (like file parsing).")
set(PLSSVM_FOUND_OPENMP_FOR_UTILITY ON)
if (${CMAKE_CXX_COMPILER_ID} MATCHES "IntelLLVM")
target_link_libraries(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC -fopenmp)
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
target_compile_options(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC -openmp:llvm -openmp:experimental)
else ()
target_link_libraries(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC OpenMP::OpenMP_CXX)
endif ()
else ()
# disable warning for unknown OpenMP pragmas if no OpenMP could be found
target_compile_options(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC
$<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang>:-Wno-unknown-pragmas>
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/wd4068>
)
# issue warning that multi-GPU execution will be serialized
message(WARNING "Couldn't find OpenMP. Note that in a multi-GPU setting this will result in serialized kernel calls across all GPUs!")
endif ()

########################################################################################################################
## create executables ##
########################################################################################################################
Expand Down Expand Up @@ -442,26 +466,6 @@ endif ()
########################################################################################################################
## check for optional and necessary dependencies ##
########################################################################################################################
# check for OpenMP (not for the backend!)
find_package(OpenMP 4.0 QUIET)
if (OpenMP_FOUND)
message(STATUS "Found OpenMP ${OpenMP_CXX_VERSION} to speed-up library utilities (like file parsing).")
set(PLSSVM_FOUND_OPENMP_FOR_UTILITY ON)
if (${CMAKE_CXX_COMPILER_ID} MATCHES "IntelLLVM")
target_link_libraries(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC -fopenmp)
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
target_compile_options(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC -openmp:llvm -openmp:experimental)
else ()
target_link_libraries(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC OpenMP::OpenMP_CXX)
endif ()
else ()
# disable warning for unknown OpenMP pragmas if no OpenMP could be found
target_compile_options(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC
$<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang>:-Wno-unknown-pragmas>
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/wd4068>
)
endif ()

## setup dependencies
include(FetchContent)
list(APPEND CMAKE_MESSAGE_INDENT "Dependencies: ")
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ The main highlights of our SVM implementations are:
- [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))
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}$
- radial basis function (rbf): $\exp(-\gamma \cdot |\vec{u} - \vec{v}|^2)$
- sigmoid: $\tanh(\gamma \cdot \vec{u}^T \cdot \vec{v} + coef0)$
- laplacian: $\exp(-\gamma \cdot |\vec{u} - \vec{v}|_1)$
- linear: $\vec{u}^T$ $\cdot$ $\vec{v}$
- polynomial: $(\gamma$ $\cdot$ $\vec{u}^T$ $\cdot$ $\vec{v}$ $+$ $coef0)^{d}$
- radial basis function (rbf): $\exp(-\gamma$ $\cdot |$ $\vec{u}$ $-$ $\vec{v}$ $|_2^2)$
- sigmoid: $\tanh(\gamma$ $\cdot$ $\vec{u}^T$ $\cdot$ $\vec{v}$ $+$ $coef0)$
- laplacian: $\exp(-\gamma$ $\cdot |$ $\vec{u}$ $-$ $\vec{v}$ $|_1)$
- chi-squared (only well-defined for values > 0): $\exp(-\gamma \cdot \sum_i \frac{(x[i] - y[i])^2}{x[i] + y[i]})$
4. Two different solver types for a trade-off between memory footprint and runtime:
- `cg_explicit`: large memory overhead but very fast
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace plssvm::sycl::detail {
/**
* @brief Create the explicit kernel matrix using the @p kernel_function.
* @tparam kernel_function the type of the used kernel function
* @tparam Args the types of the parameters necessary for the specific kernel function; stored in a `standard_layout_tuple`
* @tparam Args the types of the parameters necessary for the specific kernel function; stored in a `std::tuple`
*/
template <kernel_function_type kernel_function, typename... Args>
class device_kernel_assembly {
Expand Down
2 changes: 1 addition & 1 deletion include/plssvm/backends/SYCL/kernel/predict_kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class device_kernel_predict_linear {
/**
* @brief Predict the @p predict_points_d using the @p kernel_function.
* @tparam kernel_function the type of the used kernel function
* @tparam Args the types of the parameters necessary for the specific kernel function
* @tparam Args the types of the parameters necessary for the specific kernel function; stored in a `std::tuple`
*/
template <kernel_function_type kernel_function, typename... Args>
class device_kernel_predict {
Expand Down

0 comments on commit 2ee620e

Please sign in to comment.