Boost MPI not freeing resources when listening on lists?
This is the next question to How do I free boost :: mpi :: request? ... I observe strange behavior when listening to lists rather than individual items. Is this my mistake or a mistake in promoting? I am using MSVC and MSMPI, Boost 1.62. I'm pretty sure it doesn't behave normally while waiting for the job to be canceled.
If you try version B with mpiexec -n 2, then you get a clean output - if you try version A it freezes indefinitely. Do you see all this? This is mistake?
#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;
}
source to share
This is clearly a bug in Boost.MPI.
For serialized types such as std::list
, undo is redirected from request::cancel()
to request::handle_serialized_irecv
, which does not indicate proper handling for ra_cancel
.
source to share