void Intracomm.reduce(Object sendbuf, int sendoffset,
Object recvbuf, int recvoffset,
int count, Datatype datatype,
Op op, int root)
| sendbuf | send buffer array |
| sendoffset | initial offset in send buffer |
| recvbuf | receive buffer array |
| recvoffset | initial offset in receive buffer |
| count | number of items in send buffer |
| datatype | data type of each item in send buffer |
| op | reduce operation |
| dest | rank of root process |
The predefined operations are available in Java as MPI.MAX, MPI.MIN, MPI.SUM, MPI.PROD, MPI.LAND, MPI.BAND, MPI.LOR, MPI.BOR, MPI.LXOR, MPI.BXOR, MPI.MINLOC and MPI.MAXLOC.
The handling of MINLOC and MAXLOC is modelled on the Fortran binding. The extra predefined types MPI.SHORT2, MPI.INT2, MPI.LONG2, MPI.FLOAT2, MPI.DOUBLE2 describe pairs of Java numeric primitive types.
Op.Op(UserFunction function, boolean commute)
| function | user defined function |
| commute | true if commutative, false otherwise |
class UserFunction {
public abstract void call(Object invec, Object inoutvec,
Datatype datatype) ;
}
To define a new operation, the programmer should define a concrete
subclass of UserFunction, implementing the call method,
then pass an object from this class to the Op constructor. The
UserFunction.call method plays exactly the same role as the
function argument in the standard bindings of MPI. The actual
arguments invec and outvec passed to call will be
equal-length arrays with elements of the type specified in the datatype argument. The user-defined call method combines these
in the way specified in the MPI standard.
void Op.finalize()Destructor. Java binding of the MPI operation MPI_OP_FREE.
void Intracomm.allreduce(Object sendbuf, int sendoffset,
Object recvbuf, int recvoffset,
int count, Datatype datatype,
Op op)
| sendbuf | send buffer array |
| sendoffset | initial offset in send buffer |
| recvbuf | receive buffer array |
| recvoffset | initial offset in receive buffer |
| count | number of items in send buffer |
| datatype | data type of each item in send buffer |
| op | reduce operation |