Collective Computation
One can often perform computing during a collective communication
MPI_REDUCE performs reduction operation of type chosen from
- maximum(value or value and location), minimum(value or value and location), sum, product, logical and/or/xor, bit-wise and/or/xor
- e.g. operation labeled MPI_MAX stores in location result of processor rank the global maximum of original in each processor as in
- call MPI_REDUCE(original, result, 1, MPI_REAL, MPI_MAX, rank, comm, ierror)
- One can also supply one's own reduction function
MPI_ALLREDUCE is same as MPI_REDUCE but it stores result in all -- not just one -- processors
MPI_SCAN performs reductions with result for processor r depending on data in processors 0 to r