Package Scientific :: Package BSP :: Class ParAccumulator
[hide private]
[frames] | no frames]

Class ParAccumulator



object --+    
         |    
  ParValue --+
             |
            ParAccumulator

Global accumulator

ParAccumulator objects are used to perform iterative reduction operations in loops. The initial local value is zero (i.e. the passed-in zero object, not the number 0), which is modified by subsequent calls to the method addValue.

Instance Methods [hide private]
  __init__(self, operator, zero)
  addValue(self, value)
Replace the internal value of the accumulator by internal_value = operator(internal_value, value).
ParValue calculateTotal(self)
Returns a reduction over the local values on all processors

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __getitem__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __repr__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__


Class Variables [hide private]

Inherited from ParValue: is_parvalue


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, operator, zero)
(Constructor)

 
Parameters:
  • operator (function of two variables) - a local function taking two arguments and returning one argument of the same type
  • zero - the initial value for reduction
Overrides: ParValue.__init__

addValue(self, value)

 

Replace the internal value of the accumulator by internal_value = operator(internal_value, value).

calculateTotal(self)

 
Returns: ParValue
a reduction over the local values on all processors