ptypy.utils.parallel.allreduce#

ptypy.utils.parallel.allreduce(a, op=None)#

Wrapper for comm.Allreduce, always in place.

Parameters:
  • a (numpy-ndarray) – The array to operate on.

  • op (operation) – MPI operation to execute. None or one of MPI.BAND, MPI.BOR, MPI.BXOR, MPI.LAND, MPI.LOR, MPI.LXOR, MPI.MAX, MPI.MAXLOC, MPI.MIN, MPI.MINLOC, MPI.OP_NULL, MPI.PROD, MPI.REPLACE or MPI.SUM. If None, uses MPI.SUM.

Note

Explanation : If process #1 has ndarray a and process #2 has ndarray b. After calling allreduce, the new arrays after allreduce are a'=op(a,b) and b'=op(a,b) on process #1 and #2 respectively