[MITgcm-support] For pgf77, is there already a way to line-buffer the STDOUT and STDERR files?

Martin Losch Martin.Losch at awi.de
Mon Jan 25 03:37:10 EST 2016

Hi Bob,

this is probably not very sophisticated:
I am using “flush" to get output in such a case and put it into the routine that I am interested in. If you want output in each timestep, you’d have to put something like “call flush(standardMessageUnit)” in to forward_step.F. If you want output only at the “monitor frequency” (runtime flag monitorFreq), then I’d put this call into monitor.F (into the if block).


> On 22 Jan 2016, at 21:51, Yantosca, Robert M. <yantosca at seas.harvard.edu> wrote:
> Hi –
> I am a new user of MITgcm.  I was able to build it on the Harvard Odyssey cluster based on the tools/build_options/linux_amd64_pgf77 settings and OpenMPI.
> With the pgfortran compiler, the MITgcm compiles “out-of-the-box” and runs.  But because pgfortran fully-buffers all disk files by default, theSTDOUT.nnnn and STDERR.nnnn files are not flushed to disk while MITgcm is running.  This makes it difficult to check the progress of the run.
> The pgf77 compiler manual says that you can change the buffering options by calling the SETVBUF3F to manually set the buffering options.  For example,
> . . .
> RC = SETVBUF3F( 6, 1, 16000 )
> will make stdout (unit #6) line buffered with a buffer size of 16K.  (I use this setting on another model and it works fine.)  Then you can redirect stdout to a log file and it will be refreshed during a run.
> My questions:
> (1)   Does anyone know if there is a pgfortran compiler switch that would globally reset the file-buffering options?  Then I wouldn’t have to rely on SETVBUF3F.
> (2)  Failing that, in which routine are the STDOUT.nnnn and STDERR.nnnnfiles opened?  I could try to put calls to SETVBUF3F in those routines right when those files are opened to make them line-buffered.
> Thanks a bunch!
> Best,
> Bob Y.
> --
> Bob Yantosca
> Senior Software Engineer
> GEOS-Chem Support Team
> http://wiki.geos-chem.org/GEOS-Chem_Support_Team
> Group email: geos-chem-support at as.harvard.edu
> Individual email: yantosca at seas.harvard.edu
> (617) 496-9424
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support

More information about the MITgcm-support mailing list