code: def test_get_rank(ray_start_distributed_multigpu_2_nodes_4_gpus):
      world_size = 2
      actors, _ = create_collective_multigpu_workers(world_size)
      actor0_rank = ray.get(actors[0].report_rank.remote())
      assert actor0_rank == 0
      actor1_rank = ray.get(actors[1].report_rank.remote())
      assert actor1_rank == 1
  
      # create a second group with a different name, and different
      # orders of ranks.
      new_group_name = "default2"
      ranks = list(range(world_size))
      shuffle(ranks)
      ray.get(
          [
              actor.init_group.remote(
                  world_size, ranks[i], group_name=new_group_name
              )
              for i, actor in enumerate(actors)
          ]
      )
      actor0_rank = ray.get(
          actors[0].report_rank.remote(new_group_name)
      )
      assert actor0_rank == ranks[0]
      actor1_rank = ray.get(
          actors[1].report_rank.remote(new_group_name)
      )
      assert actor1_rank == ranks[1]
  
file_path: ray/python/ray/util/collective/tests/distributed_multigpu_tests/test_distributed_multigpu_basic_apis.py
imports: import pytest
  import ray
  from random import shuffle
  from ray.util.collective.tests.util import create_collective_multigpu_workers
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_rank(ray_start_distributed_multigpu_2_nodes_4_gpus) without return types