next up previous index
Next: Interacting Particles Up: Diffusion Previous: The Discussion

Exercises

1
The program discussed in section 5.2.5 initializes all entries in the $4\times4$ matrices managed by the worker processes to the rank number of the processes. But it is only the $2\times2$ interior of these matrices that is really managed by the processes, whereas the boundary rows and columns are filled by obtaining data from the neighbouring processes. Rewrite the initialization procedure to initialize only the $2\times2$ interior to the process rank number and the remainder of each matrix should be initialized to minus the rank number.
Hint
You will have to revise the function that displays the matrices, because you will need more space for the minus sign.
2
The program transfers whole $1\times 4$ rows or $4\times1$ columns between processes. But it is only the $1\times 2$ or $2\times1$ interior of the columns and rows that contains the valid data. Rewrite the program to transfer only what is really needed between the neighbouring processes.
3
Revise the program to allow for an arbitrary number of start-up processes. Fix the bug that does not account for the fact that some processes may not make it into the newly formed Cartesian communicator and that the master process may be amongst them.


next up previous index
Next: Interacting Particles Up: Diffusion Previous: The Discussion
Zdzislaw Meglicki
2004-04-29