Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mpi.reduce

MPI\_Reduce and MPI\_Allreduce APIs


Description

mpi.reduce and mpi.allreduce are global reduction operations. mpi.reduce combines each member's result, using the operation op, and returns the combined value(s) to the member specified by the argument dest. mpi.allreduce is the same as mpi.reduce except that all members receive the combined value(s).

Usage

mpi.reduce(x, type=2, op=c("sum","prod","max","min","maxloc","minloc"), 
	dest = 0, comm = 1) 

mpi.allreduce(x, type=2, op=c("sum","prod","max","min","maxloc","minloc"), 
	comm = 1)

Arguments

x

data to be reduced. Must be the same dim and the same type for all members.

type

1 for integer and 2 for double. Others are not supported.

op

one of "sum", "prod", "max", "min", "maxloc", or "minloc".

dest

rank of destination

comm

a communicator number

Details

It is important that all members in a comm call either all mpi.reduce or all mpi.allreduce even though the master may not be in computation. They must provide exactly the same type and dim vectors to be reduced. If the operation "maxloc" or "minloc" is used, the combined vector is twice as long as the original one since the maximum or minimum ranks are included.

Value

mpi.reduce returns the combined value(s) to the member specified by dest. mpi.allreduce returns the combined values(s) to every member in a comm. The combined value(s) may be the summation, production, maximum, or minimum specified by the argument op. If the op is either "maxloc" or "minloc", then the maximum (minimum) value(s) along the maximum (minimum) rank(s) will be returned.

Author(s)

Hao Yu

References

See Also


Rmpi

Interface (Wrapper) to MPI (Message-Passing Interface)

v0.6-9.1
GPL (>= 2)
Authors
Hao Yu [aut]
Initial release
2021-02-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.