ptypy.utils.parallel.bcast_dict#

ptypy.utils.parallel.bcast_dict(dct, keys='all', source=0)#

Broadcasts or scatters a dict dct from rank==source.

Parameters:
  • keys (list or 'all') – List of keys whose values are accepted at each node. In case of keys=all, every node accepts all items and bcast_dict acts as broadcast.

  • source (int) – Rank of node / process which broadcasts / scatters.

Returns:

dct – A smaller dictionary with values to keys if that key was in source dictionary.

Return type:

dict

Note

There is no guarantee that each key,value pair is accepted at other nodes, except for keys='all'. Also in this implementation the input dct from source is completely transmitted to every node, potentially creating a large overhead for may nodes and huge dictionarys

Deleting reference in input dictionary may result in data loss at rank==source

See also

gather_dict