code: def set_env_vars(local_rank: int, node_id: int, cfg: AttrDict):
      """
      Set some environment variables like total number of gpus used in training,
      distributed rank and local rank of the current gpu, whether to print the
      nccl debugging info and tuning nccl settings.
      """
      os.environ["WORLD_SIZE"] = str(
          cfg.DISTRIBUTED.NUM_NODES * cfg.DISTRIBUTED.NUM_PROC_PER_NODE
      )
      dist_rank = (
          cfg.DISTRIBUTED.NUM_PROC_PER_NODE * node_id + local_rank
      )
      os.environ["RANK"] = str(dist_rank)
      os.environ["LOCAL_RANK"] = str(local_rank)
      if cfg.DISTRIBUTED.NCCL_DEBUG:
          os.environ["NCCL_DEBUG"] = "INFO"
      if cfg.DISTRIBUTED.NCCL_SOCKET_NTHREADS:
          logging.info(
              f"local_rank: {local_rank}, "
              f"using NCCL_SOCKET_NTHREADS: {cfg.DISTRIBUTED.NCCL_SOCKET_NTHREADS}"
          )
          os.environ["NCCL_SOCKET_NTHREADS"] = str(
              cfg.DISTRIBUTED.NCCL_SOCKET_NTHREADS
          )
  
imports: import logging
  import os
  from vissl.config import AttrDict
label_desc: Use image node_id 1 for calling a global function with example usage: set_env_vars(local_rank, node_id, cfg) without return types