This chapter contains the following main topics:
“Power Fortran 90 Concepts” surveys the main concepts behind Power Fortran 90.
“The Power Fortran Design Cycle” gives an overview of how you normally use Power Fortran 90.
“Tuning Power Fortran 90” summarizes the control inputs you can use.
“Relation to Parallel Directives” reviews the relationship between Power Fortran and other parallel-execution directives.
MIPSpro Power Fortran 90 (called Power Fortran hereafter) is an extended version of the MIPSpro Fortran 90 compiler that enables you to compile existing Fortran 90 programs so that they use multiple CPUs concurrently when running on a Silicon Graphics multiprocessor system. Power Fortran analyzes a program, identifies loops that can safely execute in parallel, and generates a parallel version of the program.
When you execute the parallelized program on a multiprocessor, the program dynamically adjusts itself to use all the CPUs available on the system at the time, and so runs faster than when it runs serially on one CPU.
Power Fortran does not require a multiprocessor system to compile. The parallel version of your program can run on a uniprocessor with some slight loss of speed. Thus you can compile and test using Power Fortran on any Silicon Graphics workstation or server.
You select the code to be converted. You can convert the whole program or you can select key parts of it, either by adding directives or by applying Power Fortran only to selected source files. Object files produced by Power Fortran are fully compatible with object files that run only serially, and with object files that you prepared manually for parallel execution.
You can also use Power Fortran with WorkShop Pro MPF, an optional product available from Silicon Graphics. It provides a graphical interface to the analysis performed by Power Fortran and allows you to understand and control your program to be run in parallel. WorkShop Pro MPF also works with the WorkShop/Performance Analyzer to help you concentrate on those parts of the program that are taking the longest to execute.
Simply passing code through Power Fortran rarely produces all the increased performance available. Power Fortran analyzes the way your program uses variables, and it must make conservative assumptions about how one variable depends on others. As a result, Power Fortran often detects data dependencies that prevent it from converting a loop to parallel operation.
You use the listing file generated by Power Fortran to find out which loops it can run in parallel and which it cannot. When a loop cannot be parallelized, you use the listing to find out why. Often the reason is a real or assumed dependency that you can easily remove. By making small changes in the program, for example by adding an assertion statement, you enable Power Fortran to parallelize much more of the program.
You should not apply Power Fortran until you have a complete, working version of your Fortran 90 program. There are three reasons for this:
Power Fortran compilation takes longer than normal compilation, so it is good to be done with the frequent recompilations of the testing phase.
Debugging a parallel program can be difficult, so it is good to know that all functions of the program work correctly in serial execution before you attempt parallel execution.
The point of parallelization is improved performance, so it is good to have a complete test setup and to know the serial execution times for different inputs—otherwise you will not know whether parallel execution is doing any good or not.
When the program is ready, use Power Fortran in the following cycle:
Compile the program using MIPSpro Power Fortran 90, specifying the -pfalist driver option to generate a listing file.
Examine the listing file, which shows the structure of the program and how Power Fortran dealt with each loop.
If there are any obvious data dependencies or other changes to make, apply them and repeat from step 1.
Run the parallelized program against your test cases and measure its performance. If you think there is more to be gained, modify the source program and repeat from step 1.
Chapter 2, “Using Listing and Temporary Files,” describes the contents of the Power Fortran listing and how you interpret it.
You tune and control the work of Power Fortran in three ways:
Using driver options, you set global limits and policies on the way Power Fortran works. For example, you use the -minconcurrent option to set a limit on the simplest loop that is worth parallelizing.
Using assertions, which are Fortran comment lines that tell Power Fortran about your program, you inform Power Fortran of how to resolve data dependencies, and you mark specific loops to be ignored or to be parallelized.
Using directives, which are Fortran comment lines that instruct Power Fortran, you set special handling of sections of the source code.
Chapter 3, “Working With Power Fortran 90,” tells how to use driver options, directives, and assertions to fine-tune the output of Power Fortran.
When Power Fortran detects a loop that can be run in parallel, it generates directive statements and inserts them into the program. These directives are interpreted by MIPSpro Fortran 90. It is the Fortran 90 compiler that implements the parallel code, based on the generated directives.
You can write and insert parallel-execution directives yourself, and Fortran 90 will act on them. This process is documented in the MIPSpro Fortran 90 Programmer's Guide.
In most cases it is better to let Power Fortran automatically choose the loops to run in parallel, rather than forcing a loop to run in parallel by directly inserting parallel directives. When you specify the code to run in parallel, you need to verify that no subsequent modification inserts a data dependency, causing a serious (and hard-to-find) error. When you rewrite a loop so that Power Fortran recognizes the loop as safe to run in parallel, Power Fortran can check future modifications for data dependencies.