Muesli
 All Classes Namespaces Files Functions Typedefs Enumerations
Public Member Functions | List of all members
msl::DArray< T > Class Template Reference

Class DArray represents a distributed array. More...

#include <darray.h>

Public Member Functions

 DArray ()
 Default constructor.
 
 DArray (int size, Distribution d=DIST)
 Creates an empty distributed array. More...
 
 DArray (int size, const T &initial_value, Distribution d=DIST)
 Creates a distributed array with size elements equal to initial_value. More...
 
 DArray (int size, T *const initial_array, Distribution d=DIST)
 Creates a distributed array with size elements. Elements are copied from initial_array. Note that the length of initial_array must equal size. More...
 
 DArray (int size, T(*f)(int), Distribution d=DIST)
 Creates a distributed array with size elements. Initializes all elements via the given function f. Note that global indices are pass to this function as arguments. More...
 
template<typename F >
 DArray (int size, const F &f, Distribution d=DIST)
 Creates a distributed array with size elements. Initializes all elements via the given functor f. Note that global indices are pass to this functor as arguments. More...
 
 DArray (const DArray< T > &cs)
 Copy constructor. More...
 
 ~DArray ()
 Destructor.
 
DArray< T > & operator= (const DArray< T > &rhs)
 Assignment operator. More...
 
void fill (const T &value)
 Initializes the elements of the distributed array with the value value. More...
 
void fill (T *const values)
 Initializes the elements of the distributed array with the elements of the given array of values. Note that the length of values must match the size of the distributed array (not checked). More...
 
void fill (T(*f)(int))
 Initializes the elements of the distributed array via the given function f. Note that global indices are pass to this function as arguments. More...
 
template<typename F >
void fill (const F &f)
 Initializes the elements of the distributed array via the given functor f. Note that global indices are pass to this functor as arguments. More...
 
template<typename MapFunctor >
void mapInPlace (MapFunctor &f)
 Replaces each element a[i] of the distributed array with f(a[i]). More...
 
template<typename MapIndexFunctor >
void mapIndexInPlace (MapIndexFunctor &f)
 Replaces each element a[i] of the distributed array with f(i, a[i]). Note that besides the element itself also its index is passed to the functor. More...
 
template<typename R , typename MapFunctor >
msl::DArray< R > map (MapFunctor &f)
 Returns a new distributed array with a_new[i] = f(a[i]). More...
 
template<typename R , typename MapIndexFunctor >
DArray< R > mapIndex (MapIndexFunctor &f)
 Returns a new distributed array with a_new[i] = f(i, a[i]). Note that besides the element itself also its index is passed to the functor. More...
 
template<typename MapStencilFunctor >
void mapStencilInPlace (MapStencilFunctor &f, T neutral_value)
 Replaces each element a[i] of the distributed array with f(i, a). Note that the index i and the local partition is passed to the functor. More...
 
template<typename R , typename MapStencilFunctor >
DArray< R > mapStencil (MapStencilFunctor &f, T neutral_value)
 Non-inplace variant of the mapStencil skeleton. More...
 
template<typename F >
void mapInPlace (const msl::Fct1< T, T, F > &f)
 Replaces each element a[i] of the distributed array with f(a[i]). Note that this is a CPU only skeleton. More...
 
void mapInPlace (T(*f)(T))
 Replaces each element a[i] of the distributed array with f(a[i]). Note that this is a CPU only skeleton. More...
 
template<typename F >
void mapIndexInPlace (const msl::Fct2< int, T, T, F > &f)
 Replaces each element a[i] of the distributed array with f(i, a[i]). Note that besides the element itself also its index is passed to the functor. Also note that this is a CPU only skeleton. More...
 
void mapIndexInPlace (T(*f)(int, T))
 Replaces each element a[i] of the distributed array with f(i, a[i]). Note that besides the element itself also its index is passed to the functor. Also note that this is a CPU only skeleton. More...
 
template<typename R , typename F >
msl::DArray< R > map (const msl::Fct1< T, R, F > &f)
 Non-inplace variant of the map skeleton. Note that this is a CPU only skeleton. More...
 
