SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
|
This version of the Map<Tout(Tin)> skeleton is executed over an two-dimensional index space defined by an IndexMatrix. More...
#include <Map.h>
Public Member Functions | |
Map (const Source &source, const std::string &funcName=std::string("func")) | |
Constructor taking the source code used of the user-defined function as argument. More... | |
template<typename... Args> | |
Matrix< Tout > | operator() (const Matrix< IndexPoint > &input, Args &&...args) const |
Executes the skeleton on the index space described by the input Matrix. The resulting data is stored in a newly created output Matrix and the Matrix is returned. More... | |
template<typename... Args> | |
Matrix< Tout > & | operator() (Out< Matrix< Tout >> output, const Matrix< IndexPoint > &input, Args &&...args) const |
Executes the skeleton on the index space described by the input Matrix. The resulting data is stored in the provided output Matrix and a reference to this Matrix is returned. More... | |
This version of the Map<Tout(Tin)> skeleton is executed over an two-dimensional index space defined by an IndexMatrix.
This is a more specialized version of the general Map<Tout(Tin)> skeleton. It can be customized with a user-defined function taking an IndexPoint (a pair of integer values) and producing an arbitrary typed output for every element of the index space.
On creation the Map skeleton is customized with source code defining a unary function. An instance of this class is a function object, i.e. it can be called like a function. When this happens a container is passed as input to the Map skeleton which then invokes the provided function on every element of the container in a parallel fashion on one or more devices (depending of the distribution of the container).
More formally: When c is a container of length n with items c[0] .. c[n-1], and f is the provided unary function, the Map skeleton performs the calculation f(x[i]) for ever i in 0 .. n-1.
As all skeletons, the Map skeleton allows for passing additional arguments, i.e. arguments besides the input container, to the user defined function. The user-defined function has to written in such a way, that it expects more than just one argument (it is no unary function any more). Accordingly the number, types and order of arguments used when calling the map skeleton has to match the declaration of the user-defined function.
Tout | The type of the elements stored in the output Matrix. |
skelcl::Map< Tout(IndexPoint)>::Map | ( | const Source & | source, |
const std::string & | funcName = std::string("func") |
||
) |
Constructor taking the source code used of the user-defined function as argument.
source | The source code of the user-defined function. |
funcName | The name of the user-defined function which should be invoked by the Map skeleton. |
Matrix<Tout> skelcl::Map< Tout(IndexPoint)>::operator() | ( | const Matrix< IndexPoint > & | input, |
Args &&... | args | ||
) | const |
Executes the skeleton on the index space described by the input Matrix. The resulting data is stored in a newly created output Matrix and the Matrix is returned.
Args | The types of the arguments which are passed to the user-defined function in addition to the input Matrix. |
Matrix<Tout>& skelcl::Map< Tout(IndexPoint)>::operator() | ( | Out< Matrix< Tout >> | output, |
const Matrix< IndexPoint > & | input, | ||
Args &&... | args | ||
) | const |
Executes the skeleton on the index space described by the input Matrix. The resulting data is stored in the provided output Matrix and a reference to this Matrix is returned.
Args | The types of the arguments which are passed to the user-defined function in addition to the input Matrix. |
output | The output Matrix in which the resulting data is stored. The type of this argument is not the type of the Matrix itself, but instead a wrapping class tagging that this Matrix is written into. The utility function skelcl::out() can be used to create this wrapper for an arbitrary Matrix. |
input | The input Matrix describing an index space on which the user-defined function is invoked. |
args | The values of the arguments which are passed to the user-defined function in addition to the input Matrix. |