I noticed that not all my MPI_Isend/MPI_IRecv were being executed. I think it may perhaps be either the order in which I do my send and receive or the fact that the code doesn't wait until all the commands are executed. I have copied the excerpt from the code below. Could you suggest as to what I could be doing incorrectly?
Thanks!
MPI_Status status[8];
MPI_Request 开发者_C百科request[8];
....
....
if ((my_rank) == 0)
{
MPI_Isend(eastedge0, Rows, MPI_DOUBLE, my_rank+1, 0, MPI_COMM_WORLD, &request[0]);
MPI_Irecv(westofwestedge0, Rows, MPI_DOUBLE, my_rank+1, MPI_ANY_TAG, MPI_COMM_WORLD, &request[6]);
MPI_Wait(&request[6], &status[6]);
}
if ((my_rank) == 1)
{
MPI_Irecv(eastofeastedge1, Rows, MPI_DOUBLE, my_rank-1, MPI_ANY_TAG, MPI_COMM_WORLD, &request[0]);
MPI_Wait(&request[0], &status[0]);
MPI_Isend(westedge1, Rows, MPI_DOUBLE, my_rank-1, 0, MPI_COMM_WORLD, &request[6]);
}
Either rank 0 or 1 could still be sending data after this block of code has been executed (as you don't wait on the send request object). This could cause problems if you modify the data before it has finished sending.
For this particular example, perhaps MPI_Sendrecv would be useful?
For every call to a non-blocking MPI call, there has to be a corresponding wait. You are missing one wait per process.
精彩评论