0

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();

1 Answer 1

2

Generally MPI_Status is used to get the the following properties for received messages.

  1. rank of the sender, (status.MPI_SOURCE) particularly relevant when MPI_ANY_SOURCE was used.
  2. tag of the message, (status.MPI_TAG) particularly relevant when MPI_ANY_TAG was used
  3. element-count that was sent, which may differ from posted receive buffer, using MPI_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*.

Sign up to request clarification or add additional context in comments.

1 Comment

Can you please check Case:1 once more? I'm talking about the status in MPI_Wait(&request0, &status); This MPI_Wait was used to check out MPI_Isend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.