see results in output file while running

I’ve noticed something strange while running a code in PGI Visual Fortran. Let me explain:

Somewhere in my code, I open a file (output.dat) in order to write my results from an iterative analysis. When analysis starts, the output.dat is blank (this is true). The whole analysis consists of 1000 steps (let’s say). When i open again the output.dat file in step=30, again it’s blank. When analysis ends (step=1000), then the output.dat file has all the results of all 1000 steps.

Why is this happening? Can i see my results in the intercalary steps of analysis?


PS. I’m using PGI VF 2010 v10.9

Hi mariospapa10,

The OS is buffering the output. Try adding “call flush(unitnum)” directly after you write to the output.dat file (replace unitnum with the unit number of the file). It will slow your program down a bit but should force the OS to flush the buffer. Granted I’ve only done this on Linux, but I would assume it works on Windows as well.

  • Mat

Thanks Mat… working now!