Introduction to Programming with MPI ------------------------------------ Practical Exercise 08 (More on Point-to-Point) ---------------------------------------------- For general instructions, see the introduction to the collective practicals. The remarks on buffered, synchronous and ordinary sends in the introduction to the point-to-point practicals also apply to these ones. Note that these examples are of the very simplest ways of using non-blocking I/O, which is all you are recommended to do initially. Question 1 ---------- 1.1 Take a copy of the program you wrote in question 3.1 in practical exercise 4, that was called 'Daggoo'. Remove the support for the buffering, and change the rotation collective to use non-blocking, ordinary (i.e. not buffering) sends and blocking, synchronous receives. 1.2 Change the rotation collective to use blocking, synchronous sends and non-blocking, ordinary receives. Question 2 ---------- 2.1 Take a copy of the program you wrote in question 5.1 in practical exercise 3, that was called 'Stubb'. Write a function that implements all-to-all using non-blocking sends and receives, and waits on all of them at once, to provide the same effect as MPI_Alltoall. Change the call of MPI_Alltoall to use that. Question 3 ---------- 3.1 This will seem a little pointless, but its usefulness will appear later, under problem decomposition and I/O. Use process 0 as the root process, and write a new program. In each process except the root process, set an integer variable m to the process id plus one (i.e. integers from 2 upwards) and integer variable n to 1. Then write an indefinite loop that calculates 'n = MOD(m*n,32)' in Fortran and 'n = (m*n)%32' in C/C++, and send each number to process 0 (using MPI_Send) as it is calculated. When n reaches 0 or 1, break out of the loop and finish off. In the root process, code an indefinite loop that uses one non-blocking receive for each other process and MPI_Waitany to print out the process number it receives from and the value of n it was sent, in the order they are received. It will need to create a new non-blocking receive for the sending process every time it gets a new value. When all other processes have sent 0 or 1, break out of the loop and finish off. 3.2 Change the program to use a single non-blocking receive and MPI_Wait, but make the program do the same job.