Dune::CollectiveCommunication< C > Class Template Reference
[Parallel Communication]

#include <collectivecommunication.hh>

List of all members.


Detailed Description

template<typename C>
class Dune::CollectiveCommunication< C >

Collective communication interface and sequential default implementation.

CollectiveCommunication offers an abstraction to the basic methods of parallel communication, following the message-passing paradigm. It allows to switch parallel features on and of, without changing the code. Currently only MPI and sequential code are supported.

A CollectiveCommunication object is returned by all grids (also the sequential ones) in order to allow code to be written in a transparent way for sequential and parallel grids.

This class provides a default implementation for sequential grids. The number of processes involved is 1, any sum, maximum, etc. returns just its input argument and so on.

In specializations one can implement the real thing using appropriate communication functions, e.g. there exists an implementation using the Message Passing Interface (MPI), see Dune::CollectiveCommunication<MPI_Comm>.

Moreover, the communication subsystem used by an implementation is not visible in the interface, i.e. Dune grid implementations are not restricted to MPI.


Public Member Functions

 CollectiveCommunication ()
 Construct default object.
int rank () const
 Return rank, is between 0 and size()-1.
int size () const
 Number of processes in set, is greater than 0.
template<typename T>
sum (T &in) const
 Compute the sum of the argument over all processes and return the result in every process. Assumes that T has an operator+.
template<typename T>
int sum (T *inout, int len) const
 Compute the sum over all processes for each component of an array and return the result in every process. Assumes that T has an operator+.
template<typename T>
prod (T &in) const
 Compute the product of the argument over all processes and return the result in every process. Assumes that T has an operator*.
template<typename T>
int prod (T *inout, int len) const
 Compute the product over all processes for each component of an array and return the result in every process. Assumes that T has an operator*.
template<typename T>
min (T &in) const
 Compute the minimum of the argument over all processes and return the result in every process. Assumes that T has an operator<.
template<typename T>
int min (T *inout, int len) const
 Compute the minimum over all processes for each component of an array and return the result in every process. Assumes that T has an operator<.
template<typename T>
max (T &in) const
 Compute the maximum of the argument over all processes and return the result in every process. Assumes that T has an operator<.
template<typename T>
int max (T *inout, int len) const
 Compute the maximum over all processes for each component of an array and return the result in every process. Assumes that T has an operator<.
int barrier () const
 Wait until all processes have arrived at this point in the program.
template<typename T>
int broadcast (T *inout, int len, int root) const
 Distribute an array from the process with rank root to all other processes.
template<typename T>
int gather (T *in, T *out, int len, int root) const
 Each process sends its in array of length len to the root process (including the root itself). In the root process these arrays are stored in rank order in the out array which must have size len * number of processes.
template<typename BinaryFunction, typename Type>
int allreduce (Type *inout, int len) const
 Compute something over all processes for each component of an array and return the result in every process.
template<typename BinaryFunction, typename Type>
void allreduce (Type *in, Type *out, int len) const
 Compute something over all processes for each component of an array and return the result in every process.

Member Function Documentation

template<typename C>
template<typename BinaryFunction, typename Type>
int Dune::CollectiveCommunication< C >::allreduce ( Type *  inout,
int  len 
) const [inline]

Compute something over all processes for each component of an array and return the result in every process.

The template parameter BinaryFunction is the type of the binary function to use for the computation

Parameters:
inout The array to compute on.
len The number of components in the array

template<typename C>
template<typename BinaryFunction, typename Type>
void Dune::CollectiveCommunication< C >::allreduce ( Type *  in,
Type *  out,
int  len 
) const [inline]

Compute something over all processes for each component of an array and return the result in every process.

The template parameter BinaryFunction is the type of the binary function to use for the computation

Parameters:
in The array to compute on.
out The array to store the results in.
len The number of components in the array


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

Generated on 9 Apr 2008 with Doxygen (ver 1.5.2) [logfile].