Interface class for the splitPC8D kernel.
More...
#include <algorithms.hpp>
Public Types | |
| enum | Memory : uint8_t { Memory::H_IN, Memory::H_OUT_PC4D, Memory::H_OUT_RGBA, Memory::D_IN, Memory::D_OUT_PC4D, Memory::D_OUT_RGBA } |
| Enumerates the memory objects handled by the class. More... | |
Public Member Functions | |
| SplitPC8D (clutils::CLEnv &_env, clutils::CLEnvInfo< 1 > _info) | |
Configures an OpenCL environment as specified by _info. More... | |
| cl::Memory & | get (SplitPC8D::Memory mem) |
| Returns a reference to an internal memory object. More... | |
| void | init (unsigned int _n, unsigned int _offset=0, Staging _staging=Staging::IO) |
| Configures kernel execution parameters. More... | |
| void | write (SplitPC8D::Memory mem=SplitPC8D::Memory::D_IN, 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 (SplitPC8D::Memory mem=SplitPC8D::Memory::H_OUT_PC4D, 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... | |
| unsigned int | getOffset () |
| Gets the offset. More... | |
| void | setOffset (unsigned int _offset) |
| Sets the offset. 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 * | hPtrIn |
| cl_float * | hPtrOutPC4D |
| cl_float * | hPtrOutRGBA |
Interface class for the splitPC8D kernel.
splitPC8D splits an 8-D point cloud into 4-D geometry points and RGBA color points. For more details, look at the kernel's documentation.
splitPC8D kernel is available in kernels/imageSupport_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 SplitPC8D instance:
| Name | Type | Placement | I/O | Use | Properties | Size |
|---|---|---|---|---|---|---|
| H_IN | Buffer | Host | I | Staging | CL_MEM_READ_WRITE | \(width*height*sizeof\ (cl\_float8)\) |
| H_OUT_PC4D | Buffer | Host | O | Staging | CL_MEM_READ_WRITE | \(width*height*sizeof\ (cl\_float4)\) |
| H_OUT_RGBA | Buffer | Host | O | Staging | CL_MEM_READ_WRITE | \(width*height*sizeof\ (cl\_float4)\) |
| D_IN | Buffer | Device | I | Processing | CL_MEM_READ_ONLY | \(width*height*sizeof\ (cl\_float8)\) |
| D_OUT_PC4D | Buffer | Device | O | Processing | CL_MEM_WRITE_ONLY | \(width*height*sizeof\ (cl\_float4)\) |
| D_OUT_RGBA | Buffer | Device | O | Processing | CL_MEM_WRITE_ONLY | \(width*height*sizeof\ (cl\_float4)\) |
|
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::GF::SplitPC8D::SplitPC8D | ( | clutils::CLEnv & | _env, |
| clutils::CLEnvInfo< 1 > | _info | ||
| ) |
Configures an OpenCL environment as specified by _info.
| [in] | _env | opencl environment. |
| [in] | _info | opencl configuration. Specifies the context, queue, etc, to be used. |
| cl::Memory & cl_algo::GF::SplitPC8D::get | ( | SplitPC8D::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. |
| unsigned int cl_algo::GF::SplitPC8D::getOffset | ( | ) |
Gets the offset.
| void cl_algo::GF::SplitPC8D::init | ( | unsigned int | _n, |
| unsigned int | _offset = 0, |
||
| 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] | _n | number of points in the point cloud. |
| [in] | _offset | number of points to skip in the output arrays. The kernel will write in the output arrays starting at position _offset (cl\_float4 types are considered). Use the maximum offset you expect to need, so the required memory can be allocated. You can change it afterwards dynamically to the one required at any moment. |
| [in] | _staging | flag to indicate whether or not to instantiate the staging buffers. |
| void * cl_algo::GF::SplitPC8D::read | ( | SplitPC8D::Memory | mem = SplitPC8D::Memory::H_OUT_PC4D, |
| 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::GF::SplitPC8D::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::GF::SplitPC8D::setOffset | ( | unsigned int | _offset | ) |
Sets the offset.
Updates the kernel argument for the offset.
| [in] | _offset | the offset to set. |
| void cl_algo::GF::SplitPC8D::write | ( | SplitPC8D::Memory | mem = SplitPC8D::Memory::D_IN, |
| 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::GF::SplitPC8D::hPtrIn |
Mapping of the input staging buffer for the 8-D point cloud.
| cl_float* cl_algo::GF::SplitPC8D::hPtrOutPC4D |
Mapping of the output staging buffer for the 4-D homogeneous coordinates.
| cl_float* cl_algo::GF::SplitPC8D::hPtrOutRGBA |
Mapping of the output staging buffer for the RGBA values.
1.8.9.1