dmlcloud.broadcast_object
- dmlcloud.broadcast_object(obj=None, src=0, group=None, device=None)
Broadcasts an object from the source rank to all other ranks in the group.
This is a wrapper around torch.distributed.broadcast_object_list that broadcasts a single object.
- Parameters:
obj (Any, optional) – The object to broadcast. Must be pickable. Only used on the source rank. Default is None.
src (int) – Source rank from which to broadcast the object. Source rank is based on global process group (regardless of group argument)
group (ProcessGroup, optional) – The process group to work on. If None, the default process group will be used. Default is None.
device (torch.device, optional) – If not None, the object is serialized and converted to as tensor which is moved to the device before broadcasting. Default is None.
- Returns:
The broadcasted object.