下面是源代码实现的输出。我不确定这意味着什么以及我应该如何补救代码。
aborting job:
Fatal error in MPI_Wait: Invalid MPI_Request, error stack:
MPI_Wait(139): MPI_Wait(request=0xffffd6a4, status0xffffd690) failed
MPI_Wait(75) : Invalid MPI_Request
rank 0 in job 1 <processor #) caused collective abort of all ranks
exit status of rank 0: return code 13
源代码:
#define Rows 48
...
double *northedge1 = new double[Rows];
double *northofnorthedge3 = new double[Rows];
...
...
int main (int argc, char *argv[])
{
....
....
MPI_Request send_request, recv_request;
...
...
if ((my_rank) == 1)
{
MPI_Isend(northedge1, Rows, MPI_DOUBLE, my_rank+2, 0, MPI_COMM_WORLD, &send_request);
}
if ((my_rank) == 3)
{
MPI_Irecv(northofnorthedge3, Rows, MPI_DOUBLE, my_rank-2, MPI_ANY_TAG, MPI_COMM_WORLD,
&send_request);
}
MPI_Wait(&send_request, &status);
.....
MPI_Finalize ()
最佳答案
即使您只在等级 1 和等级 3 中进行非阻塞通信,您似乎也在从等级 0 调用 MPI_Wait()。因此等级 0 中没有有效的 send_request,因此 MPI_Wait 无效。在上面,看起来你应该有
if ( (my_rank == 1) || (my_rank == 3))
MPI_Wait(&send_request, &status);
关于c++ - MPI_Wait 中的 fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6034943/