On Mar 6, 2010, at 3:47 AM, alfC wrote:
I am fairly new to mpi (and boost mpi). I have an mpi program and I need to dump some intermediate and results to a simple text file.
Hi Alfredo, A common technique is to have each separate MPI process maintain it's own local buffer of data destined for the file, that is locally filled. When the buffer is full on the root processor, the buffer is written to the file. When the buffer is full on other processors, the size of the buffer is doubled so you don't lose any data. In time stepping applications it is common to have one place at the top or bottom of the time step where all processor's data is combined onto the root processor and then written to the file. This is a global synchronization point and every MPI process must participate even if it's local file buffers are empty (nothing written on that processor since the last time step). There are numerous possibilities for the local buffer ranging from a std::string all the way up to creating a specialized type from a std::streambuf. Hope that helps. -- Noel