Identifying the I/O Process Rank
Each implementation of MPI is supposed to provide several predefined attributes cached with MPI_COMM_WORLD
Among these is the attribute with key MPI_IO
The content of this attribute is the rank of a process that can carry out language standard I/O (e.g. fopen(), fprintf()).
Several caveats:
- if no process can carry out I/O the attribute content will be the predefined constant MPI_PROC_NULL
- if every process, MPI_ANY_SOURCE
- some processes, those that can have attribute content equal to their rank, those that can’t should have attribute content equal to someone who can
- the MPI_IO attribute does not indicate which process can provide input. So even if the content is MPI_ANY_SOURCE it may be the case that the implementation doesn’t provide access to stdin