code: def testReduceScatter(self):
      size = self.COMM.Get_size()
      rank = self.COMM.Get_rank()
      for array, typecode in arrayimpl.loop():
          # segfault as of OpenMPI 4.1.1
          if unittest.is_mpi_gpu("openmpi", array):
              continue
          for op in (MPI.SUM, MPI.MAX, MPI.MIN, MPI.PROD):
              if skip_op(typecode, op):
                  continue
              rcnt = list(range(1, size + 1))
              sbuf = array([rank + 1] * sum(rcnt), typecode)
              rbuf = array(-1, typecode, rank + 1)
              self.COMM.Ireduce_scatter(
                  sbuf.as_mpi(), rbuf.as_mpi(), None, op
              ).Wait()
              max_val = maxvalue(rbuf)
              for i, value in enumerate(rbuf):
                  if op == MPI.SUM:
                      redval = sum(range(size)) + size
                      if redval < max_val:
                          self.assertAlmostEqual(value, redval)
                  elif op == MPI.PROD:
                      redval = prod(range(1, size + 1))
                      if redval < max_val:
                          self.assertAlmostEqual(value, redval)
                  elif op == MPI.MAX:
                      self.assertEqual(value, size)
                  elif op == MPI.MIN:
                      self.assertEqual(value, 1)
              rbuf = array(-1, typecode, rank + 1)
              self.COMM.Ireduce_scatter(
                  sbuf.as_mpi(), rbuf.as_mpi(), rcnt, op
              ).Wait()
              max_val = maxvalue(rbuf)
              for i, value in enumerate(rbuf):
                  if op == MPI.SUM:
                      redval = sum(range(size)) + size
                      if redval < max_val:
                          self.assertAlmostEqual(value, redval)
                  elif op == MPI.PROD:
                      redval = prod(range(1, size + 1))
                      if redval < max_val:
                          self.assertAlmostEqual(value, redval)
                  elif op == MPI.MAX:
                      self.assertEqual(value, size)
                  elif op == MPI.MIN:
                      self.assertEqual(value, 1)
  
imports: from mpi4py import MPI
  import mpiunittest
  import arrayimpl
  from functools import reduce
label_desc: Use image node_id 10 for calling the BaseTestCCOBuf obj's underlying member method code with example usage: obj.testReduceScatter() without return types