SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
|
This class implements the MapOverlap skeleton, which describes calculations performed on one or more devices. It invokes a unary user-defined function on a container in a parallel fashion. Unlike the Map skeleton the user-defined function can access more than just a single element of the container. More...
#include <MapOverlap.h>
Public Member Functions | |
MapOverlap (const Source &source, unsigned int overlap_range=1, detail::Padding padding=detail::Padding::NEAREST, Tin neutral_element=Tin(), const std::string &func=std::string("func")) | |
Constructor taking the source code used of the user-defined function, the overlap range, and the Padding mode as arguments. More... | |
template<typename... Args> | |
Matrix< Tout > | operator() (const Matrix< Tin > &in, Args &&...args) |
Executes the skeleton on the provided 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< Tin > &in, Args &&...args) |
Executes the skeleton on the provided input Matrix. The resulting data is stored in the provided output Matrix and a reference to this Matrix is returned. More... | |
This class implements the MapOverlap skeleton, which describes calculations performed on one or more devices. It invokes a unary user-defined function on a container in a parallel fashion. Unlike the Map skeleton the user-defined function can access more than just a single element of the container.
On creation the MapOverlap skeleton is customized with source code defining a unary function, an overlap range, as well as a Padding mode. The overlap range specifies how many elements of the neighborhood of an element can be accesses by the user-defined function. The Padding mode defines how out of bound accesses are handled.
More formally: When c is a container of length n with items c[0] .. c[n-1], f is the provided unary function, and r is the overlap range, the MapOverlap skeleton performs the calculation f(c[i-r], .., c[i], .., c[i+r]) for every i in 0 .. n-1. If an out of bound access of c occurs the Padding mode defines the behavior.
As all skeletons, the MapOverlap 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.
Tin | The type of the elements stored in the input container. |
Tout | The type of the elements stored in the output container. |
Definition at line 104 of file MapOverlap.h.
skelcl::MapOverlap< Tout(Tin)>::MapOverlap | ( | const Source & | source, |
unsigned int | overlap_range = 1 , |
||
detail::Padding | padding = detail::Padding::NEAREST , |
||
Tin | neutral_element = Tin() , |
||
const std::string & | func = std::string("func") |
||
) |
Constructor taking the source code used of the user-defined function, the overlap range, and the Padding mode as arguments.
source | The source code of the user-defined function. |
overlap_range | The number of elements to be accessible for the user-defined function in each direction. |
padding | The Padding mode for handling out of bound accesses. |
neutral_element | The neutral element used by some Padding modes. |
func | The name of the user-defined function which should be invoked by the Map skeleton. |
Matrix<Tout> skelcl::MapOverlap< Tout(Tin)>::operator() | ( | const Matrix< Tin > & | in, |
Args &&... | args | ||
) |
Executes the skeleton on the provided 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 container. |
in | The input Matrix 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 container. |
Matrix<Tout>& skelcl::MapOverlap< Tout(Tin)>::operator() | ( | Out< Matrix< Tout >> | output, |
const Matrix< Tin > & | in, | ||
Args &&... | args | ||
) |
Executes the skeleton on the provided 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 container. |
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 container is written into. The utility function skelcl::out() can be used to create this wrapper for an arbitrary container. |
in | The input Matrix 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 container. |