next up previous contents
Next: Probe and Cancel Up: Point-to-Point Communication Previous: Buffer allocation and usage   Contents

Nonblocking communication

Nonblocking communications use methods of the Request class to identify communication operations and match the operation that initiates the communication with the operation that terminates it.

Request Comm.Isend(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
   
returns: communication request



Start a standard mode, nonblocking send. Java binding of the MPI operation MPI_ISEND. Further comments as for send.

Request Comm.Ibsend(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
   
returns: communication request



Start a buffered mode, nonblocking send. Java binding of the MPI operation MPI_IBSEND. Further comments as for send.

Request Comm.Issend(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
   
returns: communication request



Start a synchronous mode, nonblocking send. Java binding of the MPI operation MPI_ISSEND. Further comments as for send.

Request Comm.Irsend(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
   
returns: communication request



Start a ready mode, nonblocking send. Java binding of the MPI operation MPI_IRSEND. Further comments as for send.

Request Comm.Irecv(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: communication request



Start a nonblocking receive. Java binding of the MPI operation MPI_IRECV. Further comments as for recv.

The following functions are used to complete nonblocking communication operations (and also communications started using the persistent communication requests--subclass Prequest--introduced later). We use the following terminology. A request is ``active'' if it is associated with an ongoing communication. Otherwise it is inactive. An inactive instance of the base class Request is called a ``void request''. (Note, however, that an inactive instance of the Prequest subclass is not said to be ``void'', because it retains detailed information about a communication pattern even when no corresponding communication is ongoing.)

Status Request.Wait()
returns: status object



Blocks until the operation identified by the request is complete. Java binding of the MPI operation MPI_WAIT. After the call returns, the request object becomes inactive.

Status Request.Test()
returns: status object or null reference



Returns a status object if the operation identified by the request is complete, or a null reference otherwise. Java binding of the MPI operation MPI_TEST. After the call, if the operation is complete (ie, if the return value of test is non-null), the request object becomes an inactive request.

boolean Request.Is_null()
returns: true if the request object is void, false otherwise



Note that Is_null is always false on instances of the subclass Prequest.

void Request.Free()
Set the request object to be void. Java binding of the MPI operation MPI_REQUEST_FREE.

static Status Request.Waitany(Request [] array_of_requests)
array_of_requests array of requests
   
returns: status object



Blocks until one of the operations associated with the active requests in the array has completed. Java binding of the MPI operation MPI_WAITANY. The index in array_of_requests for the request that completed can be obtained from the status object from the publically accessible Status.index field. The corresponding element of array_of_requests becomes inactive.

The array_of_requests may contain inactive requests. If the list contains no active requests, the method immediately returns a status in which the index field is MPI.UNDEFINED.

static Status Request.Testany(Request [] array_of_requests)
array_of_requests array of requests
   
returns: status object or null reference



Tests for completion of either one or none of the operations associated with active requests. Java binding of the MPI operation MPI_TESTANY. If some request completed, the index in array_of_requests of that request can be obtained from the status object through the Status.index field. The corresponding element of array_of_requests becomes inactive. If no request completed, testAny returns a null reference.

The array_of_requests may contain inactive requests. If the list contains no active requests, the method immediately returns a status in which the index field is MPI.UNDEFINED.

static Status [] Request.Waitall(Request [] array_of_requests)
array_of_requests array of requests
   
returns: array of status objects



Blocks until all of the operations associated with the active requests in the array have completed. Java binding of the MPI operation MPI_WAITALL. The result array will be the same size as array_of_requests. On exit, requests become inactive. If the input value of array_of_requests contains any inactive requests, corresponding elements of the result array will contain null status references.

static Status [] Request.Testall(Request [] array_of_requests)
array_of_requests array of requests
   
returns: array of status objects, or a null reference



Tests for completion of all of the operations associated with active requests. Java binding of the MPI operation MPI_TESTALL. If all operations have completed, the exit values of the argument array and the result array are as for Waitall. If any operation has not completed, the result value is null and no element of the argument array is modified.

static Status [] Request.Waitsome(Request [] array_of_requests)
array_of_requests array of requests
   
returns: array of status objects



Blocks until at least one of the operations associated with the active requests in the array has completed. Java binding of the MPI operation MPI_WAITSOME. The size of the result array will be the number of operations that completed. The index in array_of_requests for each request that completed can be obtained from the index field of the returned status objects. The corresponding elements in array_of_requests become inactive.

If array_of_requests list contains no active requests, testAll immediately returns a null reference.

static Status [] Request.Testsome(Request [] array_of_requests)
array_of_requests array of requests
   
returns: array of status objects



Behaves like waitSome, except that it returns immediately. Java binding of the MPI operation MPI_TESTSOME. If no operation has completed, Testsome returns an array of length zero and elements of array_of_requests are unchanged. Otherwise, arguments and return value are as for Waitsome.


next up previous contents
Next: Probe and Cancel Up: Point-to-Point Communication Previous: Buffer allocation and usage   Contents
Bryan Carpenter 2002-07-12