SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
|
An instance of the Reduce class describes a reduction calculation (a.k.a. accumulate) customized by a given binary user-defined function. More...
#include <Reduce.h>
Public Member Functions | |
Reduce (const Source &source, const std::string &id="0", const std::string &funcName="func") | |
Constructor taking the source code to customize the Reduce skeleton. More... | |
template<typename... Args> | |
Vector< T > | operator() (const Vector< T > &input, Args &&...args) |
Function call operator. Executes the skeleton on the data provided as argument input and args. The resulting data is returned as a moved copy. More... | |
template<typename... Args> | |
Vector< T > & | operator() (Out< Vector< T >> output, const Vector< T > &input, Args &&...args) |
Function call operator. Executes the skeleton on the data provided as argument input and args. The resulting data is stored in the provided Vector output. A reference to the output Vector is returned to allow for chaining skeleton calls. More... | |
std::string | source () const |
Return the source code of the user defined function. More... | |
std::string | func () const |
Return the name of the user defined function. More... | |
std::string | id () const |
Return the identity for the user defined function. More... | |
An instance of the Reduce class describes a reduction calculation (a.k.a. accumulate) customized by a given binary user-defined function.
On creation the Reduce skeleton is customized with source code defining a binary function. The binary function has to be associative and commutative. The Reduce skeleton can be executed by passing an input Vector. The given function is applied repetitively to calculate a single scalar value from all items of the input container.
More formally: When v is a Vector of length n with items v[0] .. v[n-1], f is the provided function, the Reduce skeleton calculates the output value y as follows: y = f(..f(f(v[0], v[1]), v[2]),.. v[n-1]) or written more easily using + as a symbol for the given function and using infix notation: y = v[0] + v[1] + v[2] ... + v[n-1].
T | Type of the input and output data of the skeleton. |
skelcl::Reduce< T(T)>::Reduce | ( | const Source & | source, |
const std::string & | id = "0" , |
||
const std::string & | funcName = "func" |
||
) |
Constructor taking the source code to customize the Reduce skeleton.
source | Source code used to customize the skeleton. |
id | Identity for he function named by funcName and defined in source. Meaning: if func is the name of the function defined in source, func(x, id) = x and func(id, x) = x for every possible value of x |
funcName | Name of the 'main' function (the starting point) of the given source code |
std::string skelcl::Reduce< T(T)>::func | ( | ) | const |
Return the name of the user defined function.
std::string skelcl::Reduce< T(T)>::id | ( | ) | const |
Return the identity for the user defined function.
Vector<T> skelcl::Reduce< T(T)>::operator() | ( | const Vector< T > & | input, |
Args &&... | args | ||
) |
Function call operator. Executes the skeleton on the data provided as argument input and args. The resulting data is returned as a moved copy.
input | The input data for the skeleton managed inside a Vector. If no distribution is set the Single distribution using the device with id 0 is used. Currently only the Single distribution is supported for the input Vector! This will certainly be advanced in a future version. |
args | Additional arguments which are passed to the function named by funcName and defined in the source code at created. The individual arguments must be passed in the same order here as they where defined in the funcName function declaration. |
Vector<T>& skelcl::Reduce< T(T)>::operator() | ( | Out< Vector< T >> | output, |
const Vector< T > & | input, | ||
Args &&... | args | ||
) |
Function call operator. Executes the skeleton on the data provided as argument input and args. The resulting data is stored in the provided Vector output. A reference to the output Vector is returned to allow for chaining skeleton calls.
output | The Vector storing the result of the execution of the skeleton. A reference to this container is also returned. The Vector might be resized to fit the result. The distribution of the container might change. |
input | The input data for the skeleton managed inside a Vector. If no distribution is set the Single distribution using the device with id 0 is used. Currently only the Single distribution is supported for the input vector! This will certainly be advanced in a future version. |
args | Additional arguments which are passed to the function named by funcName and defined in the source code at created. The individual arguments must be passed in the same order here as they where defined in the funcName function declaration. |
std::string skelcl::Reduce< T(T)>::source | ( | ) | const |
Return the source code of the user defined function.