code: def init_process_groups(grid):
      global _groups, _grid
      _grid = grid
  
      assert (
          _grid.pipe_parallel_size > 1
      ), "There is no pipeline parallelism"
  
      if not can_send_recv():
          _groups = [
              dist.new_group(ranks=group) for group in _grid.p2p_groups
          ]
  
file_path: H2O/h2o_flexgen/benchmark/third_party/DeepSpeed/deepspeed/runtime/pipe/p2p.py
imports: import pickle
  import typing
  import torch
  from deepspeed import comm
  from packaging.version import Version
  from deepspeed.git_version_info import torch_info
label_desc: Use image node_id 2 for calling a global function with example usage: init_process_groups(grid) without return types