Interface class for calculating the S matrix and the s scale factor constituents, while considering weighted residual errors. More...
#include <algorithms.hpp>
Public Types | |
| enum | Memory : uint8_t { Memory::H_IN_DEV_M, Memory::H_IN_DEV_F, Memory::H_IN_W, Memory::H_OUT, Memory::D_IN_DEV_M, Memory::D_IN_DEV_F, Memory::D_IN_W, Memory::D_SIJ, Memory::D_OUT } |
| Enumerates the memory objects handled by the class. More... | |
Public Member Functions | |
| ICPS (clutils::CLEnv &_env, clutils::CLEnvInfo< 1 > _info) | |
Configures an OpenCL environment as specified by _info. More... | |
| cl::Memory & | get (ICPS::Memory mem) |
| Returns a reference to an internal memory object. More... | |
| void | init (unsigned int _m, float _c, Staging _staging=Staging::IO) |
| Configures kernel execution parameters. More... | |
| void | write (ICPS::Memory mem=ICPS::Memory::D_IN_DEV_M, 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 (ICPS::Memory mem=ICPS::Memory::H_OUT, 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... | |
| float | getScaling () |
| Gets the scaling factor c. More... | |
| void | setScaling (float _c) |
| Sets the scaling factor c. 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 * | hPtrInDevM |
| cl_float * | hPtrInDevF |
| cl_float * | hPtrInW |
| cl_float * | hPtrOut |
Interface class for calculating the S matrix and the s scale factor constituents, while considering weighted residual errors.
The class uses the icpSiProducts kernel to produce the products of deviations and then reduces them with the reduce_sum kernel. For more details, look at the kernels' documentation.
icpSiProducts kernel is available in kernels/icp_kernels.cl, and the reduce_sum kernel is available in kernels/reduce_kernels.cl. 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 ICPS instance:
| Name | Type | Placement | I/O | Use | Properties | Size |
|---|---|---|---|---|---|---|
| H_IN_DEV_M | Buffer | Host | I | Staging | CL_MEM_READ_WRITE | \(m*sizeof\ (cl\_float4)\) |
| H_IN_DEV_F | Buffer | Host | I | Staging | CL_MEM_READ_WRITE | \(m*sizeof\ (cl\_float4)\) |
| H_IN_W | Buffer | Host | I | Staging | CL_MEM_READ_WRITE | \(m*sizeof\ (cl\_float) \) |
| H_OUT | Buffer | Host | O | Staging | CL_MEM_READ_WRITE | \(11*sizeof\ (cl\_float)\) |
| D_IN_DEV_M | Buffer | Device | I | Processing | CL_MEM_READ_ONLY | \(m*sizeof\ (cl\_float4)\) |
| D_IN_DEV_F | Buffer | Device | I | Processing | CL_MEM_READ_ONLY | \(m*sizeof\ (cl\_float4)\) |
| D_IN_W | Buffer | Device | I | Processing | CL_MEM_READ_ONLY | \(m*sizeof\ (cl\_float) \) |
| D_OUT | Buffer | Device | O | Processing | CL_MEM_WRITE_ONLY | \(11*sizeof\ (cl\_float)\) |
|
strong |
Enumerates the memory objects handled by the class.
H_* names refer to staging buffers on the host. D_* names refer to buffers on the device. | cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::ICPS | ( | clutils::CLEnv & | _env, |
| clutils::CLEnvInfo< 1 > | _info | ||
| ) |
Configures an OpenCL environment as specified by _info.
| [in] | _env | opencl environment. |
| [in] | _info | opencl configuration. It specifies the context, queue, etc, to be used. |
| cl::Memory & cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::get | ( | ICPS< ICPSConfig::WEIGHTED >::Memory | mem | ) |
Returns a reference to an internal memory object.
This interface exists to allow CL memory sharing between different kernels.
| [in] | mem | enumeration value specifying the requested memory object. |
| float cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::getScaling | ( | ) |
Gets the scaling factor c.
| void cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::init | ( | unsigned int | _m, |
| float | _c, | ||
| Staging | _staging = Staging::IO |
||
| ) |
Configures kernel execution parameters.
Sets up memory objects as necessary, and defines the kernel workspaces.
init, then that memory will be maintained. Otherwise, a new memory object will be created.| [in] | _m | number of points in the sets. |
| [in] | _c | scaling factor for dealing with floating point arithmetic issues. |
| [in] | _staging | flag to indicate whether or not to instantiate the staging buffers. |
| void * cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::read | ( | ICPS< ICPSConfig::WEIGHTED >::Memory | mem = ICPS< ICPSConfig::WEIGHTED >::Memory::H_OUT, |
| 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.
| [in] | mem | enumeration value specifying an output staging buffer. |
| [in] | block | a flag to indicate whether to perform a blocking or a non-blocking operation. |
| [in] | events | a wait-list of events. |
| [out] | event | event associated with the read operation to the staging buffer. |
| void cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::run | ( | const std::vector< cl::Event > * | events = nullptr, |
| cl::Event * | event = nullptr |
||
| ) |
Executes the necessary kernels.
The function call is non-blocking.
| [in] | events | a wait-list of events. |
| [out] | event | event associated with the last kernel execution. |
|
inline |
Executes the necessary kernels.
This run instance is used for profiling.
| [in] | timer | GPUTimer that does the profiling of the kernel executions. |
| [in] | events | a wait-list of events. |
| void cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::setScaling | ( | float | _c | ) |
Sets the scaling factor c.
Updates the kernel argument for the scaling factor c.
| [in] | _c | scaling factor. |
| void cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::write | ( | ICPS< ICPSConfig::WEIGHTED >::Memory | mem = ICPS< ICPSConfig::WEIGHTED >::Memory::D_IN_DEV_M, |
| 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.
| [in] | mem | enumeration value specifying an input device buffer. |
| [in] | ptr | a pointer to an array holding input data. If not NULL, the data from ptr will be copied to the associated staging buffer. |
| [in] | block | a flag to indicate whether to perform a blocking or a non-blocking operation. |
| [in] | events | a wait-list of events. |
| [out] | event | event associated with the write operation to the device buffer. |
| cl_float* cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::hPtrInDevF |
Mapping of the input staging buffer for the deviations of the fixed set.
| cl_float* cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::hPtrInDevM |
Mapping of the input staging buffer for the deviations of the moving set.
| cl_float* cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::hPtrInW |
Mapping of the input staging buffer for the weights.
| cl_float* cl_algo::ICP::ICPS< ICPSConfig::WEIGHTED >::hPtrOut |
Mapping of the output staging buffer with the S matrix and scale factor s.
1.8.9.1