In the following test code, If I set the SIZE parameter much higher than 960 no messgaes will transmit. Is there a max length for string variables to pass in boost mpi messages? Perhaps there is a limit in the string serialization, but I can't locate and limits in the docs... Any help is greatly appreciated.
//compile: mpic++ -Wall gather-002.cpp -o gather-002 -lboost_mpi -lboost_serialization
//run: mpirun -np 4 ./gather-002
#include <boost/mpi.hpp>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <string>
#define SIZE 960
namespace mpi = boost::mpi;
using namespace std;
int main(int argc, char* argv[])
{
mpi::environment env(argc, argv);
mpi::communicator world;
if (world.rank() == 0) {
string my_string = "MAIN";
for (int proc = 0; proc < world.size(); ++proc){
string outmessage = "";
for (int i = 0; i < SIZE; i++) outmessage = outmessage + "-";
world.send(proc, 0, outmessage);
}
vector<string> all_strings;
gather(world, my_string, all_strings, 0);
for (int proc = 0; proc < world.size(); ++proc)
cout << "Process #" << proc << " " << all_strings[proc] << endl;
}
else {
string inmessage;
world.recv(0,0,inmessage);
gather(world, inmessage, 0);
}
return 0;
}