ICP  1.1.0
 Hosted by GitHub
Public Types | Public Member Functions | Public Attributes | List of all members
cl_algo::ICP::ICPDevs Class Reference

Interface class for the icpSubtractMean kernel. More...

#include <algorithms.hpp>

Public Types

enum  Memory : uint8_t {
  Memory::H_IN_F, Memory::H_IN_M, Memory::H_IN_MEAN, Memory::H_OUT_DEV_F,
  Memory::H_OUT_DEV_M, Memory::D_IN_F, Memory::D_IN_M, Memory::D_IN_MEAN,
  Memory::D_OUT_DEV_F, Memory::D_OUT_DEV_M
}
 Enumerates the memory objects handled by the class. More...
 

Public Member Functions

 ICPDevs (clutils::CLEnv &_env, clutils::CLEnvInfo< 1 > _info)
 Configures an OpenCL environment as specified by _info. More...
 
cl::Memory & get (ICPDevs::Memory mem)
 Returns a reference to an internal memory object. More...
 
void init (unsigned int _n, Staging _staging=Staging::IO)
 Configures kernel execution parameters. More...
 
void write (ICPDevs::Memory mem=ICPDevs::Memory::D_IN_F, void *ptr=nullptr, bool block=CL_FALSE, const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
 Performs a data transfer to a device buffer. More...
 
void * read (ICPDevs::Memory mem=ICPDevs::Memory::H_OUT_DEV_F, bool block=CL_TRUE, const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
 Performs a data transfer to a staging buffer. More...
 
void run (const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
 Executes the necessary kernels. More...
 
template<typename period >
double run (clutils::GPUTimer< period > &timer, const std::vector< cl::Event > *events=nullptr)
 Executes the necessary kernels. More...
 

Public Attributes

cl_float * hPtrInF
 
cl_float * hPtrInM
 
cl_float * hPtrInMean
 
cl_float * hPtrOutDevF
 
cl_float * hPtrOutDevM
 

Detailed Description

Interface class for the icpSubtractMean kernel.

icpSubtractMean subtracts the mean of a set of points from the points themselves to get their deviations from that mean. For more details, look at the kernel's documentation.

Note
The icpSubtractMean kernel is available in kernels/icp_kernels.cl.
The class creates its own buffers. If you would like to provide your own buffers, call get to get references to the placeholders within the class and assign them to your buffers. You will have to do this strictly before the call to init. You can also call get (after the call to init) to get a reference to a buffer within the class and assign it to another kernel class instance further down in your task pipeline.

The following input/output OpenCL memory objects are created by a ICPDevs instance:

Name Type Placement I/O Use Properties Size
H_IN_F Buffer Host I Staging CL_MEM_READ_WRITE \(n*sizeof\ (cl\_float8)\)
H_IN_M Buffer Host I Staging CL_MEM_READ_WRITE \(n*sizeof\ (cl\_float8)\)
H_IN_MEAN Buffer Host I Staging CL_MEM_READ_WRITE \(2*sizeof\ (cl\_float4)\)
H_OUT_DEV_F Buffer Host O Staging CL_MEM_READ_WRITE \(n*sizeof\ (cl\_float4)\)
H_OUT_DEV_M Buffer Host O Staging CL_MEM_READ_WRITE \(n*sizeof\ (cl\_float4)\)
D_IN_F Buffer Device I Processing CL_MEM_READ_ONLY \(n*sizeof\ (cl\_float8)\)
D_IN_M Buffer Device I Processing CL_MEM_READ_ONLY \(n*sizeof\ (cl\_float8)\)
D_IN_MEAN Buffer Device I Processing CL_MEM_READ_ONLY \(2*sizeof\ (cl\_float4)\)
D_OUT_DEV_F Buffer Device O Processing CL_MEM_WRITE_ONLY \(n*sizeof\ (cl\_float4)\)
D_OUT_DEV_M Buffer Device O Processing CL_MEM_WRITE_ONLY \(n*sizeof\ (cl\_float4)\)

Member Enumeration Documentation

enum cl_algo::ICP::ICPDevs::Memory : uint8_t
strong

Enumerates the memory objects handled by the class.

Note
H_* names refer to staging buffers on the host.
D_* names refer to buffers on the device.
Enumerator
H_IN_F 

Input staging buffer for the fixed set.

H_IN_M 

Input staging buffer for the moving set.

H_IN_MEAN 

Input staging buffer for the fixed and moving set means.

H_OUT_DEV_F 

Output staging buffer for the deviations of the fixed set.

H_OUT_DEV_M 

Output staging buffer for the deviations of the moving set.

D_IN_F 

Input buffer for the fixed set.

D_IN_M 

Input buffer for the moving set.

D_IN_MEAN 

Input buffer for the fixed and moving set means.

D_OUT_DEV_F 

Output buffer for the deviations of the fixed set.

D_OUT_DEV_M 

Output buffer for the deviations of the moving set.

Constructor & Destructor Documentation

cl_algo::ICP::ICPDevs::ICPDevs ( clutils::CLEnv &  _env,
clutils::CLEnvInfo< 1 >  _info 
)

Configures an OpenCL environment as specified by _info.

Parameters
[in]_envopencl environment.
[in]_infoopencl configuration. It specifies the context, queue, etc, to be used.

Member Function Documentation

cl::Memory & cl_algo::ICP::ICPDevs::get ( ICPDevs::Memory  mem)

Returns a reference to an internal memory object.

This interface exists to allow CL memory sharing between different kernels.

Parameters
[in]memenumeration value specifying the requested memory object.
Returns
A reference to the requested memory object.
void cl_algo::ICP::ICPDevs::init ( unsigned int  _n,
Staging  _staging = Staging::IO 
)

Configures kernel execution parameters.

Sets up memory objects as necessary, and defines the kernel workspaces.

Note
If you have assigned a memory object to one member variable of the class before the call to init, then that memory will be maintained. Otherwise, a new memory object will be created.
Parameters
[in]_nnumber of points.
[in]_stagingflag to indicate whether or not to instantiate the staging buffers.
void * cl_algo::ICP::ICPDevs::read ( ICPDevs::Memory  mem = ICPDevs::Memory::H_OUT_DEV_F,
bool  block = CL_TRUE,
const std::vector< cl::Event > *  events = nullptr,
cl::Event *  event = nullptr 
)

Performs a data transfer to a staging buffer.

The transfer happens from a device buffer to the associated (specified) staging buffer on the host.

Parameters
[in]memenumeration value specifying an output staging buffer.
[in]blocka flag to indicate whether to perform a blocking or a non-blocking operation.
[in]eventsa wait-list of events.
[out]eventevent associated with the read operation to the staging buffer.
void cl_algo::ICP::ICPDevs::run ( const std::vector< cl::Event > *  events = nullptr,
cl::Event *  event = nullptr 
)

Executes the necessary kernels.

The function call is non-blocking.

Parameters
[in]eventsa wait-list of events.
[out]eventevent associated with the last kernel execution.
template<typename period >
double cl_algo::ICP::ICPDevs::run ( clutils::GPUTimer< period > &  timer,
const std::vector< cl::Event > *  events = nullptr 
)
inline

Executes the necessary kernels.

This run instance is used for profiling.

Parameters
[in]timerGPUTimer that does the profiling of the kernel executions.
[in]eventsa wait-list of events.
Returns
Τhe total execution time measured by the timer.
void cl_algo::ICP::ICPDevs::write ( ICPDevs::Memory  mem = ICPDevs::Memory::D_IN_F,
void *  ptr = nullptr,
bool  block = CL_FALSE,
const std::vector< cl::Event > *  events = nullptr,
cl::Event *  event = nullptr 
)

Performs a data transfer to a device buffer.

The transfer happens from a staging buffer on the host to the associated (specified) device buffer.

Parameters
[in]memenumeration value specifying an input device buffer.
[in]ptra pointer to an array holding input data. If not NULL, the data from ptr will be copied to the associated staging buffer.
[in]blocka flag to indicate whether to perform a blocking or a non-blocking operation.
[in]eventsa wait-list of events.
[out]eventevent associated with the write operation to the device buffer.

Member Data Documentation

cl_float* cl_algo::ICP::ICPDevs::hPtrInF

Mapping of the input staging buffer for the fixed set.

cl_float* cl_algo::ICP::ICPDevs::hPtrInM

Mapping of the input staging buffer for the moving set.

cl_float* cl_algo::ICP::ICPDevs::hPtrInMean

Mapping of the input staging buffer for the mean.

cl_float* cl_algo::ICP::ICPDevs::hPtrOutDevF

Mapping of the output staging buffer for the deviations of the fixed set.

cl_float* cl_algo::ICP::ICPDevs::hPtrOutDevM

Mapping of the output staging buffer for the deviations of the moving set.


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