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(User_function function, boolean commute)
function | user defined function |
commute | true if commutative, false otherwise |
class User_function { public abstract void Call(Object invec, int inoffset, Object inoutvec, int inoutoffset, int count, Datatype datatype) ; }To define a new operation, the programmer should define a concrete subclass of User_function, implementing the Call method, then pass an object from this class to the Op constructor. The User_function.Call method plays exactly the same role as the function argument in the standard bindings of MPI. The actual arguments invec and inoutvec passed to call will be arrays containing count elements of the type specified in the datatype argument. Offsets in the arrays can be specified as for message buffers. The user-defined Call method should combine the arrays element by element, with results appearing in inoutvec.
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 |