Hello,
I am using boost mpi and I am having issues getting the message truncation error upon receiving a message. It is not always the same message, but it does always happen and I have been unable to figure out why. Here is the code of interest:
//send particles
for(int i=0;i<world.size();i++)
{
world.isend(i,i,particles_to_be_sent[i]);
}
//receive particles
int receive_counter=0;
boost::optional<boost::mpi::status> msginfo=world.iprobe(mpi::any_source, world.rank());
while (receive_counter<world.size())
{
if (msginfo)
{
world.recv(msginfo->source(),world.rank(),particles_received);
for (unsigned int i=0;i<particles_received.size();i++)
{
//add particle to its associated box in the particle grid
particle_grid[particles_received[i].location_number()].insert(pair<int,Particle>(particles_received[i].global_part_num(),particles_received[i]));
//check to see if the particle is contained within the box
if (particles_received[i].position().y()>grid_locations[particles_received[i].location_number()].bottom()
&& particles_received[i].position().y()<grid_locations[particles_received[i].location_number()].top()
&& particles_received[i].position().x()>grid_locations[particles_received[i].location_number()].west()
&& particles_received[i].position().x()<grid_locations[particles_received[i].location_number()].east()
&& particles_received[i].position().z()>grid_locations[particles_received[i].location_number()].south()
&& particles_received[i].position().z()<grid_locations[particles_received[i].location_number()].north())
{
//if particle is in box, then denote it as such in the particle properties
particle_properties[particles_received[i].global_part_num()].particle_in_box()[particles_received[i].location_number()]=true;
}
}
receive_counter++;
}
msginfo=world.iprobe(mpi::any_source, world.rank());
}
I have left out variable definitions, but everything has the right type (including sending and receiving the same type-particles_to_be_sent[i] and particles_received are both vector<Particle>, where Particle is a type I’ve created).
I thought that boost mpi is supposed to take care of making the receive buffer the right size on its own, but something isn’t working here. Any help would be appreciated.
Thanks,
Kyle