Chapter 1. Overview of PFA

This chapter contains the following sections:


PFA is a Fortran 77 source-to-source preprocessor that enables you to run existing Fortran 77 programs efficiently on the Silicon Graphics POWER SeriesTM multiprocessor systems. PFA analyzes a program and identifies loops that do not contain data dependencies. Such loops are safe to execute in parallel (concurrently). PFA automatically inserts special compiler directives in a modified copy of the original source code. (PFA produces a number of files containing code and other information you need to run a program concurrently on multiple processors.)

Interpreting the PFA-generated compiler directives, the Silicon Graphics Fortran 77 compiler can generate code to split loop processing across all the available multiple processors. Because the directives inserted by PFA look like standard Fortran 77 comment statements, PFA does not affect the portability of the code to non–Silicon Graphics, Inc. (SGl), systems.

In addition, you do not need a multiprocessor system to develop under PFA (although there is a slight performance loss when running multiprocessed code on a single-processor system). You can develop and test a Fortran 77 program using PFA on any IRIS-4DTM Series workstation (including single-processor systems) and then execute the program on a multiprocessor system. The executable code automatically adjusts itself to use all the processors available on the workstation at run time. (You can also manually specify the number of processors to use; see the Fortran 77 Programmer's Guide.) However, simply passing code through PFA rarely produces all the increased performance available. There are often easily removed data dependencies that prevent PFA from running a loop in parallel. Using the listing file, optionally generated by PFA, you can find the real or potential data dependencies that prevented PFA from running a loop in parallel. Refer to Chapter 3, “Utilizing PFA Output,” for details about the listing file.

If the data dependency is real, you can often remove the dependency by making a small change to the code. If the data dependency was apparent but not real, you can explicitly instruct PFA to run the code in parallel by inserting PFA assertions. These assertions look like Fortran 77 comments.

With PFA, you select the code to convert to run in parallel. Thus, you can convert the whole program or key parts of it by adding PFA directives manually or by having PFA convert only selected files. In addition, you can run PFA on some, all, or none of a program's source files. The object files produced using PFA are fully compatible with other object files. You can freely combine them with object files that you prepared manually for parallel execution and with object files that run only serially.

Strategy for Using PFA

Use PFA to identify which loops of a Fortran 77 program can be run safely in parallel. In some instances, PFA alone makes a significant amount of the code run in parallel. However, for many programs simple code changes let PFA automatically run more of the code in parallel.

Knowing when and where to modify your code means understanding the information in the PFA listing. Understanding the PFA listing will make it easy to recognize where small changes to the code can make big differences in how much code can run in parallel. Refer to Chapter 3, “Utilizing PFA Output”,” for information.

PFA analyzes a program for data dependence. During this analysis, PFA looks for Fortran 77 DO loops in which each iteration of the loop is independent of all other iterations. If each iteration of the loop is self-contained, the system can execute the iterations in any order (or even simultaneously on separate processors) and produce the same result after running all iterations.

When PFA finds a loop with data independence, PFA knows it can safely run the loop in parallel. When PFA finds a loop that contains iterations that are dependent on other iterations, it cannot safely run the loop in parallel but can tell you what is causing the problem. If PFA cannot run the loop in parallel, the listing file will explain where PFA encountered problems.

Command Line Options

To customize the way PFA executes an entire program, you can specify various command line options when you run PFA directly or when you specify PFA as part of a compile (Chapter 2, “How to Use PFA,” explains both procedures). The five functional categories of command line options are

  • parallel execution

  • general optimization

  • Fortran 77 language control

  • directive control

  • listing

Chapter 4, “Customizing PFA Execution,” explains when and how to use the various options, and Appendix A, “PFA Command Line Options,” provides a complete summary.


PFA directives enable, disable, or modify a feature of PFA. Essentially, directives are command line options specified within the input file instead of on the command line. Unlike command line options, directives have no default setting. To invoke a directive, you must either toggle the directive on or set a desired value for its level.

PFA directives allow you to specify PFA options in addition to, or instead of, command line options. Directives placed on the first line of the input file are called global directives. PFA interprets them as if they appear at the top of each program unit in the file. Use global directives to ensure that the program is compiled with the correct command line options. Directives appearing anywhere else in the file apply only until the end of the current program unit. PFA resets the value of the directive to the global value at the start of the next program unit. (Set the global value using a command line option or a global directive.)

Some command line options act like global directives. Other command line options override directives. Many PFA directives have corresponding command line options. If you specify conflicting settings in the command line and a directive, PFA chooses the most restrictive setting. For Boolean options, if either the directive or the command line has the option turned off, it is considered off. For options that require a numeric value, PFA uses the minimum of the command line setting and the directive setting.

Table 1-1 lists the directives supported by PFA. In addition to the standard directive, PFA supports the CrayTM and VASTTM directives listed in the table. PFA maps these directives to corresponding PFA assertions. Refer to Chapter 5, “Fine-Tuning PFA”,” for details.

Table 1-1. PFA Directives




















































Refer to Appendix B, “PFA Directives,” for a list and description of PFA directives.


Assertions provide PFA with additional information about the source program. Sometimes assertions can improve optimization results. Use them only when speed is essential.

Because PFA does not check the correctness of assertions, they can be unsafe. If you specify an incorrect assertion, the PFA-generated code might give different answers from the scalar program. If you suspect unsafe assertions are causing problems, use the -NODIRECTIVE command line option or the C*$* NO ASSERTIONS directive to tell PFA to ignore all assertions.

As with a directive, PFA treats an assertion as a global assertion if it comes before all comments and statements in the file. That is, PFA treats the assertion as if it were repeated at the top of each program unit in the file.

C*$* ASSERT RELATION (name .xx. name) assertions include variable names. If you specify them as global assertions, a program uses them only when those variable names appear in COMMON blocks or are dummy argument names to the subprogram. You cannot use global assertions to make relational assertions about variables that are local to a subprogram.

Many assertions, like directives, are active until the end of the program unit (or file) or until you reset them. Other assertions are valid only for the DO loop before which they appear (such as C*$* ASSERT DO PREFER (CONCURRENT)). This type of assertion applies to the next DO loop but not to any loop nested inside it.

Table 1-2 lists PFA assertions and their duration.

Table 1-2. PFA Assertions and Their Duration




Next Loop


Next Loop


Next Loop


Next Loop


Until Reset


Until Reset

C*$* ASSERT RELATION (name .xx. name)

Next Loop


Next Loop


Next Loop


Next Loop


PFA provides information about the dependencies of loops in a Fortran 77 program. Often, PFA can use the information to run loops in parallel automatically. But when PFA is not able to convert the code for parallel execution automatically, it can tell you where it ran into problems. Often, you need only make a small change to remove the dependencies that prevent the loop from running in parallel. The better you understand the information PFA gives you, the better equipped you will be to transform the program into an efficient parallel version.

For more information about parallel processing in general, see Chapter 5 in the Fortran 77 Programmer's Guide. Especially recommended are the sections “Analyzing Data Dependencies for Multiprocessing” and “Breaking Data Dependencies” for information about recognizing and repairing data dependency problems.