code: def send_recv_object(obj, src, cur_rank, device, group=None, tag=0):
      r"""
      pytorch 中的单点对多点的分发函数；
  
      例如将进程 0 上的对象 object 分发到其它进程上。
  
      Example::
  
          cur_rank = int(os.environ.get('LOCAL_RANK', 0))
  
          # 拿到 local_device
  
          send_recv_object(object, 0, cur_rank, local_device)
  
      :param obj: 一个可以序列化的 python 对象。
      :param src: 从哪一个 rank 上发送到其它 rank。
      :param cur_rank: 当前的进程的 rank 序号。
      :param device: 当前的进程所在的设备。
      :param group: 通信组，默认为 None。
      :param tag: 将发送与远程接收匹配的标记；
      :return:
      """
      # src rank send to all other ranks
      size = torch.LongTensor([0]).to(device)
  
      if cur_rank == src:
          world_size = dist.get_world_size(group=group)
          tensor, size = _object_to_tensor(obj)
          tensor = tensor.to(device)
          size = size.to(device)
  
          # 首先同步 obj 的 size 的信息；
          dist.broadcast(size, src, group=group)
          for subrank in range(world_size):
              if subrank != src:
                  dist.send(
                      tensor=tensor, dst=subrank, group=group, tag=tag
                  )
      else:
          dist.broadcast(size, src, group=group)
          tensor = torch.ByteTensor([0] * size).to(device)
          dist.recv(tensor=tensor, src=src, group=group, tag=tag)
  
      return _tensor_to_object(tensor.cpu(), size)
  
file_path: fastNLP/fastNLP/core/drivers/torch_driver/dist_utils.py
imports: import io
  import pickle
  import os
  from typing import Any, List
  from fastNLP.envs.imports import _TORCH_GREATER_EQUAL_1_8
  from fastNLP.core.utils.torch_utils import DEFAULT_TORCH_GROUP
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP.envs.env import FASTNLP_NO_SYNC
  from fastNLP.core.utils import apply_to_collection
label_desc: Use image node_id 5 for calling a global function with example usage: send_recv_object(obj, src, cur_rank, device, group, tag) and returns: _tensor_to_object