template<typename R >
msl::DArray< R > map (R(*f)(T))
 Non-inplace variant of the map skeleton. Note that this is a CPU only skeleton. More...
 
template<typename R , typename F >
DArray< R > mapIndex (const msl::Fct2< int, T, R, F > &f)
 Non-inplace variant of the mapIndex skeleton. Note that this is a CPU only skeleton. More...
 
template<typename R >
DArray< R > mapIndex (R(*f)(int, T))
 Non-inplace variant of the mapIndex skeleton. Note that this is a CPU only skeleton. More...
 
template<typename T2 , typename ZipFunctor >
void zipInPlace (DArray< T2 > &b, ZipFunctor &f)
 Replaces each element a[i] of the distributed array with f(a[i], b[i]) with b being another distributed array of the same size. More...
 
template<typename T2 , typename ZipIndexFunctor >
void zipIndexInPlace (DArray< T2 > &b, ZipIndexFunctor &f)
 Replaces each element a[i] of the distributed array with f(i, a[i], b[i]). Note that besides the elements themselves also the index is passed to the functor. More...
 
template<typename R , typename T2 , typename ZipFunctor >
DArray< R > zip (DArray< T2 > &b, ZipFunctor &f)
 Non-inplace variant of the zip skeleton. More...
 
template<typename R , typename T2 , typename ZipIndexFunctor >
DArray< R > zipIndex (DArray< T2 > &b, ZipIndexFunctor &f)
 Non-inplace variant of the zipIndex skeleton. More...
 
template<typename T2 , typename F >
void zipInPlace (DArray< T2 > &b, const Fct2< T, T2, T, F > &f)
 Replaces each element a[i] of the distributed array with f(a[i], b[i]) with b being another distributed array of the same size. Note that this is a CPU only skeleton. More...
 
template<typename T2 >
void zipInPlace (DArray< T2 > &b, T(*f)(T, T2))
 Replaces each element a[i] of the distributed array with f(a[i], b[i]) with b being another distributed array of the same size. Note that this is a CPU only skeleton. More...
 
template<typename T2 , typename F >
void zipIndexInPlace (DArray< T2 > &b, const Fct3< int, T, T2, T, F > &f)
 Replaces each element a[i] of the distributed array with f(i, a[i], b[i]). Note that besides the elements themselves also the index is passed to the functor. Note that this is a CPU only skeleton. More...
 
template<typename T2 >
void zipIndexInPlace (DArray< T2 > &b, T(*f)(int, T, T2))
 Replaces each element a[i] of the distributed array with f(i, a[i], b[i]). Note that besides the elements themselves also the index is passed to the functor. Note that this is a CPU only skeleton. More...
 
template<typename R , typename T2 , typename F >
DArray< R > zip (DArray< T2 > &b, const Fct2< T, T2, R, F > &f)
 Non-inplace variant of the zip skeleton. Note that this is a CPU only skeleton. More...
 
template<typename R , typename T2 >
DArray< R > zip (DArray< T2 > &b, R(*f)(T, T2))
 Non-inplace variant of the zip skeleton. Note that this is a CPU only skeleton. More...
 
template<typename R , typename T2 , typename F >
DArray< R > zipIndex (DArray< T2 > &b, const Fct3< int, T, T2, R, F > &f)
 Non-inplace variant of the zipIndex skeleton. Note that this is a CPU only skeleton. More...
 
template<typename R , typename T2 >
DArray< R > zipIndex (DArray< T2 > &b, R(*f)(int, T, T2))
 Non-inplace variant of the zipIndex skeleton. Note that this is a CPU only skeleton. More...
 
template<typename FoldFunctor >
fold (FoldFunctor &f, bool final_fold_on_cpu=1)
 Reduces all elements of the distributed array to a single element by successively applying the given functor f. Note that f needs to be a commutative function. Note that this is a CPU only skeleton. More...
 
template<typename F >
fold (const Fct2< T, T, T, F > &f)
 Reduces all elements of the distributed array to a single element by successively applying the given functor f. Note that f needs to be a commutative function. Note that this is a CPU only skeleton. More...
 
