2 MPI Programs

2.6 MPI_COMM_WORLD and communicators


MPI_INIT defines something called MPI_COMM_WORLD for each process that calls it. MPI_COMM_WORLD is a communicator. All MPI communication calls require a communicator argument and MPI processes can only communicate if they share a communicator.

Figure 9: The predefined communicator MPI_COMM_WORLD for seven processes. The numbers indicate the ranks of each process.

Every communicator contains a group which is a list of processes. Secondly, a group is in fact local to a particular process. The apparent contradiction between this statement and that in the text is explained thus: the group contained within a communicator has been previously agreed across the processes at the time when the communicator was set up. The processes are ordered and numbered consecutively from 0 (in both Fortran and C), the number of each process being known as its rank. The rank identifies each process within the communicator. For example, the rank can be used to specify the source or destination of a message. (It is worth bearing in mind that in general a process could have several communicators and therefore might belong to several groups, typically with a different rank in each group.) Using MPI_COMM_WORLD, every process can communicate with every other. The group of MPI_COMM_WORLD is the set of all MPI processes.


Contact us at epcc-tec@epcc.ed.ac.uk

Last Updated 25 AUG 95
Generated with CERN WebMaker