PLSSVM - Parallel Least Squares Support Vector Machine  2.0.0
A Least Squares Support Vector Machine implementation using different backends.
Public Member Functions | Public Attributes | List of all members
plssvm::opencl::detail::command_queue Class Reference

RAII wrapper class around a cl_command_queue. More...

#include <command_queue.hpp>

Public Member Functions

 command_queue ()=default
 Empty default construct a command queue.
 
 command_queue (cl_context context, cl_device_id device)
 Construct a command queue with the provided information. More...
 
 command_queue (const command_queue &)=delete
 Delete copy-constructor to make command_queue a move only type.
 
 command_queue (command_queue &&other) noexcept
 Move-constructor as command_queue is a move-only type. More...
 
command_queueoperator= (const command_queue &)=delete
 Delete copy-assignment-operator to make command_queue a move only type.
 
command_queueoperator= (command_queue &&other) noexcept
 Move-assignment-operator as command_queue is a move-only type. More...
 
 ~command_queue ()
 Release the cl_command_queue resources on destruction.
 
 operator cl_command_queue & () noexcept
 Implicitly convert a command_queue wrapper to an OpenCL cl_command_queue. More...
 
 operator const cl_command_queue & () const noexcept
 Implicitly convert a command_queue wrapper to an OpenCL cl_command_queue. More...
 
template<typename real_type >
void add_kernel (compute_kernel_name name, kernel &&compute_kernel)
 Add a new OpenCL compute_kernel used for name to this command queue. More...
 
template<typename real_type >
const kernelget_kernel (compute_kernel_name name) const
 Get the OpenCL kernel used for name. More...
 

Public Attributes

cl_command_queue queue {}
 The wrapped cl_command_queue.
 
std::map< compute_kernel_name, kernelfloat_kernels {}
 All OpenCL device kernel associated with the device corresponding to this command queue using float as real_type.
 
std::map< compute_kernel_name, kerneldouble_kernels {}
 All OpenCL device kernel associated with the device corresponding to this command queue using double as real_type.
 

Detailed Description

RAII wrapper class around a cl_command_queue.

Also contains the compiled kernels associated with the command queue.

Constructor & Destructor Documentation

◆ command_queue() [1/2]

plssvm::opencl::detail::command_queue::command_queue ( cl_context  context,
cl_device_id  device 
)

Construct a command queue with the provided information.

Parameters
[in]contextthe associated OpenCL cl_context
[in]devicethe associated OpenCL cl_device_id

◆ command_queue() [2/2]

plssvm::opencl::detail::command_queue::command_queue ( command_queue &&  other)
noexcept

Move-constructor as command_queue is a move-only type.

Parameters
[in,out]otherthe command_queue to move the resources from

Member Function Documentation

◆ operator=()

command_queue& plssvm::opencl::detail::command_queue::operator= ( command_queue &&  other)
noexcept

Move-assignment-operator as command_queue is a move-only type.

Parameters
[in,out]otherthe command_queue to move the resources from
Returns
*this

◆ operator cl_command_queue &()

plssvm::opencl::detail::command_queue::operator cl_command_queue & ( )
inlinenoexcept

Implicitly convert a command_queue wrapper to an OpenCL cl_command_queue.

Returns
the wrapped OpenCL cl_command_queue ([[nodiscard]])

◆ operator const cl_command_queue &()

plssvm::opencl::detail::command_queue::operator const cl_command_queue & ( ) const
inlinenoexcept

Implicitly convert a command_queue wrapper to an OpenCL cl_command_queue.

Returns
the wrapped OpenCL cl_command_queue ([[nodiscard]])

◆ add_kernel()

template<typename real_type >
void plssvm::opencl::detail::command_queue::add_kernel ( compute_kernel_name  name,
kernel &&  compute_kernel 
)

Add a new OpenCL compute_kernel used for name to this command queue.

Template Parameters
real_typethe floating point type used as type in the kernel (either float or double)
Parameters
[in]namethe name of the kernel that is to be added
[in]compute_kernelthe kernel to add

◆ get_kernel()

template<typename real_type >
const kernel& plssvm::opencl::detail::command_queue::get_kernel ( compute_kernel_name  name) const

Get the OpenCL kernel used for name.

Template Parameters
real_typethe floating point type used as type in the kernel (either float or double)
Parameters
[in]namethe name of the kernel
Exceptions
std::out_of_rangeif a kernel with name is requested that has not been compiled for this command queue
Returns
the compiled kernel ([[nodiscard]])

The documentation for this class was generated from the following file: