|
| Scan () |
| Default constructor. More...
|
|
| Scan (const cl::Context &context, const cl::Device &device, const Type &type) |
| Constructor. More...
|
|
| Scan (const cl::Context &context, const cl::Device &device, const ScanProblem &problem) |
| Constructor. More...
|
|
| ~Scan () |
| Destructor.
|
|
void | enqueue (const cl::CommandQueue &commandQueue, const cl::Buffer &buffer,::size_t elements, const void *offset=NULL, const VECTOR_CLASS< cl::Event > *events=NULL, cl::Event *event=NULL) |
| Enqueue a scan operation on a command queue (in-place). More...
|
|
void | enqueue (const cl::CommandQueue &commandQueue, const cl::Buffer &inBuffer, const cl::Buffer &outBuffer,::size_t elements, const void *offset=NULL, const VECTOR_CLASS< cl::Event > *events=NULL, cl::Event *event=NULL) |
| Enqueue a scan operation on a command queue. More...
|
|
void | enqueue (cl_command_queue commandQueue, cl_mem inBuffer, cl_mem outBuffer,::size_t elements, const void *offset=NULL, cl_uint numEvents=0, const cl_event *events=NULL, cl_event *event=NULL) |
|
void | enqueue (const cl::CommandQueue &commandQueue, const cl::Buffer &buffer,::size_t elements, const cl::Buffer &offsetBuffer, cl_uint offsetIndex, const VECTOR_CLASS< cl::Event > *events=NULL, cl::Event *event=NULL) |
| Enqueue a scan operation on a command queue, with an offset in a buffer (in-place). More...
|
|
void | enqueue (const cl::CommandQueue &commandQueue, const cl::Buffer &inBuffer, const cl::Buffer &outBuffer,::size_t elements, const cl::Buffer &offsetBuffer, cl_uint offsetIndex, const VECTOR_CLASS< cl::Event > *events=NULL, cl::Event *event=NULL) |
| Enqueue a scan operation on a command queue, with an offset in a buffer. More...
|
|
void | enqueue (cl_command_queue commandQueue, cl_mem inBuffer, cl_mem outBuffer,::size_t elements, cl_mem offsetBuffer, cl_uint offsetIndex, cl_uint numEvents=0, const cl_event *events=NULL, cl_event *event=NULL) |
|
void | setEventCallback (void(*callback)(const cl::Event &, void *), void *userData, void(*free)(void *)=NULL) |
| Set a callback function that will receive a list of all underlying events. More...
|
|
template<typename T > |
void | setEventCallback (const T &callback) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The provided function object will be passed a cl::Event. More...
|
|
void | setEventCallback (void(*callback)(cl_event, void *), void *userData, void(*free)(void *)=NULL) |
|
|
void | enqueue (cl_command_queue commandQueue, cl_mem inBuffer, cl_mem outBuffer,::size_t elements, const void *offset, cl_uint numEvents, const cl_event *events, cl_event *event, cl_int &err, const char *&errStr) |
|
void | enqueue (cl_command_queue commandQueue, cl_mem inBuffer, cl_mem outBuffer,::size_t elements, cl_mem offsetBuffer, cl_uint offsetIndex, cl_uint numEvents, const cl_event *events, cl_event *event, cl_int &err, const char *&errStr) |
|
void | moveAssign (Scan &other) |
|
void | moveConstruct (Algorithm &other) |
| Constructs this by stealing the pointer from other.
|
|
detail::Algorithm * | moveAssign (Algorithm &other) |
| Sets this by stealing the pointer from other, and returning the previous value.
|
|
void | swap (Algorithm &other) |
| Swaps the pointers between this and other.
|
|
detail::Algorithm * | getDetail () const |
| Returns the embedded pointer.
|
|
detail::Algorithm * | getDetailNonNull () const |
| Returns the embedded pointer. More...
|
|
void | setDetail (detail::Algorithm *ptr) |
| Set the value of the embedded pointer. More...
|
|
Exclusive scan (prefix sum) primitive.
One instance of this class can be reused for multiple scans, provided that
- calls to enqueue do not overlap; and
- their execution does not overlap.
An instance of the class is specialized to a specific context, device, and type of value to scan. Any CL integral scalar or vector type can be used.
The implementation is based on the reduce-then-scan strategy described at https://sites.google.com/site/duanemerrill/ScanTR2.pdf?attredirects=0
void clogs::Scan::enqueue |
( |
const cl::CommandQueue & |
commandQueue, |
|
|
const cl::Buffer & |
buffer, |
|
|
::size_t |
elements, |
|
|
const void * |
offset = NULL , |
|
|
const VECTOR_CLASS< cl::Event > * |
events = NULL , |
|
|
cl::Event * |
event = NULL |
|
) |
| |
|
inline |
Enqueue a scan operation on a command queue (in-place).
This is equivalent to calling enqueue
(commandQueue, buffer, buffer, elements, offset, events, event);
void clogs::Scan::enqueue |
( |
const cl::CommandQueue & |
commandQueue, |
|
|
const cl::Buffer & |
inBuffer, |
|
|
const cl::Buffer & |
outBuffer, |
|
|
::size_t |
elements, |
|
|
const void * |
offset = NULL , |
|
|
const VECTOR_CLASS< cl::Event > * |
events = NULL , |
|
|
cl::Event * |
event = NULL |
|
) |
| |
|
inline |
Enqueue a scan operation on a command queue.
An initial offset may optionally be passed in offset, which will be added to all elements of the result. The pointer must point to the type of element specified to the constructor. If no offset is desired, NULL
may be passed instead.
The input and output buffers may be the same to do an in-place scan.
- Parameters
-
commandQueue | The command queue to use. |
inBuffer | The buffer to scan. |
outBuffer | The buffer to fill with output. |
elements | The number of elements to scan. |
offset | The offset to add to all elements, or NULL . |
events | Events to wait for before starting. |
event | Event that will be signaled on completion. |
- Exceptions
-
cl::Error | If inBuffer is not readable on the device. |
cl::Error | If outBuffer is not writable on the device. |
cl::Error | If the element range overruns the buffer. |
cl::Error | If elements is zero. |
- Precondition
- commandQueue was created with the context and device given to the constructor.
- Postcondition
- After execution, element
i
will be replaced by the sum of all elements strictly before i
, plus the offset (if any).
void clogs::Scan::enqueue |
( |
const cl::CommandQueue & |
commandQueue, |
|
|
const cl::Buffer & |
buffer, |
|
|
::size_t |
elements, |
|
|
const cl::Buffer & |
offsetBuffer, |
|
|
cl_uint |
offsetIndex, |
|
|
const VECTOR_CLASS< cl::Event > * |
events = NULL , |
|
|
cl::Event * |
event = NULL |
|
) |
| |
|
inline |
Enqueue a scan operation on a command queue, with an offset in a buffer (in-place).
This is equivalent to calling enqueue
(commandQueue, buffer, buffer, elements, offsetBuffer, offsetIndex);
void clogs::Scan::enqueue |
( |
const cl::CommandQueue & |
commandQueue, |
|
|
const cl::Buffer & |
inBuffer, |
|
|
const cl::Buffer & |
outBuffer, |
|
|
::size_t |
elements, |
|
|
const cl::Buffer & |
offsetBuffer, |
|
|
cl_uint |
offsetIndex, |
|
|
const VECTOR_CLASS< cl::Event > * |
events = NULL , |
|
|
cl::Event * |
event = NULL |
|
) |
| |
|
inline |
Enqueue a scan operation on a command queue, with an offset in a buffer.
The offset is of the same type as the elements to be scanned, and is stored in a buffer. It is added to all elements of the result. It is legal for the offset to be in the same buffer as the values to scan, and it may even be safely overwritten by the scan (it will be read before being overwritten). This makes it possible to use do multi-pass algorithms with variable output. The counting pass fills in the desired allocations, a scan is used with one extra element at the end to hold the grand total, and the subsequent passes use this extra element as the offset.
The input and output buffers may be the same to do an in-place scan.
- Parameters
-
commandQueue | The command queue to use. |
inBuffer | The buffer to scan. |
outBuffer | The buffer to fill with output. |
elements | The number of elements to scan. |
offsetBuffer | Buffer containing a value to add to all elements. |
offsetIndex | Index (in units of the scan type) into offsetBuffer. |
events | Events to wait for before starting. |
event | Event that will be signaled on completion. |
- Exceptions
-
cl::Error | If inBuffer is not readable on the device. |
cl::Error | If outBuffer is not writable on the device. |
cl::Error | If the element range overruns the buffer. |
cl::Error | If elements is zero. |
cl::Error | If offsetBuffer is not readable. |
cl::Error | If offsetIndex overruns offsetBuffer. |
- Precondition
- commandQueue was created with the context and device given to the constructor.
- Postcondition
- After execution, element
i
will be replaced by the sum of all elements strictly before i
, plus the offset.