code: def run_test_get_model_parallel_src_rank(
      rank, model_parallel_size_, filename, filename_rpc
  ):
      dist_init(rank, model_parallel_size_, filename, filename_rpc)
  
      if torch.distributed.get_rank() == 0:
          print(
              "> testing get_model_parallel_src_rank with size {} ...".format(
                  model_parallel_size_
              )
          )
      model_parallel_size = min(
          model_parallel_size_, torch.distributed.get_world_size()
      )
      assert not mpu.model_parallel_is_initialized()
      mpu.initialize_model_parallel(model_parallel_size)
      assert mpu.model_parallel_is_initialized()
  
      # Checks
      src_rank = (
          torch.distributed.get_rank() - mpu.get_model_parallel_rank()
      )
      assert mpu.get_model_parallel_src_rank() == src_rank
  
      # Reset groups
      mpu.destroy_model_parallel()
  
      torch.distributed.barrier()
      if torch.distributed.get_rank() == 0:
          print(">> passed the test :-)")
  
imports: import torch
  from fairscale.fair_dev.testing.testing import dist_init, spawn_for_all_world_sizes
  from fairscale.nn.model_parallel import initialize
label_desc: Use image node_id 2 for calling a global function with example usage: run_test_get_model_parallel_src_rank(rank, model_parallel_size_, filename, filename_rpc) without return types