LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2003-05-31 09:14:59


On Tue, 27 May 2003, Ricardo Fonseca wrote:

> (mpirun -v -nw C -wd /Osiris/PADwake05.2D -s h -x RUNDIR,RUNNAME
> /usr/slocal/osiris/bin/osiris.2D.e > $RUNDIR/osiris.stdout) >&
> $RUNDIR/osiris.stderr
>
> If I do a tail -f osiris.stdout, instead of one line showing up at a
> time (as they are beeing written by our code) the command freezes for a
> while and then outputs a few hundred lines. Sometimes this actually ends
> up freezing the code.

I'm not sure that this is actually a LAM problem -- it seems to be a
general I/O buffering issue that is either intrinsic to the shell or the
operating system (I forget which). Sounds like it's getting block
buffered instead of line buffered -- if I had to guess, I'd guess that
your shell is setting the process to use block buffering after it forks
but before it exec's the mpirun process when it detects ">".

Although tou can change the buffering behavior of a process (see
setbuf(3) and setvbuf(3)), I'm not not 100% sure this will work because it
may be the mpirun process itself that is being subjected to block
buffering.

You might try making a small wrapper program to reset the buffering and
then exec mpirun and see if that works. So run something like:

        (my_mpirun_wrapper -v -nw C -wd ..... > $RUNDIR/.osiris.stdout) ...

and see if that works. If it does, I can put in a feature request to make
resetting the buffering behavior a command line option for mpirun in a
future version of LAM (it's way too late for 7.0 :-).

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/