code: def test_initialize_model_parallel(self) -> None:
      self.assertFalse(parallel_state.model_parallel_is_initialized())
  
      for tensor_model_parallel_world_size in range(
          1, self.world_size + 1
      ):
          msg = f"tensor_model_parallel_world_siz: {tensor_model_parallel_world_size}"
          if self.world_size % tensor_model_parallel_world_size:
              continue
  
          pipeline_model_parallel_world_size = (
              self.world_size // tensor_model_parallel_world_size
          )
  
          parallel_state.initialize_model_parallel(
              tensor_model_parallel_size_=tensor_model_parallel_world_size,
              pipeline_model_parallel_size_=pipeline_model_parallel_world_size,
          )
          self.assertEqual(
              tensor_model_parallel_world_size,
              parallel_state.get_tensor_model_parallel_world_size(),
              msg=msg,
          )
          expected_tensor_model_parallel_rank = (
              calc_expected_tensor_model_paralell_rank(
                  self.rank, tensor_model_parallel_world_size
              )
          )
          self.assertEqual(
              expected_tensor_model_parallel_rank,
              parallel_state.get_tensor_model_parallel_rank(),
              msg=msg,
          )
  
          expected_tensor_model_parallel_src_rank = (
              self.rank // tensor_model_parallel_world_size
          ) * tensor_model_parallel_world_size
          self.assertEqual(
              expected_tensor_model_parallel_src_rank,
              parallel_state.get_tensor_model_parallel_src_rank(),
              msg=msg,
          )
  
          parallel_state.destroy_model_parallel()
          self.assertFalse(
              parallel_state.model_parallel_is_initialized(), msg=msg
          )
  
file_path: apex/tests/L0/run_transformer/test_parallel_state.py
imports: import logging
  import os
  from torch.testing._internal import common_utils
  from apex.transformer import parallel_state
  from apex.transformer.testing.distributed_test_base import NcclDistributedTestBase
  from apex.transformer.testing.distributed_test_base import UccDistributedTestBase
label_desc: Use image node_id 1 for calling the ParallelStateTestBase obj's underlying member method code with example usage: obj.test_initialize_model_parallel() without return types