MPI和MPI等待问题中的非阻塞通信。并非所有信息都正确传递 [英] Non Blocking communication in MPI and MPI Wait Issue. Not all information is passed correctly

查看:1315
本文介绍了MPI和MPI等待问题中的非阻塞通信。并非所有信息都正确传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到并不是所有的MPI_Isend / MPI_IRecv都被执行。我认为它可能是我做我的发送和接收的顺序或代码不等待,直到所有的命令执行的事实。我已经复制了下面的代码的摘录。

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?

MPI_Status status[8];
MPI_Request 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.

对于此特定示例,可能 MPI_Sendrecv 有用吗?

For this particular example, perhaps MPI_Sendrecv would be useful?

这篇关于MPI和MPI等待问题中的非阻塞通信。并非所有信息都正确传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