code: def setup_distributed(cfg_state):
      """
      Initialize torch.distributed and set the CUDA device.
  
      Expects environment variables to be set as per
      https://pytorch.org/docs/stable/distributed.html#environment-variable-initialization
      along with the environ variable "LOCAL_RANK" which is used to set the CUDA device.
  
      This is run inside a new process, so the cfg is reset and must be set explicitly.
      """
      cfg.defrost()
      cfg.update(**cfg_state)
      cfg.freeze()
      local_rank = int(os.environ["LOCAL_RANK"])
      torch.distributed.init_process_group(backend=cfg.DIST_BACKEND)
      torch.cuda.set_device(local_rank)
  
file_path: pycls/pycls/core/distributed.py
imports: import os
  import random
  import submitit
  import torch
  from pycls.core.config import cfg
label_desc: Use image node_id 3 for calling a global function with example usage: setup_distributed(cfg_state) without return types