MPIX_Enqueue_wait

Enqueue an MPI Stream Triggered wait operations into an MPIX_Queue object.

Definitions

C/C++ Synopsis

int MPIX_Enqueue_wait(const MPIX_Queue queue)

Arguments

queue                IN              Already created valid MPIX_Queue object associated with the start operation

Description

MPIX_Enqueue_wait enqueues a wait operation into the queue object. MPIX_Enqueue_wait is a non-blocking operation with respect to the application process.

A valid queue object is expected to be part of the MPIX_Enqueue_wait operation and anything else would result in undefined behavior. A valid queue object denotes the stream handle associated with the queue object is active.

An MPIX_Enqueue_wait operation without any previously enqueued MPIX_Enqueue_start operation will result in a no-op since there is nothing available for the Control Processor to wait on the stream.

Return Values

None.

Examples

C/C++ Example

Example code snippet showing the usage of basic stream triggered communication operations.

MPIX_Queue queue;
hipStream_t stream;
hipStreamCreateWithFlags(&stream, hipStreamNonBlocking);
MPIX_Create_queue(MPI_COMM_WORLD_DUP, (void *)stream, &queue);

if (my_rank == 0) {
    launch_device_kernel(src_buf, stream);
    MPIX_Enqueue_send(src_buf, SIZE, MPI_INT, 0, 123, queue, &sreq);
        MPIX_Enqueue_start(queue); /* Enqueue_start enables the triggering of
                                * prior send operations */
    MPIX_Enqueue_wait(queue);
} else if (my_rank == 1) {
    MPIX_Enqueue_recv(dst_buf, SIZE, MPI_INT, 1, 123, queue, &rreq);
    MPIX_Enqueue_start(queue);
    MPIX_Enqueue_wait(queue);  /* wait blocks only the current GPU stream
                                */
    launch_device_kernel(dst_buf, stream);
}
hipStreamSynchronize(stream); /* wait for all operations on Stream to