这是一个后续问题如何释放 boost::mpi::request? https://stackoverflow.com/questions/44078901/how-do-i-free-a-boostmpirequest。我在监听列表而不是单个项目时注意到奇怪的行为。这是我的错误还是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, ®ional);
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(®ional);
MPI_Finalize();
return 0;
}
这显然是 Boost.MPI 中的一个错误。
对于序列化类型,例如std::list
,取消转发自request::cancel() https://github.com/boostorg/mpi/blob/boost-1.64.0/src/request.cpp#L109 to request::handle_serialized_irecv https://github.com/boostorg/mpi/blob/boost-1.64.0/include/boost/mpi/communicator.hpp#L1550,它没有指定正确的处理ra_cancel
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)