JayBeams
0.1
Another project to have fun coding.
|
The interface for reducers assumed by jb::opencl::generic_reducer. More...
Public Member Functions | |
reducer_concept (std::size_t size, boost::compute::command_queue const &queue) | |
Constructor. More... | |
Static Public Member Functions | |
static std::string | combine_body (char const *accumulated, char const *value) |
Produce a code segment to combine two values. More... | |
static std::string | initialize_body (char const *dst) |
Produce a code segment to initialize a variable for name lhs. More... | |
static std::string | transform_body (char const *dst, char const *src, char const *offset) |
Produce the code segment for the initial transform of the input. More... | |
The interface for reducers assumed by jb::opencl::generic_reducer.
The generic reduce algorithm is implemented using the Curiously Recurring Template Pattern (CRTP), the derived class must provide the following interface, and derive from generic_reduced with the derived class as a template parameter.
The reducer just provides three small code segments:
Definition at line 20 of file reducer_concept.dox.
|
inline |
Constructor.
Definition at line 24 of file reducer_concept.dox.
|
inlinestatic |
Produce a code segment to combine two values.
accumulated | the name of the variable used as an accumulator. |
value | the new value to be considered |
Definition at line 46 of file reducer_concept.dox.
|
inlinestatic |
Produce a code segment to initialize a variable for name lhs.
dst | the name of the variable to initialize. |
Definition at line 59 of file reducer_concept.dox.
|
inlinestatic |
Produce the code segment for the initial transform of the input.
Some reductions make a transformation of the data in the first transform, this is a hook to create the body of this function. Most reductions would simply use "*lhs = *value".
dst | the name of the variable where the result will be stored. |
src | the name of the variable where the input value is stored. |
offset | the name of the variable where the input offset (in the global input vector) is stored. |
Definition at line 89 of file reducer_concept.dox.