ptypy.utils.parallel.bcast#

ptypy.utils.parallel.bcast(data, source=0)#

Wrapper for comm.bcast and comm.Bcast. If data is a numpy.ndarray, a header will be broadcasted first with comm.bcast that contains information on array shape and data type. Afterwards the array will be sent with comm.Bcast. If data is not a numpy.ndarray, the whole object will be pickled and broadcasted with comm.bcast in one go.

Parameters:
  • data (ndarray or other) – Object to send

  • source (int) – The rank of the source node / process. Defaults to 0 (master).

  • tag (int) – Defaults to 0.

See also

receive, send