fold (T(*f)(T, T))
 Reduces all elements of the distributed array to a single element by successively applying the given function f. Note that f needs to be a commutative function. Note that this is a CPU only skeleton. More...
 
void broadcastPartition (int partitionIndex)
 Broadcasts the partition with index partitionIndex to all processes. Afterwards, each partition of the distributed array stores the same values. Note that 0 <= partitionIndex <= size/numProcesses. More...
 
void gather (T *b)
 Transforms a distributed array to an ordinary array by copying each element to the given array b. b must at least be of length size. More...
 
void gather (msl::DArray< T > &da)
 Transforms a distributed array to a copy distributed distributed array by copying each element to the given distributed array da. da must be copy distributed, otherwise this function immediately returns. More...
 
template<class F >
void permutePartition (const Fct1< int, int, F > &f)
 Permutes the partitions of the distributed array according to the given function f. f must be bijective and return the ID of the new process p_i to store the partition, with 0 <= i < np. More...
 
void permutePartition (int(*f)(int))
 Permutes the partitions of the distributed array according to the given function f. f must be bijective and return the the ID of the new process p_i to store the partition, with 0 <= i < np. More...
 
T * getLocalPartition () const
 Returns the local partition. More...
 
get (int index) const
 Returns the element at the given global index index. More...
 
void set (int globalIndex, const T &v)
 Sets the element at the given global index globalIndex to the given value v, with 0 <= globalIndex < size. More...
 
int getSize () const
 Returns the global size of the distributed array. More...
 
int getLocalSize () const
 Returns the size of local partitions of the distributed array. More...
 
int getFirstIndex () const
 Returns the first (global) index of the local partition. More...
 
bool isLocal (int index) const
 Checks whether the element at the given global index index is locally stored. More...
 
getLocal (int localIndex) const
 Returns the element at the given local index index. Note that 0 <= index < getLocalSize() must hold (will not be checked, for reasons of performance). More...
 
void setLocal (int localIndex, const T &v)
 Sets the element at the given local index localIndex to the given value v. More...
 
std::vector< GPUExecutionPlan
< T > > 
getExecPlans ()
 Returns the GPU execution plans that store information about size, etc. for the GPU partitions. For internal purposes. More...
 
void setCopyDistribution ()
 Switch the distribution scheme from distributed to copy distributed.
 
void setDistribution ()
 Switch the distribution scheme from copy distributed to distributed.
 
std::vector< T * > upload (bool allocOnly=0)
 Manually upload the local partition to GPU memory. More...
 
void download ()
 Manually download the local partition from GPU memory.
 
void freeDevice ()
 Manually free device memory.
 
void setGpuDistribution (Distribution dist)
 Set how the local partition is distributed among the GPUs. Current distribution schemes are: distributed, copy distributed. More...
 
Distribution getGpuDistribution ()
 Returns the current GPU distribution scheme. More...
 
void show (const std::string &descr=std::string())
 Prints the distributed array to standard output. Optionally, the user may pass a description that will be printed with the output. More...
 
void printLocal ()
 Each process prints its local partition of the distributed array.
 

Detailed Description

template<typename T>
class msl::DArray< T >

Class DArray represents a distributed array.

A distributed array represents a one-dimensional parallel container and is distributed among all MPI processes the application was started with. It includes data parallel skeletons such as map, mapStencil, zip, and fold as well as variants of these skeletons.

Template Parameters
TElement type. Restricted to classes without pointer data members.

Constructor & Destructor Documentation

template<typename T>
msl::DArray< T >::DArray ( int  size,
Distribution  d = DIST 
)

Creates an empty distributed array.

Parameters
sizeSize of the distributed array.
dDistribution of the distributed array.
template<typename T>
msl::DArray< T >::DArray ( int  size,
const T &  initial_value,
Distribution  d = DIST 
)

Creates a distributed array with size elements equal to initial_value.

Parameters
sizeSize of the distributed array.
initial_valueInitial value for all elements.
dDistribution of the distributed array.
template<typename T>
msl::DArray< T >::DArray ( int  size,
T *const  initial_array,
Distribution  d = DIST 
)

Creates a distributed array with size elements. Elements are copied from initial_array. Note that the length of initial_array must equal size.

