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:
after each printf/cout statement. (cout << endl; may also flush the buffer, I'm not sure.) This will flush the buffer after each printf/cout so no output will be in the buffer when a process exits MPI.fflush(stdout);
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:
after every printf/cout 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.