code: def test_reduce_different_array_size(
      ray_start_single_node_2_gpus, array_size, dst_rank
  ):
      world_size = 2
      actors, _ = create_collective_workers(world_size)
      ray.wait(
          [
              a.set_buffer.remote(cp.ones(array_size, dtype=cp.float32))
              for a in actors
          ]
      )
      results = ray.get(
          [a.do_reduce.remote(dst_rank=dst_rank) for a in actors]
      )
      for i in range(world_size):
          if i == dst_rank:
              assert (
                  results[i]
                  == cp.ones((array_size,), dtype=cp.float32)
                  * world_size
              ).all()
          else:
              assert (
                  results[i] == cp.ones((array_size,), dtype=cp.float32)
              ).all()
  
file_path: ray/python/ray/util/collective/tests/single_node_gpu_tests/test_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_workers
label_desc: Use image node_id 2 for calling a global function with example usage: test_reduce_different_array_size(ray_start_single_node_2_gpus, array_size, dst_rank) without return types