Parameters
sizeSize of the distributed array.
initial_arrayInitial array to copy elements from.
dDistribution of the distributed array.
template<typename T>
msl::DArray< T >::DArray ( int  size,
T(*)(int)  f,
Distribution  d = DIST 
)

Creates a distributed array with size elements. Initializes all elements via the given function f. Note that global indices are pass to this function as arguments.

Parameters
sizeSize of the distributed array.
fFunction to initialize the elements of the distributed array.
dDistribution of the distributed array.
template<typename T>
template<typename F >
msl::DArray< T >::DArray ( int  size,
const F &  f,
Distribution  d = DIST 
)

Creates a distributed array with size elements. Initializes all elements via the given functor f. Note that global indices are pass to this functor as arguments.

Parameters
sizeSize of the distributed array.
fFunctor to initialize the elements of the distributed array.
dDistribution of the distributed array.
template<typename T>
msl::DArray< T >::DArray ( const DArray< T > &  cs)

Copy constructor.

Parameters
csThe copy source.

Member Function Documentation

template<typename T>
void msl::DArray< T >::broadcastPartition ( int  partitionIndex)

Broadcasts the partition with index partitionIndex to all processes. Afterwards, each partition of the distributed array stores the same values. Note that 0 <= partitionIndex <= size/numProcesses.

Parameters
partitionIndexThe index of the partition to broadcast.
template<typename T>
void msl::DArray< T >::fill ( const T &  value)

Initializes the elements of the distributed array with the value value.

Parameters
valueThe value.
template<typename T>
void msl::DArray< T >::fill ( T *const  values)

Initializes the elements of the distributed array with the elements of the given array of values. Note that the length of values must match the size of the distributed array (not checked).

Parameters
valuesThe array of values.
template<typename T>
void msl::DArray< T >::fill ( T(*)(int)  f)

Initializes the elements of the distributed array via the given function f. Note that global indices are pass to this function as arguments.

Parameters
fThe initializer function.
template<typename T>
template<typename F >
void msl::DArray< T >::fill ( const F &  f)

Initializes the elements of the distributed array via the given functor f. Note that global indices are pass to this functor as arguments.

Parameters
fThe initializer functor.
template<typename T>
template<typename FoldFunctor >
T msl::DArray< T >::fold ( FoldFunctor &  f,
bool  final_fold_on_cpu = 1 
)

Reduces all elements of the distributed array to a single element by successively applying the given functor f. Note that f needs to be a commutative function. Note that this is a CPU only skeleton.

Parameters
fThe fold functor, must be of type AFoldFunctor.
final_fold_on_cpuSpecifies whether the final fold steps are done by the CPU. Default is true and since this is the CPU version of this skeleton, passing false will have no effect.
Returns
The reduced value.
template<typename T>
template<typename F >
T msl::DArray< T >::fold ( const Fct2< T, T, T, F > &  f)

Reduces all elements of the distributed array to a single element by successively applying the given functor f. Note that f needs to be a commutative function. Note that this is a CPU only skeleton.

Parameters
fThe fold functor, must be a 'curried' function pointer.
Returns
The reduced value.
template<typename T>
T msl::DArray< T >::fold ( T(*)(T, T)  f)

Reduces all elements of the distributed array to a single element by successively applying the given function f. Note that f needs to be a commutative function. Note that this is a CPU only skeleton.

Parameters
fThe fold function.
Returns
The reduced value.
template<typename T>
void msl::DArray< T >::gather ( T *  b)

Transforms a distributed array to an ordinary array by copying each element to the given array b. b must at least be of length size.

Parameters
bThe array to store the elements of the distributed array.
template<typename T>
void msl::DArray< T >::gather ( msl::DArray< T > &  da)

Transforms a distributed array to a copy distributed distributed array by copying each element to the given distributed array da. da must be copy distributed, otherwise this function immediately returns.

Parameters
daThe (copy distributed) distributed array to stores the elements of the distributed array.
template<typename T>
T msl::DArray< T >::get ( int  index) const

Returns the element at the given global index index.

