next up previous
Next: Customising eighth.c for Up: Lesson 5 -- Previous: The listing of

The synopsis of eighth.c

The program begins by reorganising MPI processes into a rectangular grid. This organisation is virtual. The processes get new rank numbers, and a new level of connectivity is organised for them, so that they know their left, right, top and bottom neighbours.

The master process queries all other processes about their place in this structure and the obtained information is displayed on standard output.

Once organised into a grid, all processes intialise small matrices for themselves with their new rank number, which corresponds to their place in the Cartesian grid. These matrices are also sent back to the master and displayed.

At this stage the first communication procedure takes place between the processes. They exchange top and bottom rows of their matrices with their top and bottom neighbours. This procedure is frequently used in data parallel programs, where it corresponds to the exchange of boundary data between computational nodes. The result of that exchange is again displayed by the master process on standard output.

Finally, the processes exchange left and right columns of their matrices with their left and right neighbours. Because in C columns are not stored contiguously, certain additional operations must be performed, before data transfer can take place. The result of this operation is again displayed on standard output by the master process and the program terminates.



Zdzislaw Meglicki
Tue Feb 28 15:07:51 EST 1995