All output printed after script has finished

Hi everyone,

I’m running my model on a new computer cluster and I’m running into a weird problem. In the model a temporal hook is present, and in every timestep I print some info for monitoring. For example:

# Time-stepping
t = 0
for n in range(num_steps):

    # Update current time
    t += dt
    print(t)

On the old PC on which I ran this, the print(t) was printed to the terminal in real time. On the cluster PC however, this info is printed for the complete simulation at once, but only after the simulation has finished. In this manner I cannot use it for monitoring. Does anyone what the problem can be and how to fix this?

I think this is an issue with std out not being flushed after every call to print when running with MPI. E.g. here.

Someone will hopefully have some command line switches to fix this, but in the meantime you can call dolfin::info to output to the log at runtime. Also consider parameters["std_out_all_processes"] = False if you want to suppress the output across all processes and only see on process 0.