pyDive.cloned_ndarray package

Submodules

pyDive.cloned_ndarray.cloned_ndarray module

class pyDive.cloned_ndarray.cloned_ndarray.cloned_ndarray(shape, dtype=<type 'float'>, target_ranks='all', no_allocation=False)[source]

Represents a multidimensional, homogenous array of fixed-size elements which is cloned on the cluster nodes. Cloned means that every participating engine holds an independent, local numpy-array of the user-defined shape. The user can then do e.g. some manual stuff on the local arrays or some computation with pyDive.algorithm on them.

Note that there exists no ‘original’ array as the name might suggest but something like that can be generated by merge().

__init__(shape, dtype=<type 'float'>, target_ranks='all', no_allocation=False)[source]

Creates an pyDive.cloned_ndarray.cloned_ndarray.cloned_ndarray instance. This is a low-level method for instanciating a cloned_array. Cloned arrays should be constructed using ‘empty’, ‘zeros’ or ‘empty_targets_like’ (see pyDive.cloned_ndarray.factories).

Parameters:
  • shape (ints) – size of the array on each axis
  • dtype (numpy-dtype) – datatype of a single data value
  • target_ranks (ints) – list of engine-ids that share this array. Or ‘all’ for all engines.
  • no_allocation (bool) – if True no actual memory, i.e. numpy-array, will be allocated on engine. Useful when you want to assign an existing numpy array manually.
merge(op)[source]

Merge all local arrays in a pair-wise operation into a single numpy-array.

Parameters:op – Merging operation. Expects two numpy-arrays and returns one.
Returns:merged numpy-array.
sum()[source]

Add up all local arrays.

Returns:numpy-array.

pyDive.cloned_ndarray.factories module

This module holds high-level functions for instanciating pyDive.cloned_ndarrays.

pyDive.cloned_ndarray.factories.empty(shape, dtype=<type 'float'>)[source]

Return a new pyDive.cloned_ndarray package utilizing all engines without initializing elements.

Parameters:
  • shape (ints) – shape of the array
  • dtype (numpy-dtype) – datatype of a single data value
pyDive.cloned_ndarray.factories.empty_engines_like(shape, dtype, a)[source]

Return a new pyDive.cloned_ndarray utilizing the same engines a does without initializing elements.

Parameters:
pyDive.cloned_ndarray.factories.hollow(shape, dtype=<type 'float'>)[source]
Return a new pyDive.cloned_ndarray package utilizing all engines without allocating a local
numpy-array.
Parameters:
  • shape (ints) – shape of the array
  • dtype (numpy-dtype) – datatype of a single data value
pyDive.cloned_ndarray.factories.hollow_engines_like(shape, dtype, a)[source]

Return a new pyDive.cloned_ndarray utilizing the same engines a does without allocating a local numpy-array.

Parameters:
pyDive.cloned_ndarray.factories.ones(shape, dtype=<type 'float'>)[source]

Return a new pyDive.cloned_ndarray package utilizing all engines filled with ones.

Parameters:
  • shape (ints) – shape of the array
  • dtype (numpy-dtype) – datatype of a single data value
pyDive.cloned_ndarray.factories.zeros(shape, dtype=<type 'float'>)[source]

Return a new pyDive.cloned_ndarray package utilizing all engines filled with zeros.

Parameters:
  • shape (ints) – shape of the array
  • dtype (numpy-dtype) – datatype of a single data value
pyDive.cloned_ndarray.factories.zeros_engines_like(shape, dtype, a)[source]

Return a new pyDive.cloned_ndarray package utilizing the same engines a does filled with zeros.

Parameters: