MPIX_Get_drequest
Operation to retrieve the device-side request of an active MPI_Request object
Definitions
C/C++ Synopsis
int MPIX_Get_drequest(MPI_Request request, MPIX_Drequest *drequest)
Arguments
request IN MPI communication request handle.
drequest OUT The device communication request handle obtained from request.
Description
MPIX_Get_drequest returns a device request that can be used with Kernel Triggered operation called on the device. Calls to MPI_Start from the host should still use the original MPI request handle. The device request will be cleaned up when the user calls MPI_Request_free for the original MPI request handle.
Return Values
None.
Examples
C/C++ Example
Example host and device code snippet showing the usage of basic kernel triggered communication operations.
Host Code
MPI_Send_init(data, num_bytes, MPI_BYTE,
1, 999, MPI_COMM_WORLD, &send_request);
MPI_Recv_init(data, num_bytes, MPI_BYTE,
0, 999, MPI_COMM_WORLD, &recv_request);
MPIX_Get_drequest(send_request, &send_drequest);
MPIX_Get_drequest(recv_request, &recv_drequest);
hipEventCreate(&event);
hipStreamCreate(&stream);
double begin = MPI_Wtime();
startit<<<1, 1, 0, stream>>>(send_drequest, recv_drequest,
rank, data, num_bytes, num_iter);
hipEventRecord(event, stream);
while (hipErrorNotReady == hipEventQuery(event)) {}
double end = MPI_Wtime();
fprintf(stdout, "[%d] latency = %lf us\n",
rank, 1e6 * (end - begin) / (double) (2 * num_iter));
Device Code
#include <mpi_kt.h>
__global__ void startit(MPIX_Drequest send_drequest,
MPIX_Drequest recv_drequest, int rank,
int *data, int num_bytes, int num_iter)
{
int flag, i = 0;
MPIX_Drequest dreq1, dreq2;
if (rank == 0) dreq1 = send_drequest; dreq2 = recv_drequest;
else dreq1 = recv_drequest; dreq2 = send_drequest;
for (i = 0; i < num_iter; ++i) {
/* ping */
MPIX_Start(dreq1);
flag = 0;
while (!flag) {
MPIX_Test(&dreq1, &flag, MPI_STATUS_IGNORE);
}
/* pong */
MPIX_Start(dreq2);
flag = 0;
while (!flag) {
MPIX_Test(&drequest2, &flag, MPI_STATUS_IGNORE);
}
}
}