我可以使用MPI_Barrier()在迭代步骤之间同步数据吗 [英] Can I use MPI_Barrier() to synchronize data in-between iteration steps

查看:140
本文介绍了我可以使用MPI_Barrier()在迭代步骤之间同步数据吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MPI_Barrier()在迭代步骤之间同步数据是否是一个好主意.请参见下面的伪代码.

Is it good idea to use MPI_Barrier() to synchronize data in-between iteration steps. Please see below pseudo code.

While(numberIterations< MaxIterations)
{
   MPI_Iprobe() -- check for incoming data
    while(flagprobe !=0)
    {
        MPI_Recv() -- receive data
        MPI_Iprobe() -- loop if more data
    }

   updateData() -- update myData

   for(i=0;i<N;i++) MPI_Bsend_init(request[i]) -- setup request

   for(i=0;i<N;i++) MPI_Start(request[i]) -- send data to all other N processors

   if(numberIterations = MaxIterations/2) 
      MPI_Barrier() -- wait for all processors -- CAN I DO THIS

   numberIterations ++

}

推荐答案

在本文中 http://static.msi.umn.edu/rreports/2008/87.pdf 它说您必须在MPI_Bsend_init()之前调用MPI_Free_request().

In this article http://static.msi.umn.edu/rreports/2008/87.pdf it says that you have to call MPI_Free_request() before MPI_Bsend_init().

这篇关于我可以使用MPI_Barrier()在迭代步骤之间同步数据吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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