MPI_Wait中的致命错误

时间:2011-05-17 17:50:01

标签: c++ mpi

以下是源代码实现的输出。我不确定它意味着什么以及我应该如何补救代码。

 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 个答案:

答案 0 :(得分:2)

看起来你甚至从0级调用MPI_Wait(),即使你只是在1级和3级进行非阻塞通信。所以在0级没有有效的send_request,所以MPI_Wait无效。在上面,看起来你应该

 if ( (my_rank == 1) || (my_rank == 3))   
      MPI_Wait(&send_request, &status);