MPI programs require that library routines that are part of the basic language environment (such as write in Fortran and printf and malloc in ISO C) and are executed after MPI_INIT and before MPI_FINALIZE operate independently and that their completion is independent of the action of other processes in an MPI program.
Note that this in no way prevents the creation of library routines that
provide parallel services whose operation is collective. However, the
following program is expected to complete in an
ISO C
environment
regardless of the size of MPI_COMM_WORLD (assuming that
printf is available at the executing nodes).
int rank; MPI_Init((void *)0, (void *)0); MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank == 0) printf("Starting program\n"); MPI_Finalize();The corresponding Fortran programs are also expected to complete.
An example of what is not required is any particular ordering
of the action of these routines when called by several tasks. For
example, MPI makes neither requirements nor recommendations for the
output from the following program (again assuming that
I/O is available at the executing nodes).
MPI_Comm_rank(MPI_COMM_WORLD, &rank); printf("Output from task rank %d\n", rank);In addition, calls that fail because of resource exhaustion or other error are not considered a violation of the requirements here (however, they are required to complete, just not to complete successfully).