next up previous contents
Next: Error Messages Up: Common Problems: Descriptions Previous: Common Problems: Descriptions

Lost Output

 

If some or all of your output does not appear, it is the result of one of two things (or a combination of both). Sometimes the output will have disappeared without a trace. The reason for this is that under UNIX, output is placed in a buffer to be printed, but not actually printed yet, to increase the efficiency of the system. Sometimes MPI marks a process as dead when it exits, and therefore the output in the buffer is never read. This is usually the case when some output appears, but not all of it. To correct this, add the statement:

fflush(stdout);
after each printf statement. This will flush the buffer after each printf so no output will be in the buffer when a process exits MPI.

If you attempt to write output to a single file from multiple processes, the file will be overwritten; there is no append capability. The file will contain only the output from the last process that writes to it.

Writing to standard output does appear to work okay, except that the information may not appear in the order your program would suggest. Again, adding the following:

fflush(stdout);
sleep(1);

after every printf statement will often force the output to arrive in the proper order, when the real problem is the network latency, and not nondeterminism in your program.



Lori Pollock
Wed Feb 4 14:18:58 EST 1998