6.1 HPF Basics

HPF is a set of extensions to Fortran 90 intended to facilitate writing parallel Fortran programs. Appropriately written HPF programs that are run in an HPF-capable environment, such as a cluster running Digital's PSE (Digital Parallel Software Environment), can execute at a dramatically faster speed than Fortran programs run in a single-processor environment.

HPF is especially useful for programs that can be expressed as large scale array operations, a major class of computationally intensive programs. HPF programming involves inserting directives that advise the compiler about potentially parallelizable array operations. Lower level details of parallelization, such as message passing and synchronization, are automated by the compiler, and invisible to the programmer.

Digital Fortran 90 parallelizes array operations when these array operations are accompanied by HPF directives. The compiler uses the information given in the directives to spread data storage and computation across a cluster. For a large class of computationally intensive problems, using HPF under PSE achieves a dramatic increase in performance over serial (nonparallel) execution.

6.1.1 When to Use HPF

For many programs, HPF can produce enormous performance gains, with speed up in near direct proportion to the number of processors. Some algorithms, however, are not suitable for HPF implementation.

There is no formula or completely general rule for determining when HPF is useful, because the achievable degree of parallel speed- up is highly algorithm-dependent. Nevertheless, the following considerations can serve as a rough guide.

6.1.1.1 Existing Code

Existing codes are good candidates for conversion to HPF under the following circumstances:

6.1.1.2 New Code

For new code, HPF is generally useful in the following cases:

6.1.2 Syntax and Function of HPF Directives

These are examples of HPF directives:

!HPF$ DISTRIBUTE A(BLOCK, BLOCK)
!HPF$ ALIGN B(I) WITH C(I)
!HPF$ PROCESSORS P(8)

HPF directives are preceded by the tag !HPF$ , to identify them to the compiler. Because this tag begins with an exclamation mark (!), all HPF directives are syntactically Fortran comments. Except for a syntax check at compile time, HPF directives are ignored (treated like comments) in source code not explicitly compiled for execution on a PSE cluster, and have no effect on the meaning of the program. When compiled under PSE with the -wsf switch (see Section 8.1.1.1), the compiler uses the HPF directives to create a parallelized version of the program. In a parallel environment, correctly used HPF directives affect only the performance of a program, not its meaning or results. Incorrect use of HPF directives can inadvertently change the meaning of the code, producing an illegal program. See Sections 6.4.2 and 6.4.5).

HPF directives must follow certain syntax rules in order to produce meaningful results. For example, the !HPF$ tag must begin in column 1 in fixed source form, but may be indented in free source form. A number of other syntax rules apply.

For More Information:

6.1.3 List of HPF Directives

Table 6-1 lists the HPF directives, and the sections in this chapter which explain them.

Table 6-1 HPF Directives and HPF-Specific Attribute

HPF Directive  Where Documented 
ALIGN  Section 6.3.3 
DISTRIBUTE  Section 6.3.6 
INDEPENDENT  Section 6.2.4 
INHERIT  Section 6.4.6 
PROCESSORS  Section 6.3.5 
TEMPLATE  Section 6.3.4 
HPF-Specific Attribute  Where Documented 
PURE  Section 6.4.5 

6.1.4 Minimum Requirements for Parallel Execution

In order to achieve performance gains from using HPF, programs must be written so that they execute in parallel. In order to be compiled to execute in parallel, certain minimum requirements must be met. Code that does not meet these requirements is not parallelized, and is compiled to run serially, with no parallel speed-up.