triqs.utility.mpi_mpi4py.all_reduce

triqs.utility.mpi_mpi4py.all_reduce(x, comm=<mpi4py.MPI.Intracomm object>, op=<mpi4py.MPI.Op object>)[source]

Reduce x across all ranks of comm and return the result.

Thin wrapper around mpi4py.MPI.Comm.allreduce().

Parameters:
xobject

Value contributed by the local rank.

commmpi4py.MPI.Comm, optional

Communicator over which to reduce. Default world.

opmpi4py.MPI.Op, optional

Reduction operation. Default MPI.SUM.

Returns:
object

The reduced value, identical on every rank of comm.

Notes

For backwards compatibility with an earlier signature that had the communicator as the first positional argument, if the call raises AttributeError or TypeError and x is itself a communicator, the call is retried as world.allreduce(comm) and a warning is printed.