PLSSVM - Parallel Least Squares Support Vector Machine  2.0.0
A Least Squares Support Vector Machine implementation using different backends.
kernel.hpp
Go to the documentation of this file.
1 
12 #ifndef PLSSVM_BACKENDS_OPENCL_DETAIL_KERNEL_HPP_
13 #define PLSSVM_BACKENDS_OPENCL_DETAIL_KERNEL_HPP_
14 #pragma once
15 
16 #include "CL/cl.h" // cl_kernel
17 
18 namespace plssvm::opencl::detail {
19 
24 enum class compute_kernel_name {
26  q_kernel,
28  svm_kernel,
30  w_kernel,
33 };
34 
38 class kernel {
39  public:
43  kernel() = default;
48  explicit kernel(cl_kernel compute_kernel) noexcept;
49 
53  kernel(const kernel &) = delete;
58  kernel(kernel &&other) noexcept;
62  kernel &operator=(const kernel &) = delete;
68  kernel &operator=(kernel &&other) noexcept;
69 
74 
79  [[nodiscard]] operator cl_kernel &() noexcept { return compute_kernel; }
84  [[nodiscard]] operator const cl_kernel &() const noexcept { return compute_kernel; }
85 
87  cl_kernel compute_kernel;
88 };
89 
90 } // namespace plssvm::opencl::detail
91 
92 #endif // PLSSVM_BACKENDS_OPENCL_DETAIL_KERNEL_HPP_
RAII wrapper class around a cl_kernel.
Definition: kernel.hpp:38
kernel & operator=(const kernel &)=delete
Delete copy-assignment-operator to make kernel a move only type.
kernel & operator=(kernel &&other) noexcept
Move-assignment-operator as kernel is a move-only type.
kernel(kernel &&other) noexcept
Move-constructor as kernel is a move-only type.
kernel(const kernel &)=delete
Delete copy-constructor to make kernel a move only type.
cl_kernel compute_kernel
The wrapped OpenCL cl_kernel.
Definition: kernel.hpp:87
kernel()=default
Default construct empty kernel.
~kernel()
Release the cl_kernel resources on destruction.
kernel(cl_kernel compute_kernel) noexcept
Construct a new wrapper around the provided compute_kernel.
Namespace containing OpenCL backend specific implementation details. Should not directly be used by u...
Definition: command_queue.hpp:22
compute_kernel_name
Enum class for all different OpenCL compute kernels.
Definition: kernel.hpp:24
@ w_kernel
The predict kernel for the linear kernel function.
@ q_kernel
The kernels to generate the q vector.
@ predict_kernel
The predict kernels for the polynomial and rbf kernel functions.