Introduction to Programming with MPI ------------------------------------ Practical Exercise 05 (More on Datatypes and Collectives) --------------------------------------------------------- For general instructions, see the introduction to the collective practicals. Question 1 ---------- Take a copy of the program you wrote in question 4.2 in practical exercise 3, that was called 'Queequeg'. 1.1 Change the program to find the maximum value and the process number on which it occurs, and display them from the root. Question 2 ---------- Take a copy of the program you wrote in question 2.4 in practical exercise 3, that was called 'Ishmael'. 2.1 Change the file name from 'reals.input' to 'mixed.input', and read in 4 integers that give the number of reals that should be scattered to each process. Allocate an array of exactly that size and read in that number of elements (Fortran programmers should use a single READ statement). Add a scatter to distribute the sizes, and change the original scatter to MPI_Scatterv. Note that this is the simpler way to answer question 4.1 in practical exercise 4. Fortran Programmers Only ------------------------ 3.1 Take a copy of the program you wrote in question 1.1 in practical exercise 3, that was called 'Ahab'. Remove the 'USE double', change any uses of DP to MYP and add the following statement before the first use of MYP: INTEGER, PARAMETER :: MYP = SELECTED_REAL_KIND(12) Create and use an appropriate MPI derived datatype for that precision (provide MPI_UNDEFINED for the requested exponent range), instead of MPI_DOUBLE_PRECISION, and run the program. 3.2 Change the precision from 12 digits to 5, and check that the program still works. Then change it to 18, and check again. You now have a fully precision-generic MPI program! There are no specimen answers for this question, as the changes are so simple.