Purpose
Library
libmpi.a
C synopsis
#include <pm_util.h> int mpc_stdout_mode(int mode);
FORTRAN synopsis
MP_STDOUT_MODE(INTEGER MODE)
Parameters
Description
This parallel utility subroutine requests that STDOUT be set to single, ordered, or unordered mode. In single mode, only one task output is displayed. In unordered mode, output is displayed in the order received at the home node. In ordered mode, each parallel task writes output data to its own buffer. When a flush request is made all the task buffers are flushed, in order of task ID, to STDOUT home node.
Notes
Return values
In C and C++ calls, the following applies:
Examples
C Example
The following program uses poe with the -labelio yes option and three tasks:
#include <pm_util.h>
main()
{
mpc_stdout_mode(STDIO_ORDERED);
printf("These lines will appear in task order\n");
/*
* Call mpc_flush here to make sure that one task
* doesn't change the mode before all tasks have
* sent the previous printf string to the home node.
*/
mpc_flush(1);
mpc_stdout_mode(STDIO_UNORDERED);
printf("These lines will appear in the order received by the home node\n");
/*
* Since synchronization is not used here, one task could actually
* execute the next statement before one of the other tasks has
* executed the previous statement, causing one of the unordered
* lines not to print.
*/
mpc_stdout_mode(1);
printf("Only 1 copy of this line will appear from task 1\n");
}
Running the above C program produces the following output (task order of lines 4-6 may differ):
0 : These lines will appear in task order.
1 : These lines will appear in task order.
2 : These lines will appear in task order.
1 : These lines will appear in the order received by the home node.
2 : These lines will appear in the order received by the home node.
0 : These lines will appear in the order received by the home node.
1 : Only 1 copy of this line will appear from task 1.
FORTRAN Example
CALL MP_STDOUT_MODE(-2) WRITE(6, *) 'These lines will appear in task order' CALL MP_FLUSH(1) CALL MP_STDOUT_MODE(-3) WRITE(6, *) 'These lines will appear in the order received by the home node' CALL MP_STDOUT_MODE(1) WRITE(6, *) 'Only 1 copy of this line will appear from task 1' END
Running the above program produces the following output (the task order of lines 4 through 6 may differ):
0 : These lines will appear in task order.
1 : These lines will appear in task order.
2 : These lines will appear in task order.
1 : These lines will appear in the order received by the home node.
2 : These lines will appear in the order received by the home node.
0 : These lines will appear in the order received by the home node.
1 : Only 1 copy of this line will appear from task 1.
Related information
Commands:
Subroutines: