Technical data

120
Chapter 6: Compiling and Debugging Parallel Fortran
4. If necessary, rewrite the code to make it parallelizable. Add
C$DOACROSS statements as appropriate.
5. Debug the rewritten code on a single processor.
6. Run the parallel version on a multiprocessor. Verify that the answers
are correct.
7. If the answers are wrong, debug the parallel code. Always return to
step 5 (single-process debugging) whenever any change is made to the
code.
8. Prole the parallel version to gauge the effects of the parallelism.
9. Iterate these steps until satised.
First Pass
The next several pages take you through the process outlined above. The
exercise is based on a model of a molecular dynamics program; the routine
shown below will not work except as a test bed for the debug exercise.
Step 1: Make the Original Work
Make sure the original code runs on a Silicon Graphics workstation before
attempting to multiprocess it. Multiprocess debugging is much harder than
single-process debugging, so x as much as possible in the single-process
version.
Step 2: Prole
Proling the code enables you to focus your efforts on the important parts.
For example, initialization code is frequently full of loops that will
parallelize; usually these set arrays to zero. This code typically uses only 1
percent of the CPU cycles; thus working to parallelize it is pointless.
In the example, you get the following output when you run the program
with pixie. For brevity, we omit listing the procedures that took less than 1
percent of the total time.