Opened 11 years ago
Last modified 10 years ago
#5966 new Bugs
Cannot send std::map with more than 1 key/value pair
| Reported by: | Owned by: | Matthias Troyer | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | mpi |
| Version: | Boost 1.47.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
Sending a std::map (or std::set) of size greater than 1 causes an MPI_ERR_TRUNCATE error. The following code reproduces this error:
#include <boost/mpi.hpp>
#include <boost/serialization/map.hpp>
int
main( int argc, char * argv [] )
{
boost::mpi::environment env(argc, argv);
boost::mpi::communicator world;
if(world.rank()==0){
std::map<int,int> test;
test[1]=50;
test[2]=100;
world.send(1, 1, boost::mpi::skeleton(test));
world.send(1, 1, boost::mpi::get_content(test));
std::cout << "sent" << std::endl;
}
else{
std::map<int,int> test;
world.recv(0,1,boost::mpi::skeleton(test));
world.recv(0,1,boost::mpi::get_content(test));
std::cout << test.size() << std::endl;
}
}
Note:
See TracTickets
for help on using tickets.

You cannot send sets and maps by skeleton & content, since you need the key values to build the data structure. We should make this give a compile time error.