[ HPF Home | Versions | Compilers | Projects | Publications | Applications | Benchmarks | Events | Contact ]



Next:
Examples of INDEPENDENT Up: Data Parallel Statements Previous: Comments on Pure

The INDEPENDENT Directive

The INDEPENDENT directive precedes the DO loop or FORALL for which it is asserting behavior, and is said to apply to that loop or FORALL. The syntax of the INDEPENDENT directive is XBNF independent-directive -to -rule to to is INDEPENDENT [ , new-clause ]

new-clause -to -rule to to is NEW ( variable-list ) XBNF

When applied to a DO loop, an INDEPENDENT directive is an assertion by the programmer that no iteration can affect any other iteration, either directly or indirectly. The following operations define such interference:

Any two operations that assign to the same atomic object (defined in Section ) interfere with each other. (Note the NEW clause below, however.)

An operation that assigns to an atomic object interferes with any operation that uses the value of that object. (Note the NEW clause below, however.)

Any transfer of control to a branch target statement outside the body of the loop interferes with all other operations in the loop.

Any execution of an EXIT, STOP, or PAUSE statement interferes with all other operations in the loop.

A READ operation assigns to the objects in its input-item-list; a WRITE or PRINT operation uses the values of the objects on its output-item-list. I/O operations may interfere with other operations (including other I/O operations) as per the conditions above.

An internal READ operation uses its internal file; an internal WRITE operation assigns to its internal file. These uses and assignments may interfere with other operations as outlined above.

Any two file I/O operations except INQUIRE associated with the same file or unit interfere with each other. Two INQUIRE operations do not interfere with each other; however, an INQUIRE operation interferes with any other I/O operation associated with the same file.

Any data realignment or redistribution performed in the loop interferes with any access to or any other realignment of the same data.

Note that all of these describe interfering behavior; they do not disallow specific syntax. Statements that appear to violate one or more of these restrictions are allowed in an INDEPENDENT loop, if they are not executed due to control flow. These restrictions allow an INDEPENDENT loop to be executed safely in parallel if computational resources are available. The directive is purely advisory and a compiler is free to ignore it if it cannot make use of the information.

The NEW option modifies the INDEPENDENT directive and all surrounding INDEPENDENT directives by asserting that those assertions would be true if new objects were created for the named variables for each iteration of the DO loop. Thus, variables named in the new-clause behave as if they were private to the body of the DO loop. More formally, it asserts that the remainder of program execution is unaffected if all variables in the variable-list and any variables associated with them were to become undefined immediately before execution of every iteration of the loop, and also become undefined immediately after the completion of each iteration of the loop.

The interpretation of INDEPENDENT for FORALL is similar to that for DO: it asserts that no combination of the indexes that INDEPENDENT applies assigns to an atomic storage unit that is read by another combination. (Note that an HPF FORALL statement or construct does not allow exits from the construct, etc.) A DO and a FORALL with the same body are equivalent if they both have the INDEPENDENT directive. This is illustrated in Section .




Next:
Examples of INDEPENDENT Up: Data Parallel Statements Previous: Comments on Pure



©2000-2006 Rice University [ Contact Us | HiPerSoft | Computer Science ]

paula@erc.msstate.edu
Thu Dec 8 16:17:11 CST 1994