在收听列表时,Boost MPI不会释放资源吗? [英] Boost MPI doesn't free resources when listening for lists?

查看:86
本文介绍了在收听列表时,Boost MPI不会释放资源吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是如何释放boost :: mpi的后续问题:: request?.我注意到侦听列表而不是单个项目时的行为异常.这是我的错误还是升压错误?我正在使用MSVC和MSMPI,Boost 1.62.我很确定在等待被取消的工作方面行为不正常.

This is a follow-on question to How do I free a boost::mpi::request? . I'm noting odd behavior when listening for lists rather than individual items. Is this my error or an error in boost? I'm using MSVC and MSMPI, Boost 1.62. I'm pretty sure that it's not behaving properly on the wait for a cancelled job.

如果您使用mpiexec -n 2尝试使用B版本,那么您将获得一个干净的出口-如果您尝试使用A版本,它将无限期挂起.你们也都看到吗?这是一个错误吗?

If you try version B with mpiexec -n 2 then you get a clean exit - if you try version A, it hangs indefinitely. Do you all see this as well? Is this a bug?

#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中的错误.

This is clearly a bug in Boost.MPI.

对于序列化类型,例如std::list,取消将从 request::cancel()

For serialized types, like std::list, the cancel is forwarded from request::cancel() to request::handle_serialized_irecv, which does not specify a proper handling for ra_cancel.

这篇关于在收听列表时,Boost MPI不会释放资源吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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