Parameters
indexThe global index.
Returns
The element at the given global index.
template<typename T>
std::vector<GPUExecutionPlan<T> > msl::DArray< T >::getExecPlans ( )

Returns the GPU execution plans that store information about size, etc. for the GPU partitions. For internal purposes.

Returns
The GPU execution plans.
template<typename T>
int msl::DArray< T >::getFirstIndex ( ) const

Returns the first (global) index of the local partition.

Returns
The first (global) index.
template<typename T>
Distribution msl::DArray< T >::getGpuDistribution ( )

Returns the current GPU distribution scheme.

Returns
The GPU distribution scheme.
template<typename T>
T msl::DArray< T >::getLocal ( int  localIndex) const

Returns the element at the given local index index. Note that 0 <= index < getLocalSize() must hold (will not be checked, for reasons of performance).

Parameters
indexThe local index.
template<typename T>
T* msl::DArray< T >::getLocalPartition ( ) const

Returns the local partition.

Returns
The local partition.
template<typename T>
int msl::DArray< T >::getLocalSize ( ) const

Returns the size of local partitions of the distributed array.

Returns
The size of local partitions.
template<typename T>
int msl::DArray< T >::getSize ( ) const

Returns the global size of the distributed array.

Returns
The global size.
template<typename T>
bool msl::DArray< T >::isLocal ( int  index) const

Checks whether the element at the given global index index is locally stored.

Parameters
indexThe global index.
Returns
True if the element is locally stored.
template<typename T>
template<typename R , typename MapFunctor >
msl::DArray<R> msl::DArray< T >::map ( MapFunctor &  f)

Returns a new distributed array with a_new[i] = f(a[i]).

Parameters
fThe map functor, must be of type AMapFunctor.
Returns
The newly created distributed array.
template<typename T>
template<typename R , typename F >
msl::DArray<R> msl::DArray< T >::map ( const msl::Fct1< T, R, F > &  f)

Non-inplace variant of the map skeleton. Note that this is a CPU only skeleton.

Parameters
fThe map functor, must be a 'curried' function pointer.
Returns
The newly created distributed array.
template<typename T>
template<typename R >
msl::DArray<R> msl::DArray< T >::map ( R(*)(T)  f)

Non-inplace variant of the map skeleton. Note that this is a CPU only skeleton.

Parameters
fThe map function.
template<typename T>
template<typename R , typename MapIndexFunctor >
DArray<R> msl::DArray< T >::mapIndex ( MapIndexFunctor &  f)

Returns a new distributed array with a_new[i] = f(i, a[i]). Note that besides the element itself also its index is passed to the functor.

Parameters
fThe mapIndex functor, must be of type AMapIndexFunctor.
Returns
The newly created distributed array.
template<typename T>
template<typename R , typename F >
DArray<R> msl::DArray< T >::mapIndex ( const msl::Fct2< int, T, R, F > &  f)

Non-inplace variant of the mapIndex skeleton. Note that this is a CPU only skeleton.

Parameters
fThe mapIndex functor, must be a 'curried' function pointer.
Returns
The newly created distributed array.
template<typename T>
template<typename R >
DArray<R> msl::DArray< T >::mapIndex ( R(*)(int, T)  f)

Non-inplace variant of the mapIndex skeleton. Note that this is a CPU only skeleton.

Parameters
fThe mapIndex function.
Returns
The newly created distributed array.
template<typename T>
template<typename MapIndexFunctor >
void msl::DArray< T >::mapIndexInPlace ( MapIndexFunctor &  f)

Replaces each element a[i] of the distributed array with f(i, a[i]). Note that besides the element itself also its index is passed to the functor.

Parameters
fThe mapIndex functor, must be of type AMapIndexFunctor.
template<typename T>
template<typename F >
void msl::DArray< T >::mapIndexInPlace ( const msl::Fct2< int, T, T, F > &  f)

Replaces each element a[i] of the distributed array with f(i, a[i]). Note that besides the element itself also its index is passed to the functor. Also note that this is a CPU only skeleton.

Parameters
fThe mapIndex functor, must be a 'curried' function pointer.
template<typename T>
void msl::DArray< T >::mapIndexInPlace ( T(*)(int, T)  f)

