code: def test_allreduce_different_array_size(
      ray_start_distributed_2_nodes_4_gpus, array_size
  ):
      world_size = 4
      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_allreduce.remote() for a in actors])
      assert (
          results[0]
          == cp.ones((array_size,), dtype=cp.float32) * world_size
      ).all()
      assert (
          results[1]
          == cp.ones((array_size,), dtype=cp.float32) * world_size
      ).all()
  
file_path: ray/python/ray/util/collective/tests/distributed_gpu_tests/test_distributed_allreduce.py
imports: import pytest
  import ray
  from ray.util.collective.types import ReduceOp
  import cupy
  import torch
  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_allreduce_different_array_size(ray_start_distributed_2_nodes_4_gpus, array_size) without return types