GCVL
Multi-platform (Windows, Unix and Mac OS) C++/OpenCL/CUDA library with several Computer Vision algorithms.
OpenCL_Kernel Class Reference

#include <oclutils.h>

List of all members.

Public Member Functions

 OpenCL_Kernel ()
 Default constructor.
 OpenCL_Kernel (std::string _filename, const cl_context &_context, const cl_device_id &_device_id)
 Creates an OpenCL kernel object.
 ~OpenCL_Kernel ()
 Class destructor.
void Initialize (std::string _filename, const cl_context &_context, const cl_device_id &_device_id)
 Initializes the kernel object parameters.
void Build (std::string _kernel_name)
 Creates an OpenCL kernel with the provided kernel file or source.
void Compute_Work_Size (size_t _global_x, size_t _global_y, size_t _local_x, size_t _local_y)
 Sets the desired OpenCL global and local sizes. Checks if work sizes are valid if not, tries to guess the correct ones.
const cl_kernel & Get_Kernel () const
 Obtains the associated OpenCL kernel.
size_t * Get_Global_Work_Size () const
 Obtains the global work sizes.
size_t * Get_Local_Work_Size () const
 Obtains the local work sizes.
int Get_Dimension () const
 Obtains the kernel dimensions.
void Append_Compiler_Option (const std::string option)
 Appends a certain kernel compiler option.
void Launch (const cl_command_queue &command_queue)
 Launch kernel in a certain OpenCL command queue.

Static Public Member Functions

static int Get_Multiple (int n, int base)
 Obtains a multiple of a certain number.

Constructor & Destructor Documentation

Default constructor.

OpenCL_Kernel::OpenCL_Kernel ( std::string  _filename,
const cl_context &  _context,
const cl_device_id &  _device_id 
)

Creates an OpenCL kernel object.

Parameters:
_filenamekernel file name or source code.
_contextOpenCL context in which the kernel will be launched.
_device_idOpenCL device id in which the kernel will be launched.

Class destructor.

See also:
OpenCL_Kernel()

Member Function Documentation

void OpenCL_Kernel::Append_Compiler_Option ( const std::string  option)

Appends a certain kernel compiler option.

Parameters:
optiondesired kernel compiler option.
void OpenCL_Kernel::Build ( std::string  _kernel_name)

Creates an OpenCL kernel with the provided kernel file or source.

Parameters:
_kernel_nameOpenCL kernel name.
void OpenCL_Kernel::Compute_Work_Size ( size_t  _global_x,
size_t  _global_y,
size_t  _local_x,
size_t  _local_y 
)

Sets the desired OpenCL global and local sizes. Checks if work sizes are valid if not, tries to guess the correct ones.

Parameters:
_global_xglobal size of the first dimension.
_global_yglobal size of the second dimension.
_local_xlocal size of the first dimension.
_local_ylocal size of the second dimension.

Obtains the kernel dimensions.

Returns:
kernel dimensions.

Obtains the global work sizes.

Returns:
gobal work sizes.
const cl_kernel & OpenCL_Kernel::Get_Kernel ( ) const

Obtains the associated OpenCL kernel.

Returns:
OpenCL kernel.

Obtains the local work sizes.

Returns:
local work sizes.
int OpenCL_Kernel::Get_Multiple ( int  n,
int  base 
) [static]

Obtains a multiple of a certain number.

Parameters:
nnumber of which we want to compute the multiple.
basebase number of which the result will be a multiple.
Returns:
multiple.
void OpenCL_Kernel::Initialize ( std::string  _filename,
const cl_context &  _context,
const cl_device_id &  _device_id 
)

Initializes the kernel object parameters.

Parameters:
_filenamekernel file name or source code.
_contextOpenCL context in which the kernel will be launched.
_device_idOpenCL device id in which the kernel will be launched.
void OpenCL_Kernel::Launch ( const cl_command_queue &  command_queue)

Launch kernel in a certain OpenCL command queue.

Parameters:
command_queueOpenCL command queue.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Defines