Hands-On Session Advanced Messaging #4:
Dynamic Process Creation and MPI I/O

Objective: To gain experience in dynamic MPI process creation and I/O.
The code for this exercise can be found here.
Instructions on how to log into the remote machine and how to download the source code to your working directory (using wget) can be found here.

Dynamic Process Creation

  1. Inspect the files helloParentMPI.c and helloChildMPI.c. Run the program with 4 parent processes and 6 children processes. Check that the results are what you expected.
  2. Extend these files to that a token (an integer) is passed around in a ring-like fashion across all processes, starting from and ending at parent process 0. The token is incremented as it is passed. All processes print a message with the value of the token, together with their rank and whether they are a parent/child. Thus parent process 0 should receive a token of the value of the total number of processes.

MPI-IO

  1. Inspect the file helloMPIIO.c. Make and run the MPI-IO example helloMPIIO with 4 processes. Check that the results (including the created text file) are what you expected.
  2. Fix sine.c to output sine.dat to plot using gnuplot. There is a subtle bug that needs to be fixed AND you need to add in the MPI-IO code to write out, in binary, the data from computing sin(x), from x=0,2Pi. This goes into a file sine.dat. The file dosineplot reads this data (a series of 200 or so binary floating point numbers) and uses the gnuplot utility to plot it. The command make sineplot runs the sine program over 7 MPI processes and plots the data

    To compile and test your code, use the command make sineplot. Note that it deletes the old sine.dat - this seems to be necessary as the MPI file open mode does not seem to overwrite an existing file. Remember to use ssh –XY login@raijin.nci.org.au to get X11 forwarding working. A sample plot is given below:

  3. Sine Plot