code: def get_model_parallel_src_rank():
      """Calculate the global rank corresponding to the first local rank
      in the model parallel group."""
      world_size = torch.distributed.get_world_size()
      all_ranks = np.arange(world_size)
      tp_size = parallel_state.get_tensor_model_parallel_world_size()
      pp_size = parallel_state.get_pipeline_model_parallel_world_size()
      # [pipeline dim, data parallel, tensor dim]
      all_ranks = all_ranks.reshape(pp_size, -1, tp_size)
      dp_rank = parallel_state.get_data_parallel_rank()
      return all_ranks[:, dp_rank, :].min()
  
imports: import os
  import pickle
  import re
  from collections.abc import Iterable
  from functools import partial
  from typing import Callable, Tuple
  import numpy
  import torch
  import torch.nn.functional
  from nemo.collections.common.tokenizers.tabular_tokenizer import TabularTokenizer
  from nemo.collections.nlp.modules.common.megatron.utils import get_ltor_masks_and_position_ids
  from nemo.collections.nlp.modules.common.text_generation_strategy import model_inference_strategy_dispatcher
  from nemo.collections.nlp.modules.common.transformer.text_generation import LengthParam, OutputType, SamplingParam
  from nemo.utils import AppState
label_desc: Use image node_id 10 for calling a global function with example usage: get_model_parallel_src_rank() and returns: all_ranks