Hi Nick,

On 26 Oct 2010, at 00:52, Nick Collier wrote:

Sorry for not getting back sooner, and thanks for the initial reply. I added a print to packed_archive_send, so it now looks like:

void
packed_archive_send(MPI_Comm comm, int dest, int tag,
                    const packed_oarchive& ar)
{
std::cout << "ar size: " << ar.size() << std::endl;
  const void* size = &ar.size();
  ....

When I run this under release mode I with, I get:

ar size: 4265919640

MPI_Send: Invalid count, error stack:
MPI_Send(176): MPI_Send(buf=0x01E8AE18, count=-29047656, MPI_PACKED, dest=1, tag
=2147483647, MPI_COMM_WORLD) failed
MPI_Send(101): Negative count, value is -29047656

When I run it under debug mode, I don't get the error and 

ar size: 1622.

Any suggestions how to proceed are much appreciated. 

This seems to point towards either a bug in your code, that you overwrite the memory location of the packed_oarchive, or a bug in the optimizer. Can you try a simple test program where you are sure that you don't write out of bounds anywhere?

You could also try to see what goes on by adding more output statements to the size() function of packed_oprimitive, or add a size function to packed_oarchive that prints internal_buffer_.size() and then calls the size function of the packed_oprimitive base class. It seems that either the internal_buffer_ vector is messed up, or the reference in the base class by either a compiler bug o a bug in your code.

Matthias