code: def model_parallel_cuda_manual_seed(seed):
      """Initialize model parallel cuda seed.
  
      This function should be called after the model parallel is
      initialized. Also, no torch.cuda.manual_seed should be called
      after this function. Basically, this is replacement for that
      function.
      Two set of RNG states are tracked:
      default state: This is for data parallelism and is the same among a set of model parallel GPUs but different across different model paralle groups. This is used for example for dropout in the non-tensor-model-parallel regions.
      tensor-model-parallel state: This state is different among a set of model parallel GPUs, but the same across data parallel groups. This is used for example for dropout in model parallel regions.
      """
      # 2718 is just for fun and any POSITIVE value will work.
      offset = seed + 2718
      tensor_model_parallel_seed = (
          offset + get_tensor_model_parallel_rank()
      )
      # Data parallel gets the original seed.
      data_parallel_seed = seed
  
      _CUDA_RNG_STATE_TRACKER.reset()
      # Set the default state.
      torch.cuda.manual_seed(data_parallel_seed)
      _CUDA_RNG_STATE_TRACKER.add(
          _DATA_PARALLEL_RNG_TRACKER_NAME, data_parallel_seed
      )
  
      # and model parallel state.
      _CUDA_RNG_STATE_TRACKER.add(
          _MODEL_PARALLEL_RNG_TRACKER_NAME, tensor_model_parallel_seed
      )
  
      expert_parallel_seed = (
          seed
          + 1024
          + 100 * get_expert_model_parallel_rank()
          + get_tensor_model_parallel_rank()
      )
      _CUDA_RNG_STATE_TRACKER.add(
          _EXPERT_PARALLEL_RNG_TRACKER_NAME, expert_parallel_seed
      )
  
imports: import contextlib
  import torch
  from torch import _C
  from torch.cuda import _lazy_call
  from torch.cuda import device
  from torch.utils.checkpoint import detach_variable
  from megatron.core.parallel_state import get_data_parallel_rank, get_expert_model_parallel_rank, get_tensor_model_parallel_group, get_tensor_model_parallel_rank, get_tensor_model_parallel_world_size
  from megatron.core.utils import safely_set_viewless_tensor_data
  from .utils import gather_split_1d_tensor, split_tensor_into_1d_equal_chunks
label_desc: Use image node_id 5 for calling a global function with example usage: model_parallel_cuda_manual_seed(seed) without return types