Boost logo

Boost-MPI :

Subject: [Boost-mpi] mixing boost serialization with C MPI functions
From: Jiaxin Han (hanjiaxin_at_[hidden])
Date: 2015-11-19 10:07:30


Hi,

Could anyone point me to an example of mixing boost serialization with C
MPI functions?

I guess I need to use boost::mpi::oarchive. But how should I initialize the
buffer parameter, and what should I pass to MPI_Send after that? More
specifically, I am trying to do the following:

typedef vector <int> ParticleList_t;
#define MSG_LEN 100000
  ParticleList_t sendbuf(MSG_LEN, 1), recvbuf(MSG_LEN);
   mpi::packed_oarchive::buffer_type
buffer(sizeof(sendbuf[0])*sendbuf.size());
   mpi::packed_oarchive oa(world, buffer, boost::archive::no_header);
   oa & sendbuf;
  if(world.rank()==0)
    MPI_Send(oa, 1, MPI_PACKED, 1, 0, MPI_COMM_WORLD);

Do I have to make sure buffer is big enough or the oarchive will handle the
memory automatically? If the former, what is the correct memory size to
hold a vector? I guess it should hold not just vec.data(), but also
vec.size().

And lastly, oa does not appear to be the correct variable to pass to
MPI_Send. Then what should I pass to MPI_Send after creating the archive?

I am asking because the boost mpi installation on our server appears to
have a limitation on the message size. For example, the attached code
reports an error as:

terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::mpi::exception>
>'
  what(): MPI_Alloc_mem: MPI_Alloc_mem: Out of "special" (shared) memory
MPI Application rank 0 killed before MPI_Finalize() with signal 6

This appears to be a problem only with the boost installation on the
server. The code runs correctly on my local machine.

Many Thanks!

Jiaxin





Boost-Commit list run by troyer at boostpro.com