Reputation: 649
Case: 1. What is the use of status obtained using MPI_Wait()
if(rank==0)
MPI_Isend(&buffer0, count, MPI_INT, 1, 0, MPI_COMM_WORLD, &request0);
if(rank==1)
MPI_Recv(&buffer1, count, MPI_INT, 0, 0, MPI_COMM_WORLD);
if(rank==0)
MPI_Wait(&request0, &status);
// Can i use status here to do something?
MPI_Finalize();
Case:2. Use of status is clear here (Just added for comparison)
if(rank==0)
MPI_Ssend(&buffer0, count, MPI_INT, 1, 0, MPI_COMM_WORLD);
if(rank==1)
MPI_Irecv(&buffer1, count, MPI_INT, 0, 0, MPI_COMM_WORLD, &request1);
if(rank==1)
MPI_Wait(&request1, &status);
printf("The source is %d", status.MPI_SOURCE);
MPI_Finalize();
Upvotes: 0
Views: 405
Reputation: 22670
Generally MPI_Status
is used to get the the following properties for received messages.
status.MPI_SOURCE
) particularly relevant when MPI_ANY_SOURCE
was used.status.MPI_TAG
) particularly relevant when MPI_ANY_TAG
was usedMPI_Get_count
.For send messages, you can use the status to test for MPI_Test_cancelled
. Further, for functions that return multiple status, such as MPI_Waitall
, in the case of errors, you can use status[i].MPI_ERROR
. The main wait function will return MPI_ERR_IN_STATUS
in this case.
If you do not need any of those, you may pass MPI_STATUS_IGNORE
instead of a MPI_Status*
.
Upvotes: 2