code: def fastnlp_oneflow_broadcast_object(obj, src, device=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_env.get_rank():
              return obj
          else:
              return None
  
      cur_rank = dist_env.get_rank()
      if cur_rank == src:
          # 如果有 tensor 全部移动到 cpu 上，方便 pickle , 不然 unpickle 的时候可能会 pickle 到发送过来的卡那里
          obj = apply_to_collection(
              obj,
              oneflow.Tensor,
              _to_device,
              device=oneflow.device("cpu"),
          )
      if device is None:
          device = oneflow.cuda.current_device()
      device = get_oneflow_device(device)
  
      if cur_rank == src:
          tensor, size = _object_to_tensor(obj, device=device)
      else:
          size = oneflow.LongTensor([0]).to(device)
  
      comm.broadcast(size, src=src)
      if cur_rank != src:
          tensor = oneflow.empty(
              size.int().item(),  # type: ignore[arg-type]
              dtype=oneflow.uint8,
              device=device,
          )
      comm.broadcast(tensor, src=src)
  
      return _tensor_to_object(tensor, tensor_size=size.item())
  
file_path: fastNLP/fastNLP/core/drivers/oneflow_driver/dist_utils.py
imports: import io
  import pickle
  import os
  from typing import Any, List
  from fastNLP.core.utils import apply_to_collection, get_oneflow_device
  from fastNLP.envs.imports import _NEED_IMPORT_ONEFLOW
  from fastNLP.envs.env import FASTNLP_NO_SYNC
label_desc: Use image node_id 8 for calling a global function with example usage: fastnlp_oneflow_broadcast_object(obj, src, device) and returns: _tensor_to_object, obj, None