Search in sources :

Example 1 with Request

use of mpi.Request in project twister2 by DSC-SPIDAL.

the class TWSMPIChannel method postReceive.

private void postReceive(MPIReceiveRequests requests) {
    MPIBuffer byteBuffer = requests.availableBuffers.poll();
    while (byteBuffer != null) {
        // post the receive
        pendingReceiveCount++;
        Request request = postReceive(requests.rank, requests.edge, byteBuffer);
        requests.pendingRequests.add(new MPIRequest(request, byteBuffer));
        byteBuffer = requests.availableBuffers.poll();
    }
}
Also used : Request(mpi.Request)

Example 2 with Request

use of mpi.Request in project twister2 by DSC-SPIDAL.

the class TWSMPIChannel method postMessage.

/**
 * Send a message to the given rank.
 *
 * @param requests the message
 */
private void postMessage(MPISendRequests requests) {
    MPIMessage message = requests.message;
    for (int i = 0; i < message.getBuffers().size(); i++) {
        try {
            sendCount++;
            MPIBuffer buffer = message.getBuffers().get(i);
            Request request = comm.iSend(buffer.getByteBuffer(), buffer.getSize(), MPI.BYTE, requests.rank, message.getHeader().getEdge());
            // register to the loop to make progress on the send
            requests.pendingSends.add(new MPIRequest(request, buffer));
        } catch (MPIException e) {
            throw new RuntimeException("Failed to send message to rank: " + requests.rank);
        }
    }
}
Also used : MPIException(mpi.MPIException) Request(mpi.Request)

Aggregations

Request (mpi.Request)2 MPIException (mpi.MPIException)1