Reduction operations

Reduction operations are based on STL-like functional operators. A functional operator defines the operation to execute in its operator(). Like MPI user-defined reduction functions, this operator is binary, i.e. takes two inputs to combine and returns the result in its first argument. The functional operators also define a static boolean field commute which is true, if the operation can be excuted in arbitrary order. An example for a sum operators is given below:

// user-defined operator for reduce/scan
template <class T>
class sum {
  void operator() (T& inout, const T& in) {
    inout += in;
  static bool commute;
template <class T>
bool sum<T>::commute = true;

Unlike functional operators used in the STL, it makes no sense to define operators which rely on an internal state, because the operator may be executed on different (unknown) hosts.

Patrick Heckeler 2007-05-31