これはHow do I free a boost::mpi::request?の後続の質問です。個々のアイテムではなくリストを聴いているとき、私は奇妙な動作に気付いています。これは私のエラーかブーストのエラーですか?私はMSVCとMSMPI、ブースト1.62を使用しています。私はそれがキャンセルされた仕事を待っているときに正しく行動していないと確信しています。ブーストMPIはリストをリッスンするときにリソースを解放しませんか?
バージョンBをmpiexec -n 2で試してみると、クリーンな終了が得られます。バージョン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 :: serialization :: accessを使用している構造体を持つさらに面白いケースがあります.BOOST_IS_MPI_DATATYPEを使用すると、動作が異なります。 – Carbon