code: def fastnlp_paddle_broadcast_object(
      obj, src, device=None, group=None
  ):
      """
      将 src 上的 obj 对象广播到其它 rank 上。
  
      :param obj: 需要发送的对象
      :param src: 从哪里发出。
      :param device:
      :param group: 属于哪个通信 group
      :return:
      """
      if int(os.environ.get(FASTNLP_NO_SYNC, "0")) == 2:
          if src == dist.get_rank():
              return obj
          else:
              return None
  
      cur_rank = dist.get_rank()
      if cur_rank == src:
          # 如果有 tensor 全部移动到 cpu 上，方便 pickle , 不然 unpickle 的时候可能会 pickle 到发送过来的卡那里
          obj = paddle_move_data_to_device(obj, "cpu")
  
      if device is None:
          device = paddle.device.get_device()
  
      if cur_rank == src:
          tensor, size = _object_to_tensor(obj, device=device)
      else:
          size = paddle_move_data_to_device(
              paddle.to_tensor([0]), device
          )
  
      dist.broadcast(size, src=src, group=group)
      if cur_rank != src:
          tensor = paddle.empty(
              size.astype(paddle.int32),  # type: ignore[arg-type]
              dtype=paddle.int32,
          )
      dist.broadcast(tensor, src=src, group=group)
  
      return _tensor_to_object(tensor, tensor_size=size.item())
  
file_path: fastNLP/fastNLP/core/drivers/paddle_driver/dist_utils.py
imports: import io
  import pickle
  import os
  from typing import Any, List
  import numpy
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE
  from fastNLP.envs.env import FASTNLP_NO_SYNC
  from fastNLP.core.utils import paddle_move_data_to_device
label_desc: Use image node_id 9 for calling a global function with example usage: fastnlp_paddle_broadcast_object(obj, src, device, group) and returns: _tensor_to_object, obj, None