next up previous contents
Next: Data type matching and Up: Point-to-Point Communication Previous: Introduction   Contents


Blocking Send and Receive operations

void Comm.Send(Object buf, int offset, int count,
               Datatype datatype, int dest, int tag)
buf send buffer array
offset initial offset in send buffer
count number of items to send
datatype datatype of each item in send buffer
dest rank of destination
tag message tag



Blocking send operation. Java binding of the MPI operation MPI_SEND. The data part of the message consists of a sequence of count values, each of the type indicated by datatype. The actual argument associated with buf must be an array. The value offset is a subscript in this array, defining the position of the first item of the message.

The elements of buf may have primitive type or class type. If the elements are objects, they must be serializable objects. If the datatype argument represents an MPI basic type, its value must agree with the element type of buf: the basic MPI datatypes supported, and their correspondence to Java types, are as follows


MPI datatype Java datatype
MPI.BYTE byte
MPI.CHAR char
MPI.SHORT short
MPI.BOOLEAN boolean
MPI.INT int
MPI.LONG long
MPI.FLOAT float
MPI.DOUBLE double
MPI.OBJECT Object



If the datatype argument represents an MPI derived type, its base type must agree with the element type of buf (see section 3.12). If a data type has MPI.OBJECT as its base type, the objects in the buffer will be transparently serialized and unserialized inside the communication operations.

Status Comm.Recv(Object buf, int offset, int count,
                 Datatype datatype, int source, int tag)
buf receive buffer array
offset initial offset in receive buffer
count number of items in receive buffer
datatype datatype of each item in receive buffer
source rank of source
tag message tag
   
returns: status object



Blocking receive operation. Java binding of the MPI operation MPI_RECV. The actual argument associated with buf must be an array. The value offset is a subscript in this array, defining the position into which the first item of the incoming message will be copied.

The elements of buf may have primitive type or class type. If the datatype argument represents an MPI basic type, its value must agree with the element type of buf; if datatype represents an MPI derived type, its base type must agree with the element type of buf (see section 3.12).

The MPI constants MPI_ANY_SOURCE and MPI_ANY_TAG are available as MPI.ANY_SOURCE and MPI.ANY_TAG.

The source and tag of the received message are available in the publically accessible source and tag fields of the returned object. The following method can be used to further interrogate the return status of a receive operation.

int Status.Get_count(Datatype datatype)
datatype datatype of each item in receive buffer
   
returns: number of received entries



Java binding of the MPI operation MPI_GET_COUNT.


next up previous contents
Next: Data type matching and Up: Point-to-Point Communication Previous: Introduction   Contents
Bryan Carpenter 2002-07-12