15.3.4 INDEPENDENT Directive (TU*X only)

The INDEPENDENT directive asserts that the iterations of a DO loop or the computations for different active index values of a FORALL construct or statement do not interfere with each other.

The compiler uses this information to produce more efficient code. This implies that the DO loop, FORALL construct, or FORALL statement will produce the same answers if its iterations or computations are executed in parallel or in any sequential order.

The INDEPENDENT directive takes the following form:

!HPF$ INDEPENDENT [, NEW (var-list)]

var-list
Is a list of one or more variables. They cannot be pointers or dummy arguments, and cannot have the SAVE or TARGET attribute.

Rules and Behavior

Except for comment lines, the DO loop, FORALL construct, or FORALL statement must immediately follow the INDEPENDENT directive that defines its behavior. The DO loop, FORALL construct, or FORALL statement must behave as described in the Compaq Fortran User Manual for Tru64 UNIX and Linux Alpha Systems.

If the NEW keyword is present, the directive must apply to a DO loop.

The NEW keyword modifies the meaning of the INDEPENDENT directive by restricting the variables considered for inclusion in the read and write sets. It asserts that the remainder of program execution is unaffected if all variables in the variable list (and any variables associated with them) become undefined immediately before execution of every iteration of the loop, and immediately after the completion of each iteration of the loop.

If used correctly, the INDEPENDENT directive does not change the meaning of a program. The directive provides new information to the compiler; it does not define a new meaning for the code.

For More Information:


Previous Page Next Page Table of Contents