SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of M√ľnster, Germany.
 All Classes Namespaces Files Functions Variables Typedefs Groups
Public Member Functions | List of all members
skelcl::Map< Tout(Tin)> Class Template Reference

This class implements the Map skeleton, which describes calculations performed on one or more devices. It invokes a unary used-defined function on a container in a parallel fashion. More...

#include <Map.h>

Inheritance diagram for skelcl::Map< Tout(Tin)>:

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<template< typename > class C, typename... Args>
C< Tout > operator() (const C< Tin > &input, Args &&...args) const
 Executes the skeleton on the provided input container. The resulting data is stored in a newly created output container and the container is returned. More...
 
template<template< typename > class C, typename... Args>
C< Tout > & operator() (Out< C< Tout >> output, const C< Tin > &input, Args &&...args) const
 Executes the skeleton on the provided input container. The resulting data is stored in the provided output container and a reference to this container is returned. More...
 

Detailed Description

template<typename Tin, typename Tout>
class skelcl::Map< Tout(Tin)>

This class implements the Map skeleton, which describes calculations performed on one or more devices. It invokes a unary used-defined function on a container in a parallel fashion.

This is the most general version of the Map skeleton. It can be customized with a user-defined function taking an arbitrary types argument (no classes are currently possible) and produces an arbitrary typed output.

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(c[i]) for every 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.

Template Parameters
TinThe type of the elements stored in the input container.
ToutThe type of the elements stored in the output container.

Definition at line 130 of file Map.h.

Constructor & Destructor Documentation

template<typename Tin , typename Tout >
skelcl::Map< Tout(Tin)>::Map ( const Source source,
const std::string &  funcName = std::string("func") 
)

Constructor taking the source code used of the user-defined function as argument.

Parameters
sourceThe source code of the user-defined function.
funcNameThe name of the user-defined function which should be invoked by the Map skeleton.

Member Function Documentation

template<typename Tin , typename Tout >
template<template< typename > class C, typename... Args>
C<Tout> skelcl::Map< Tout(Tin)>::operator() ( const C< Tin > &  input,
Args &&...  args 
) const

Executes the skeleton on the provided input container. The resulting data is stored in a newly created output container and the container is returned.

Template Parameters
CThe incomplete type of the container used as input and output. The complete types are C<Tin> for the input and C<Tout> for the output. C is either Vector or Matrix.
ArgsThe types of the arguments which are passed to the user-defined function in addition to the input container.
Parameters
inputThe input container on which the user-defined function is invoked
argsThe values of the arguments which are passed to the user-defined function in addition to the input container.
Returns
A newly created container storing the elements which get computed after invoking the user-defined function on the input container and the additionally provided arguments.
template<typename Tin , typename Tout >
template<template< typename > class C, typename... Args>
C<Tout>& skelcl::Map< Tout(Tin)>::operator() ( Out< C< Tout >>  output,
const C< Tin > &  input,
Args &&...  args 
) const

Executes the skeleton on the provided input container. The resulting data is stored in the provided output container and a reference to this container is returned.

Template Parameters
CThe incomplete type of the container used as input and output. The complete types are C<Tin> for the input and C<Tout> for the output.
ArgsThe types of the arguments which are passed to the user-defined function in addition to the input container.
Parameters
outputThe output container in which the resulting data is stored. The type of this argument is not the type of the container 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.
inputThe input container on which the user-defined function is invoked.
argsThe values of the arguments which are passed to the user-defined function in addition to the input container.
Returns
A reference to the provided output container. This container contains the elements which gets computed after invoking the user-defined function on the input container and the additionally provided arguments.

The documentation for this class was generated from the following file: