Next | Prev | Up | Top | Contents | Index

Creating Parallel Programs

In each of the three languages, the language compiler supports explicit statements that command parallel execution (#pragma lines for C; directives and assertions for Fortran). However, placing these statements is a demanding, error-prone task. It is easy to create a suboptimal program, or worse, a program that is incorrect in subtle ways. Furthermore, small changes in program logic can invalidate parallel directives in ways that are hard to foresee, so it is difficult to maintain a program that has been manually made parallel.

For each language, there is a source-level program analyzer that is sold as a separate product (IRIS POWER C, MIPSpro Power Fortran 77, MIPSpro Power Fortran 90). The analyzer identifies sections of the program that can safely be executed in parallel, and automatically inserts the parallelizing directives. After any logic change, you can run the analysis again, so that maintenance is easier.

The source analyzer makes conservative assumptions about the way the program uses data. As a result, it often is unable to find all the potential parallelism. However, the analyzer produces a detailed listing of the program source, showing each segment that could or could not be parallelized, and why. Directed by this listing, you insert source assertions that give the analyzer more information about the program.

The method of creating an optimized parallel program is as follows:

  1. Write a complete application that runs on a single processor.

  2. Completely debug and verify the correctness of the program in serial execution.

  3. Apply the source analyzer and study the listing it produces.

  4. Add assertions to the source program. These are high-level statements that describe the program's use of data, not explicit commands to parallelize.

  5. Repeat steps 3 and 4 until the analyzer finds as much parallelism as possible.

  6. Run the program on a single-memory multiprocessor.
When the program requires maintenance, you make the necessary logic changes and, simultaneously, you remove any assertions about the changed code--unless you are certain that the assertions are still true of the modified logic. Then repeat the preceding procedure from step 2.


Next | Prev | Up | Top | Contents | Index