trjconv doesn't display stdout properly during conversion
I run a 100 ns simulation saving a frame every 1 ps, so I have 100,000 frames. I convert the file to a new trajectory with 50,000 frames (so every 2ps):
gmx trjconv -f prd.xtc -dt 2 -o out.xtc
During the conversion this is displayed for example (the number obviously updates) with lots of flickering throughout the entire conversion process (until the end where it is displayed properly):
-> frame 490 time 980.000 -> frame 450 time 900.000
Other times I run it, it shows up properly throughout the entire run:
Reading frame 1000 time 1000.000 -> frame 500 time 1000.000
Flush streams when not writing newline character
Some of our routines use the carriage return without a newline
to keep writing the status e.g. on stderr.
For some operating systems this seems to lead to the output
being cached in the buffers, so this change adds an explicit
fflush() for these print stamements.
#1 Updated by Erik Lindahl over 5 years ago
It's likely the OS buffering stdout/stderr, which might make the behavior dependent on the current load on the system (or whatever other OS properties). Not sure we can fix it in Gromacs since we also depend on staying on a single line (i.e., no line feeds), and that might not go well with flushing the streams.