c++ - Boost MPI 在监听列表时不释放资源?

标签 c++ boost mpi

这是 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.MPI 中的错误。

对于序列化类型,如 std::list,取消是从 request::cancel() 转发的至 request::handle_serialized_irecv ,它没有为 ra_cancel 指定正确的处理方式。

关于c++ - Boost MPI 在监听列表时不释放资源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44114624/

相关文章:

c++ - QT 资源文件 - 图像在运行时不显示

c++ - 查找我的算法的运行时间,以查找输入是否为质数

php - 从 php 检索值?

C++ boost 间隔和 cos

c++ - 如何从 boost 库中的文件中读取数据

C MPI 数组搜索帮助 (MPI_Scatter)

parallel-processing - 使用 MPI_Init()

c++ - 将 R 代码转换为 C++ 以进行 Rcpp 实现

c++ - Boost 构建 fatal error LNK1105

.net - F# + MPI + 单声道 : Clustered Computing