【问题标题】:Boost MPI doesn't free resources when listening for lists?Boost MPI 在侦听列表时不释放资源?
【发布时间】:2017-10-22 05:09:50
【问题描述】:

这是How do I free a boost::mpi::request? 的后续问题。我在收听列表而不是单个项目时注意到奇怪的行为。这是我的错误还是boost中的错误?我正在使用 MSVC 和 MSMPI,Boost 1.62。我很确定它在等待取消的作业时表现不佳。

如果您使用 mpiexec -n 2 尝试版本 B,那么您会得到一个干净的退出 - 如果您尝试版本 A,它会无限期挂起。大家也看到这个了吗?这是一个错误吗?

#include "boost/mpi.hpp"
#include "mpi.h"
#include <list>
#include "boost/serialization/list.hpp"

int main()
{
    MPI_Init(NULL, NULL);
    MPI_Comm regional;
    MPI_Comm_dup(MPI_COMM_WORLD, &regional);
    boost::mpi::communicator comm = boost::mpi::communicator(regional, boost::mpi::comm_attach);
    if (comm.rank() == 1)
    {


        //VERSION A:
        std::list<int> q;
        boost::mpi::request z = comm.irecv<std::list<int>>(1, 0, q);
        z.cancel();
        z.wait();


        //VERSION B:
//      int q;
//      boost::mpi::request z = comm.irecv<int>(1, 0, q);
//      z.cancel();
//      z.wait();

    }
    MPI_Comm_disconnect(&regional);
    MPI_Finalize();
    return 0;
}

【问题讨论】:

  • 一个更有趣的情况是,你有一个使用友元类 boost::serialization::access 的结构 - 如果你使用 BOOST_IS_MPI_DATATYPE,行为会有所不同。

标签: c++ boost mpi


【解决方案1】:

这显然是 Boost.MPI 中的一个错误。

对于序列化类型,例如std::list,取消从request::cancel() 转发到request::handle_serialized_irecv,这没有指定对ra_cancel 的正确处理。

【讨论】:

  • 我想知道我们是否可以这样做取消:for (auto&amp; r: z.m_requests) { r = MPI_REQUEST_NULL; }
  • 我认为你需要考虑m_requests的不同组合/状态。
猜你喜欢
  • 1970-01-01
  • 2017-10-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多