Skip to main content

more options


SPMD Solution

This program is:

  • SPMD because all processes run the same program
  • DATA PARALLEL because the work is partitioned by data
  • SCALABLE because none of the work is constrained by one process and no global communication is required

Reading/writing data

  • All tasks read in two small data items, the number of points along the string, and the number of time steps
  • There are several possible ways to read in the file(s) containing the array of initial amplitudes
    • All tasks read in all the data, then throw out everything but their chunk
    • or- Each task reads in its own file containing just a portion of the data (supply subsets of the initial data in separate files)
    • or- Each task reads in appropriate records from a single direct-access file. This method is illustrated in the complete wave code linked to on the following page.
  • A different approach is to appoint one Manager task to read in all the initial data and scatter appropriate chunks to the Worker tasks (itself included). The Manager and Worker roles can be embedded into a single program by using "if" statements. That technique is covered in the next subsection.

This program is:

  • SPMD because all processes run the same program
  • DATA PARALLEL because the work is partitioned by data
  • SCALABLE because none of the work is constrained by one process and no global communication is required

Reading/writing data

  • All tasks read in two small data items, the number of points along the string, and the number of time steps
  • There are several possible ways to read in the file(s) containing the array of initial amplitudes
    • All tasks read in all the data, then throw out everything but their chunk
    • or- Each task reads in its own file containing just a portion of the data (supply subsets of the initial data in separate files)
    • or- Each task reads in appropriate records from a single direct-access file. This method is illustrated in the complete wave code linked to on the following page.
  • A different approach is to appoint one Manager task to read in all the initial data and scatter appropriate chunks to the Worker tasks (itself included). The Manager and Worker roles can be embedded into a single program by using "if" statements. That technique is covered in the next subsection.