code: def initialize_pg(init_method, rank: int, world_size: int) -> None:
      # This is for tests using `dist.barrier`.
      if not dist.is_initialized():
          dist.init_process_group(
              backend="gloo",
              init_method=init_method,
              rank=rank,
              world_size=world_size,
          )
  
file_path: pytorch/torch/testing/_internal/dist_utils.py
imports: import re
  import sys
  import time
  from functools import partial, wraps
  from typing import Tuple
  import torch.distributed
  import torch.distributed.rpc
  from torch.distributed.rpc import _rref_context_get_debug_info
  from torch.testing._internal.common_utils import FILE_SCHEMA, TEST_WITH_TSAN
label_desc: Use image node_id 7 for calling a global function with example usage: initialize_pg(init_method, rank, world_size) without return types