This is an old revision of the document!
This Wiki page is outdated, please go to: https://info.gwdg.de/wiki/doku.php?id=wiki:hpc:mpi4py
Reduction with MINLOC and MAXLOC
The reduction operations MINLOC and MAXLOC differ from all others: they return two results, the minimum resp. maximum of the values in the different tasks and the rank of a task, which holds the extreme value. mpi4py provides the two operations only for the lower case
allreduce mehods for comparing a single numerical data object in every task. An example is given in
inp = numpy.random.rand(size) senddata = inp[rank] recvdata=comm.reduce(senddata,None,root=0,op=MPI.MINLOC) print 'on task',rank,'reduce: ',senddata,recvdata recvdata=comm.allreduce(senddata,None,op=MPI.MINLOC) print 'on task',rank,'allreduce: ',senddata,recvdata