code: def setup_ddp(rank: int, world_size: int, master_port: int) -> None:
      """Setup ddp environment."""
  
      os.environ["MASTER_ADDR"] = "localhost"
      os.environ["MASTER_PORT"] = str(master_port)
      if torch.distributed.is_available() and sys.platform not in (
          "win32",
          "cygwin",
      ):
          torch.distributed.init_process_group(
              "gloo", rank=rank, world_size=world_size
          )
  
imports: import os, sys
  import socket
  from typing import Union
  import numpy
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
label_desc: Use image node_id 1 for calling a global function with example usage: setup_ddp(rank, world_size, master_port) without return types