code: def test_reduce_different_name(
      ray_start_distributed_multigpu_2_nodes_4_gpus,
      group_name,
      dst_rank,
      dst_gpu_index,
  ):
      world_size = 2
      num_gpu_per_worker = 2
      actual_world_size = world_size * num_gpu_per_worker
      actors, _ = create_collective_multigpu_workers(
          num_workers=world_size, group_name=group_name
      )
      results = ray.get(
          [
              a.do_reduce_multigpu.remote(
                  group_name,
                  dst_rank=dst_rank,
                  dst_gpu_index=dst_gpu_index,
              )
              for a in actors
          ]
      )
      for i in range(world_size):
          for j in range(num_gpu_per_worker):
              if i == dst_rank and j == dst_gpu_index:
                  assert (
                      results[i][j]
                      == cp.ones((10,), dtype=cp.float32)
                      * actual_world_size
                  ).all()
              else:
                  assert (
                      results[i][j] == cp.ones((10,), dtype=cp.float32)
                  ).all()
  
file_path: ray/python/ray/util/collective/tests/distributed_multigpu_tests/test_distributed_multigpu_reduce.py
imports: import pytest
  import cupy
  import ray
  from ray.util.collective.types import ReduceOp
  from ray.util.collective.tests.util import create_collective_multigpu_workers
label_desc: Use image node_id 1 for calling a global function with example usage: test_reduce_different_name(ray_start_distributed_multigpu_2_nodes_4_gpus, group_name, dst_rank, dst_gpu_index) without return types