I am wondering if there is a command or method in OpenMPI to have an atomic call to write to stdout (or, for that matter, any thread).
I noticed that when you run MPI programs, write to cout calls (or other threads) can get confused, since every proc can write every time it gets to a particular section of code. When presenting the results, a string can be written in several procedures, which confuses the problem. So 2 different procs can do something like this:
cout << "My results are: " << result1 << " " << resul2 << endl;
and
cout << "My results are: " << result1 << " " << resul2 << endl;
But the result could be:
My results are: 20 My results are: 10 11 21
- "" cout ( , , , ). , cout, , endl flush . , , (, , , ):
My results are: 20 21
My results are: 10 11