Package Scientific :: Package BSP :: Class ParValue

[frames] | no frames]

# Class ParValue

    object --+
             |
            ParValue

Known Subclasses:
  - ParAccumulator
  - , ParConstant
  - , ParData
  - , ParFunction
  - , ParMessages
  - , ParSequence
  - , ParTuple

Global data

ParValue instances are created internally, but are not meant to be created directly by application programs. Use the subclasses instead.

ParValue objects (and those of subclasses) implement the standard arithmetic and comparison operations. They also support attribute requests which are passed on to the local values; the return values are ParValue objects. ParValue objects can also be called if their local values are callable.

Instance Methods

__add__(self, other) |

__call__(self, *args, **kwargs) |

__div__(self, other) |

__divmod__(self, other) |

__eq__(self, other) |

__ge__(self, other) |

__getattr__(self, attr) |

__getitem__(self, item) |

__gt__(self, other) |

__init__(self, value, valid=True) x.__init__(...) initializes x; see x.__class__.__doc__ for signature |

__le__(self, other) |

__len__(self) |

__lt__(self, other) |

__mod__(self, other) |

__mul__(self, other) |

__ne__(self, other) |

__neg__(self) |

__nonzero__(self) |

__pow__(self, other) |

__repr__(self) str(x) |

__str__(self) str(x) |

__sub__(self, other) |

ParValue

accumulate(self, operator, zero) Perform an accumulation over the local values of all processors. |

Local `bool`

alltrue(self) Returns: `True` if the local values on all processors are true. |

Local `bool`

anytrue(self) Returns: `True` if at least one of the local values on all processors is true. |

ParValue

broadcast(self, from_pid=0) Transmit the local data of one processor to all processors. |

ParValue

fullExchange(self) Transmit the local data of each processor to all other processors. |

ParValue

get(self, pid_list) Request the local data from all specified processors. |

getattr(self, attr) |

map(self, function) |

ParValue

put(self, pid_list) Send the local data to all specified processors. |

ParValue

reduce(self, operator, zero) Perform a reduction over the local values of all processors. |

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

Class Variables
| is_parvalue = `1`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, value, valid=True)
(Constructor)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  - `value` (any) - the local value
  - `valid` - `True` if the value is valid, `False` if it is not. Invalid values are not treated, any operation on them produces an invalid result.
Overrides: object.__init__

### __repr__(self)
(Representation operator)

str(x)

Overrides: object.__repr__
  (inherited documentation)

### __str__(self)
(Informal representation operator)

str(x)

Overrides: object.__str__
  (inherited documentation)

### accumulate(self, operator, zero)

Perform an accumulation over the local values of all processors.

Parameters:
  - `operator` (function of two variables) - the binary operator used in the accumulation
  - `zero` (any) - the initial value of the accumulation
Returns: ParValue
  on each processor, the reduction of the values from processors with a lower or equal number

### alltrue(self)

Returns: Local `bool`
  `True` if the local values on all processors are true.

### anytrue(self)

Returns: Local `bool`
  `True` if at least one of the local values on all processors is true.

### broadcast(self, from_pid=0)

Transmit the local data of one processor to all processors.

Parameters:
  - `from_pid` (`int`) - the ID of the processor that sends data
Returns: ParValue
  the transmitted data on all processors

### fullExchange(self)

Transmit the local data of each processor to all other processors.

Returns: ParValue
  the transmitted data on all processors

### get(self, pid_list)

Request the local data from all specified processors.

Parameters:
  - `pid_list` (Global `list` of `int`) - a list of processor IDs to which the data is sent.
Returns: ParValue
  a global object whose local value is a list of all the data received from other processors. The order of the data in that list is not defined.

### put(self, pid_list)

Send the local data to all specified processors.

Parameters:
  - `pid_list` (Global `list` of `int`) - a list of processor IDs to which the data is sent.
Returns: ParValue
  a global object whose local value is a list of all the data received from other processors. The order of the data in that list is not defined.

### reduce(self, operator, zero)

Perform a reduction over the local values of all processors.

Parameters:
  - `operator` (function of two variables) - the binary operator used in the reduction
  - `zero` (any) - the initial value of the reduction
Returns: ParValue
  the reduction on processor 0, zero elsewhere