Replaces each element a[i] of the distributed array with f(i, a[i]). Note that besides the element itself also its index is passed to the functor. Also note that this is a CPU only skeleton.

Parameters
fThe mapIndex function.
template<typename T>
template<typename MapFunctor >
void msl::DArray< T >::mapInPlace ( MapFunctor &  f)

Replaces each element a[i] of the distributed array with f(a[i]).

Parameters
fThe map functor, must be of type AMapFunctor.
template<typename T>
template<typename F >
void msl::DArray< T >::mapInPlace ( const msl::Fct1< T, T, F > &  f)

Replaces each element a[i] of the distributed array with f(a[i]). Note that this is a CPU only skeleton.

Parameters
fThe map functor, must be a 'curried' function pointer.
template<typename T>
void msl::DArray< T >::mapInPlace ( T(*)(T)  f)

Replaces each element a[i] of the distributed array with f(a[i]). Note that this is a CPU only skeleton.

Parameters
fThe mapIndex function.
template<typename T>
template<typename R , typename MapStencilFunctor >
DArray<R> msl::DArray< T >::mapStencil ( MapStencilFunctor &  f,
neutral_value 
)

Non-inplace variant of the mapStencil skeleton.

See Also
mapStencilInPlace()
Parameters
fThe mapStencil functor, must be of type AMapStencilFunctor.
Returns
The newly created distributed array.
template<typename T>
template<typename MapStencilFunctor >
void msl::DArray< T >::mapStencilInPlace ( MapStencilFunctor &  f,
neutral_value 
)

Replaces each element a[i] of the distributed array with f(i, a). Note that the index i and the local partition is passed to the functor.

Parameters
fThe mapStencil functor, must be of type AMapStencilFunctor.
template<typename T>
DArray<T>& msl::DArray< T >::operator= ( const DArray< T > &  rhs)

Assignment operator.

Parameters
rhsRight hand side of assignment operator.
template<typename T>
template<class F >
void msl::DArray< T >::permutePartition ( const Fct1< int, int, F > &  f)
inline

Permutes the partitions of the distributed array according to the given function f. f must be bijective and return the ID of the new process p_i to store the partition, with 0 <= i < np.

Parameters
fThe bijective function, must be a curried function pointer.
template<typename T>
void msl::DArray< T >::permutePartition ( int(*)(int)  f)
inline

Permutes the partitions of the distributed array according to the given function f. f must be bijective and return the the ID of the new process p_i to store the partition, with 0 <= i < np.

Parameters
fThe bijective function.
template<typename T>
void msl::DArray< T >::set ( int  globalIndex,
const T &  v 
)

Sets the element at the given global index globalIndex to the given value v, with 0 <= globalIndex < size.

Parameters
globalIndexThe global index.
vThe new value.
template<typename T>
void msl::DArray< T >::setGpuDistribution ( Distribution  dist)

Set how the local partition is distributed among the GPUs. Current distribution schemes are: distributed, copy distributed.

Parameters
distThe GPU distribution scheme.
template<typename T>
void msl::DArray< T >::setLocal ( int  localIndex,
const T &  v 
)

Sets the element at the given local index localIndex to the given value v.

Parameters
localIndexThe local index.
vThe new value.
template<typename T>
void msl::DArray< T >::show ( const std::string &  descr = std::string())

Prints the distributed array to standard output. Optionally, the user may pass a description that will be printed with the output.

Parameters
descrThe description string.
template<typename T>
std::vector<T*> msl::DArray< T >::upload ( bool  allocOnly = 0)

Manually upload the local partition to GPU memory.

Parameters
allocOnlySpecifies whether data is actually uploaded.
Returns
Set of pointers to GPU memory, one pointer for each GPU.
template<typename T>
template<typename R , typename T2 , typename ZipFunctor >
DArray<R> msl::DArray< T >::zip ( DArray< T2 > &  b,
ZipFunctor &  f 
)

Non-inplace variant of the zip skeleton.

Parameters
fThe zip functor, must be of type AZipFunctor.
Returns
The newly created distributed array.
template<typename T>
template<typename R , typename T2 , typename F >
DArray<R> msl::DArray< T >::zip ( DArray< T2 > &  b,
const Fct2< T, T2, R, F > &  f 
)

