This chapter contains the following sections:
“Overview” describes how Power Fortran operates and suggests procedures for using it.
“Strategy for Using Power Fortran” explains when and how to use Power Fortran.
“Command-Line Options” lists and describes the command-line options.
“Directives” explains what a directive is and lists the supported directives.
“Assertions” explains what an assertion is and lists the supported assertions.
“Summary” is a short summary of the capabilities of Power Fortran.
MIPSpro Power Fortran 77 is a Fortran 77 compiler that enables you to run existing Fortran 77 programs efficiently on the Silicon Graphics POWER Series™ multiprocessor systems. Power Fortran analyzes a program, identifies loops that are safe to execute in parallel (concurrently), and generates a parallel version of the program.
The Silicon Graphics MIPSpro Fortran 77 compiler can generate code to split loop processing across all the available multiple processors. You do not need a multiprocessor system to develop under Power Fortran (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 Power Fortran on any Silcon Graphics system (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. However, simply passing code through Power Fortran rarely produces all the increased performance available. There are often easily removed data dependencies that prevent Power Fortran from running a loop in parallel. Using the listing file, optionally generated by Power Fortran, you can find the real or potential data dependencies that prevented Power Fortran from running a loop in parallel. Refer to Chapter 3, “Utilizing Power Fortran 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 Power Fortran to run the code in parallel by inserting Power Fortran assertions. These assertions look like Fortran 77 comments.
With Power Fortran, you select the code to convert to run in parallel. Thus, you can convert the whole program or key parts of it by adding Power Fortran directives manually or by having Power Fortran convert only selected files. Also, you can run Power Fortran on some, all, or none of a program's source files. The object files produced using Power Fortran 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.
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.
Use Power Fortran to identify which loops of a Fortran 77 program can be run safely in parallel. In some instances, Power Fortran alone makes a significant amount of the code run in parallel. However, for many programs simple code changes let Power Fortran automatically run more of the code in parallel.
Knowing when and where to modify your code means understanding the information in the Power Fortran listing. Understanding the Power Fortran 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 Power Fortran Output,” for information. Alternatively, you can use WorkShop Pro MPF to understand the code.
Power Fortran analyzes a program for data dependence. During this analysis, Power Fortran 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.
Power Fortran can safely run data-independent loops in parallel. When Power Fortran 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 Power Fortran cannot run a loop in parallel, the listing file explains where Power Fortran encountered problems.
To customize the way Power Fortran executes an entire program, you can specify various command-line options when you run Power Fortran (explained in Chapter 2, “How to Use Power Fortran.”) The six functional categories of command-line options are
parallelization
general optimization
inlining and interprocedural analysis
directive control
listing
advanced optimization
Many of these options are also recognized by the MIPSpro Fortran 77 compiler. This book describes only the options that are unique to Power Fortran. Chapter 4, “Customizing Power Fortran Execution,” explains when and how to use the various Power Fortran options, and Appendix A, “Power Fortran Command-Line Options,” provides a complete summary.
Power Fortran directives enable, disable, or modify a feature of Power Fortran. 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.
Power Fortran directives allow you to specify Power Fortran options in addition to, or instead of, command-line options. Directives placed on the first line of the input file are called global directives. Power Fortran 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. Power Fortran 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 Power Fortran directives have corresponding command-line options. If you specify conflicting settings in the command line and a directive, Power Fortran 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, Power Fortran uses the minimum of the command-line setting and the directive setting.
Power Fortran supports the following standard directives:
C*$* ARCLIMIT( n ) * | C*$* NO IPA * |
C*$* [NO] ASSERTIONS * | C*$* OPTIMIZE( n ) * |
C*$* CONCURRENTIZE | C*$* ROUNDOFF( n ) * |
C*$* EACH_INVARIANT_IF_GROWTH( n ) * | C*$* SCALAR OPTIMIZE( n ) * |
C*$* INLINE * | C*$* UNROLL( n[, m]) * |
C*$* IPA * | C$ * |
C*$* LIMIT( n ) | C$DOACROSS |
C*$* MAX_INVARIANT_IF_GROWTH( n ) * | C$& |
C*$* MINCONCURRENT( n ) * | C$CHUNK * |
C*$* NO CONCURRENTIZE | C$COPYIN * |
C*$* NO INLINE * | C$MP_SCHEDTYPE * |
![]() | Note: The * denotes that the directive is also supported by the MIPSpro Fortran 77 compiler and therefore, described in the MIPSpro Fortran 77 Programmer's Guide. |
In addition to the simple loop-level parallelism offered by the C$DOACROSS directive, Power Fortran supports a more general model of parallelism. This model is based on the work done by the Parallel Computing Forum (PCF), which itself formed the basis for the proposed ANSI-X3H5 standard. The compiler supports this model through compiler directives, rather than extensions to the source language.
Power Fortran supports the following PCF directives, which are described in the MIPSpro Fortran 77 Programmer's Guide:
C$PAR BARRIER
C$PAR [END] CRITICAL SECTION
C$PAR [END] PARALLEL
C$PAR PARALLEL DO
C$PAR [END] PDO
C$PAR [END] PSECTION[S]
C$PAR SECTION
C$PAR [END] SINGLE PROCESS
C$PAR &
Power Fortran supports the CrayTM directives listed below, which it maps to corresponding Power Fortran assertions. Refer to Chapter 7, “Fine-Tuning Power Fortran,” for details.
CDIR$ NEXT SCALAR
CDIR$ NO RECURRENCE*
CDIR$ IVDEP
Power Fortran supports the following VASTTM directives, which it maps to corresponding Power Fortran assertions:
CVD$ CNCALL
CVD$ CONCUR
CVD$ [NO] DEPCHK*
CVD$ [NO] LSTVAL*
As with the command-line options, many directives are also recognized by the MIPSpro Fortran 77 compiler. This manual describes those directives that are supported only by Power Fortran. Refer to Appendix B, “Power Fortran Directives,” for a summary.
Assertions provide Power Fortran with additional information about the source program. Sometimes assertions can improve optimization results. Use them only when speed is essential.
As with a directive, Power Fortran treats an assertion as a global assertion if it comes before all comments and statements in the file. That is, Power Fortran treats the assertion as if it were repeated at the top of each program unit in the file. However, Power Fortran does not check the correctness of assertions.
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-1 lists the accepted Power Fortran assertions and their longevity.
Table 1-1. Power Fortran Assertions and Their Duration
Assertion | Duration |
---|---|
C*$* ASSERT [NO] ARGUMENT ALIASING[a] | Until reset |
C*$* ASSERT [NO] BOUNDS VIOLATIONSa | Until reset |
C*$* ASSERT CONCURRENT CALL | Next loop |
C*$* ASSERT DO (CONCURRENT) | Next loop |
C*$* ASSERT DO (SERIAL) | Next loop |
C*$* ASSERT DO PREFER (CONCURRENT) | Next loop |
C*$* ASSERT DO PREFER (SERIAL) | Next loop |
C*$* ASSERT [NO] EQUIVALENCE HAZARDa | Until reset |
C*$* ASSERT [NO] LAST VALUE NEEDED | Until reset |
C*$* ASSERT NO RECURRENCE | Next loop |
C*$* ASSERT NO SYNC | Next loop |
C*$* ASSERT RELATION (name.xx. name) | Next loop |
C*$* ASSERT PERMUTATION (name)a | Next loop |
C*$* ASSERT [NO] TEMPORARIES FOR CONSTANT ARGUMENTSa | Next loop |
[a] The MIPSpro Fortran 77 Programmer's Guide describes this assertion. |
As with the command-line options and directives, many assertions are also recognized by the MIPSpro Fortran 77 compiler. This manual describes those assertions that are supported only by Power Fortran.
Power Fortran provides information about the dependencies of loops in a Fortran 77 program. Often, Power Fortran can use this information to automatically run loops in parallel. But when Power Fortran 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 Power Fortran 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 7 in the MIPSpro 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.