send_object_list
- paddle.distributed. send_object_list ( object_list: list[Any], dst: int | None = None, group: Group | None = None, dst_in_group: int | None = None ) [source]
-
Send a list of Python objects to the receiver.
- Parameters
-
object_list (list) – The list of Python objects to send.
dst (int, optional) – The destination rank id. Default: 0.
group (Group, optional) – The group instance return by new_group or None for global default group. Default: None.
dst_in_group (int, optional) – The destination rank within the group. Cannot be specified together with dst. Default: None.
- Returns
-
This function does not return any value.
Examples
>>> >>> import paddle >>> import paddle.distributed as dist >>> dist.init_parallel_env() >>> if dist.get_rank() == 0: ... data = ["hello", {"key": 100}, [1, 2, 3]] ... dist.send_object_list(data, dst=1) >>> else: ... data = [None] * 3 # type: ignore ... dist.recv_object_list(data, src=0) >>> print(data) >>> # ["hello", {"key": 100}, [1, 2, 3]] (2 GPUs)