|
SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
|
An instance of the AllPairs class describes a calculation of pairs of row vectors and column vectors with a user defined function which can be performed on a device. More...
#include <AllPairs.h>
Public Member Functions | |
| AllPairs (const Reduce< Tout(Tout)> &reduce, const Zip< Tout(Tleft, Tright)> &zip) | |
| Constructor taking a Reduce and a Zip skeleton used to customize the AllPairs skeleton. More... | |
| AllPairs (const std::string &source, const std::string &func=std::string("func")) | |
| Constructor taking the source code used to customize the AllPairs skeleton. More... | |
| template<typename... Args> | |
| Matrix< Tout > | operator() (const Matrix< Tleft > &left, const Matrix< Tright > &right, Args &&...args) |
| Executes the skeleton on the data provided as arguments left, right and args. The resulting data is stored in a newly created output matrix. More... | |
| template<typename... Args> | |
| Matrix< Tout > & | operator() (Out< Matrix< Tout > > output, const Matrix< Tleft > &left, const Matrix< Tright > &right, Args &&...args) |
| Executes the skeleton on the provided containers. The resulting data is stored in the provided output container and a reference to this container is returned. More... | |
An instance of the AllPairs class describes a calculation of pairs of row vectors and column vectors with a user defined function which can be performed on a device.
On creation the AllPairs skeleton is customized with either a given Reduce<T(T)> and Zip<Tout(Tleft, Tright)> skeleton or with source code defining a function. The source code function header receives two vectors of the same length and the length as an integer as follows:
The i-th element of the row-vector row of type lmatrix_t can be accessed via the API-Function getElementFromRow(row, i) and the i-th element of the column-vector col of type rmatrix_t can be accessed via the API-function getElementFromColumn(col, i).
The AllPairs skeleton can be executed by passing two matrix containers. The AllPairs skeleton will compute the results of all pairs of row-vectors from the left matrix and column-vectors from the right matrix and store them in a result matrix. More formally: M is a matrix of size heigt x dim and N is a matrix of size dim x width and F is the customized function that receives a row-vector from M, a column-vector from N and calculates a scalar value. Then P is the result matrix of size height x width. Every P[i,j] is the scalar result from F(M_i, N_j), where M_i is the ith row vector in M for i in [0,..,height-1] and N_j is the jth column vector in N for j in [0,...,width-1]. When a Zip<Tout(Tleft, Tright)> and a Reduce<T(T)> skeleton is used to customize the allpairs skeleton, then function F is Reduce(Zip(M_i,N_j)). Passing a Zip<Tout(Tleft, Tright)> and Reduce<T(T)> skeleton yields a better runtime than defining a function as source code, as local memory is used automatically.
| Tleft | Type of the left input data of the skeleton. |
| Tright | Type of the right input data of the skeleton. |
| Tout | Type of the output data of the skeleton. |
Definition at line 118 of file AllPairs.h.
| skelcl::AllPairs< Tout(Tleft, Tright)>::AllPairs | ( | const Reduce< Tout(Tout)> & | reduce, |
| const Zip< Tout(Tleft, Tright)> & | zip | ||
| ) |
Constructor taking a Reduce and a Zip skeleton used to customize the AllPairs skeleton.
| reduce | Reduce skeleton |
| zip | Zip skeleton |
| skelcl::AllPairs< Tout(Tleft, Tright)>::AllPairs | ( | const std::string & | source, |
| const std::string & | func = std::string("func") |
||
| ) |
Constructor taking the source code used to customize the AllPairs skeleton.
| source | Source code used to customize the skeleton |
| func | Name of the 'main' function (the starting point) of the given source code |
| Matrix<Tout> skelcl::AllPairs< Tout(Tleft, Tright)>::operator() | ( | const Matrix< Tleft > & | left, |
| const Matrix< Tright > & | right, | ||
| Args &&... | args | ||
| ) |
Executes the skeleton on the data provided as arguments left, right and args. The resulting data is stored in a newly created output matrix.
| Args | The types of the arguments which are passed to the user-defined function in addition to the input container. |
| left | The first (left) input data for the skeleton managed inside a matrix. If no distribution is set for this container as well as for the right container as default the Block distribution is selected. If no distribution is set for this container and a distribution is set for the right container the implementation will try to select a suitable distribution for allpairs computations. |
| right | The second (right) input data for the skeleton managed inside a matrix. If no distribution is set for this matrix as well as for the left matrix as default the Copy distribution is selected. If no distribution is set for this matrix and a distribution is set for the left matrix the implementation will try to select a suitable distribution for allpairs computations |
| args | The values of the arguments which are passed to the user-defined function in addition to the input container. |
| Matrix<Tout>& skelcl::AllPairs< Tout(Tleft, Tright)>::operator() | ( | Out< Matrix< Tout > > | output, |
| const Matrix< Tleft > & | left, | ||
| const Matrix< Tright > & | right, | ||
| Args &&... | args | ||
| ) |
Executes the skeleton on the provided containers. The resulting data is stored in the provided output container and a reference to this container 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. |
| left | The first (left) input data for the skeleton managed inside a matrix. If no distribution is set for this matrix as well as for the right matrix as default the Block distribution is selected. If no distribution is set for this matrix and a distribution is set for the right matrix the implementation will try to select a suitable distribution for allpairs computations |
| right | The second (right) input data for the skeleton managed inside a matrix. If no distribution is set for this matrix as well as for the left matrix as default the Copy distribution is selected. If no distribution is set for this matrix and a distribution is set for the left matrix the implementation will try to select a suitable distribution for allpairs computations |
| args | The values of the arguments which are passed to the user-defined function in addition to the input container. |
1.8.7