Non-inplace variant of the zip skeleton. Note that this is a CPU only skeleton.

Parameters
fThe zip functor, must be a 'curried' function pointer.
Returns
The newly created distributed array.
template<typename T>
template<typename R , typename T2 >
DArray<R> msl::DArray< T >::zip ( DArray< T2 > &  b,
R(*)(T, T2)  f 
)

Non-inplace variant of the zip skeleton. Note that this is a CPU only skeleton.

Parameters
fThe zip function.
Returns
The newly created distributed array.
template<typename T>
template<typename R , typename T2 , typename ZipIndexFunctor >
DArray<R> msl::DArray< T >::zipIndex ( DArray< T2 > &  b,
ZipIndexFunctor &  f 
)

Non-inplace variant of the zipIndex skeleton.

Parameters
fThe zipIndex functor, must be of type AZipIndexFunctor.
Returns
The newly created distributed array.
template<typename T>
template<typename R , typename T2 , typename F >
DArray<R> msl::DArray< T >::zipIndex ( DArray< T2 > &  b,
const Fct3< int, T, T2, R, F > &  f 
)

Non-inplace variant of the zipIndex skeleton. Note that this is a CPU only skeleton.

Parameters
fThe zipIndex functor, must be a 'curried' function pointer.
Returns
The newly created distributed array.
template<typename T>
template<typename R , typename T2 >
DArray<R> msl::DArray< T >::zipIndex ( DArray< T2 > &  b,
R(*)(int, T, T2)  f 
)

Non-inplace variant of the zipIndex skeleton. Note that this is a CPU only skeleton.

Parameters
fThe zipIndex function.
Returns
The newly created distributed array.
template<typename T>
template<typename T2 , typename ZipIndexFunctor >
void msl::DArray< T >::zipIndexInPlace ( DArray< T2 > &  b,
ZipIndexFunctor &  f 
)

Replaces each element a[i] of the distributed array with f(i, a[i], b[i]). Note that besides the elements themselves also the index is passed to the functor.

Parameters
fThe zipIndex functor, must be of type AZipIndexFunctor.
template<typename T>
template<typename T2 , typename F >
void msl::DArray< T >::zipIndexInPlace ( DArray< T2 > &  b,
const Fct3< int, T, T2, T, F > &  f 
)

Replaces each element a[i] of the distributed array with f(i, a[i], b[i]). Note that besides the elements themselves also the index is passed to the functor. Note that this is a CPU only skeleton.

Parameters
fThe zipIndex functor, must be a 'curried' function pointer.
template<typename T>
template<typename T2 >
void msl::DArray< T >::zipIndexInPlace ( DArray< T2 > &  b,
T(*)(int, T, T2)  f 
)

Replaces each element a[i] of the distributed array with f(i, a[i], b[i]). Note that besides the elements themselves also the index is passed to the functor. Note that this is a CPU only skeleton.

Parameters
fThe zipIndex function.
template<typename T>
template<typename T2 , typename ZipFunctor >
void msl::DArray< T >::zipInPlace ( DArray< T2 > &  b,
ZipFunctor &  f 
)

Replaces each element a[i] of the distributed array with f(a[i], b[i]) with b being another distributed array of the same size.

Parameters
fThe zip functor, must be of type AZipFunctor.
template<typename T>
template<typename T2 , typename F >
void msl::DArray< T >::zipInPlace ( DArray< T2 > &  b,
const Fct2< T, T2, T, F > &  f 
)

Replaces each element a[i] of the distributed array with f(a[i], b[i]) with b being another distributed array of the same size. Note that this is a CPU only skeleton.

Parameters
fThe zip functor, must be a 'curried' function pointer.
template<typename T>
template<typename T2 >
void msl::DArray< T >::zipInPlace ( DArray< T2 > &  b,
T(*)(T, T2)  f 
)

Replaces each element a[i] of the distributed array with f(a[i], b[i]) with b being another distributed array of the same size. Note that this is a CPU only skeleton.

Parameters
fThe zip function.

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