作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下面的代码给出了这个错误信息:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl'
what(): MPI_Test: MPI_ERR_TRUNCATE: message truncated
该问题可能与 boost::mpi 的一个错误有关,该错误在 this post 中有所讨论。 .我想确定错误的原因。
如果我只循环一次 ( for (int z=0; z<1; ++z)
) 但对于 z<2
则代码有效我收到提到的错误消息。
#include <boost/mpi.hpp>
class MyClass
{
std::vector<double> vec;
public:
void send_data(const boost::mpi::communicator& world, boost::mpi::request& req)
{
if (world.rank() == 0)
{
vec.resize(1000);
req = world.isend(1, 0, vec);
}
}
void recv_data(const boost::mpi::communicator& world)
{
if (world.rank() == 1)
{
while (true)
{
boost::mpi::request req = world.irecv(boost::mpi::any_source, 0, vec);
if (!req.test())
{
req.cancel();
//req.wait(); <-- hangs the program.
break;
}
}
}
}
};
int main()
{
boost::mpi::environment env;
boost::mpi::communicator world;
MyClass myclass;
for (int z=0; z<2; ++z) // works if loop only once.
{
boost::mpi::request req;
myclass.send_data(world, req);
world.barrier();
myclass.recv_data(world);
world.barrier();
if (world.rank() == 0)
req.wait();
}
return 0;
}
最佳答案
有a bug当同一个通信器上有多个 irecv
时,标签、序列化类型的源似乎非常相关。所以你可以尝试使用不同的标签。然而,由于取消的错误,它不会工作......
关于c++ - MPI_测试 : MPI_ERR_TRUNCATE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44162979/
通过MPI3.0引入邻里集体通信。其中 2 个(MPI_NEIGHBOR_ALLTOALLW 和 MPI_INEIGHBOR_ALLTOALLW)位移(sdispls 和 rdispls)是 数组常量
我正在查看 mpi.h header ,但我对 PMPI_Init 函数感到困惑。它位于 MPI_Init 声明之后,看起来完全一样。但是, Msmpi.dll (例如)没有 MPI_Init 导出,
我是一名优秀的程序员,十分优秀!