code: def test_allreduce_multigpu_different_op(
      ray_start_distributed_multigpu_2_nodes_4_gpus,
  ):
      world_size = 2
      actors, _ = create_collective_multigpu_workers(world_size)
      # check product
      ray.get(actors[0].set_buffer.remote([10], value0=2, value1=3))
      ray.get(actors[1].set_buffer.remote([10], value0=4, value1=5))
      results = ray.get(
          [
              a.do_allreduce_multigpu.remote(op=ReduceOp.PRODUCT)
              for a in actors
          ]
      )
      assert (
          results[0] == cp.ones((10,), dtype=cp.float32) * 120
      ).all()
      assert (
          results[1] == cp.ones((10,), dtype=cp.float32) * 120
      ).all()
  
      # check min
      ray.get(actors[0].set_buffer.remote([10], value0=2, value1=3))
      ray.get(actors[1].set_buffer.remote([10], value0=4, value1=5))
      results = ray.get(
          [
              a.do_allreduce_multigpu.remote(op=ReduceOp.MIN)
              for a in actors
          ]
      )
      assert (results[0] == cp.ones((10,), dtype=cp.float32) * 2).all()
      assert (results[1] == cp.ones((10,), dtype=cp.float32) * 2).all()
  
      # check max
      ray.get(actors[0].set_buffer.remote([10], value0=2, value1=3))
      ray.get(actors[1].set_buffer.remote([10], value0=4, value1=5))
      results = ray.get(
          [
              a.do_allreduce_multigpu.remote(op=ReduceOp.MAX)
              for a in actors
          ]
      )
      assert (results[0] == cp.ones((10,), dtype=cp.float32) * 5).all()
      assert (results[1] == cp.ones((10,), dtype=cp.float32) * 5).all()
  
file_path: ray/python/ray/util/collective/tests/distributed_multigpu_tests/test_distributed_multigpu_allreduce.py
imports: import pytest
  import logging
  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 5 for calling a global function with example usage: test_allreduce_multigpu_different_op(ray_start_distributed_multigpu_2_nodes_4_gpus) without return types