I am not sure all fortran compilers provide mechanism to do the equivalence of setbuf(stdout,NULL), so not sure if it is a good way to solve the hydra problem (which I don't fully understand). My understanding of the reason that MPI_Init doing setbuf(stdout,NULL) is to ensure that C layer won't interfere with the Fortran runtime's IO buffering. Would that be OK that hydra doesn't do any IO buffering for Fortran and just let endusers deal with it themselves, i.e. gfortran users need o set GFORTRAN_UNBUFFERED_ALL through mpiexec if they need unbuffering of IOs ? A.Chan ----- "Pavan Balaji" <[email protected]> wrote:
On 10/27/2010 02:20 AM, Anthony Chan wrote:
As you've found, Fortran's and C's IO buffering scheme are independent. AFAIK, there isn't any portable way to do setbuf(stdout,NULL) in Fortran. Because of that, Fortran programmers usually put flush() after their stdout write() to make sure they can see their outputs. Not sure that helps, Bill may know better about Fortran runtime.
Right. We don't have control on the application, so we can't really depend on flush(). There seem to be some compiler-specific environment
variables such as GFORTRAN_UNBUFFERED_ALL=y, which seem to do this. But again, we don't really know the compiler either.
If there are a set of environment variables for the standard compilers
(gnu, intel, pgi, ...), I can automatically set all of them in Hydra to at least help in some cases.
-- Pavan
-- Pavan Balaji http://www.mcs.anl.gov/~balaji