all_gather_object¶
- paddle.distributed. all_gather_object ( object_list, obj, group=None ) [source]
-
Gather picklable objects from all participators and all get the result. Similiar to all_gather(), but python object can be passed in.
- Parameters
-
object_list (list) – A list of output object. The datatype of every element in the list is same as the input obj.
obj (Any) – The picklable object to send.
group (Group) – The group instance return by new_group or None for global default group.
- Returns
-
None.
Warning
This API only supports the dygraph mode.
Examples
# required: distributed import paddle import paddle.distributed as dist dist.init_parallel_env() object_list = [] if dist.get_rank() == 0: obj = {"foo": [1, 2, 3]} else: obj = {"bar": [4, 5, 6]} dist.all_gather_object(object_list, obj) print(object_list) # [{'foo': [1, 2, 3]}, {'bar': [4, 5, 6]}] (2 GPUs)