code: def run_dist(
      rank: int,
      world_size: int,
      port: int,
      strategy_name: str,
      shard: bool,
  ):
      os.environ["RANK"] = str(rank)
      os.environ["LOCAL_RANK"] = str(rank)
      os.environ["WORLD_SIZE"] = str(world_size)
      os.environ["MASTER_ADDR"] = "localhost"
      os.environ["MASTER_PORT"] = str(port)
      run_test_checkpoint(strategy_name, shard)
  
file_path: colossalai/applications/Chat/tests/test_checkpoint.py
imports: import os
  import tempfile
  from contextlib import nullcontext
  import pytest
  import torch
  import torch.distributed
  from coati.models.gpt import GPTActor
  from coati.models.utils import calc_action_log_probs
  from coati.trainer.strategies import DDPStrategy, GeminiStrategy, LowLevelZeroStrategy, Strategy
  from transformers.models.gpt2.configuration_gpt2 import GPT2Config
  from colossalai.nn.optimizer import HybridAdam
  from colossalai.testing import rerun_if_address_is_in_use, spawn
label_desc: Use image node_id 4 for calling a global function with example usage: run_dist(rank, world_size, port, strategy_name, shard) without return types