Boost logo

Boost Users :

Subject: Re: [Boost-users] [mpi] open/write to file for simple output
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2010-03-07 11:58:42


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net