next up previous contents
Next: Examples of ON Directives Up: The ON Directive Previous: Syntax of the ON

Semantics of the ON Directive

 

The ON directive restricts the active processor set for a computation to those processors named in its home. The computation controlled is either the following Fortran statement (for a on-directive or the contained block for a block-on-directive. We refer to the controlled computation as the ON-block.

That is, it advises the compiler to use the named processor(s) to perform the ON block. Like the mapping directives ALIGN and DISTRIBUTE, this is advice rather than an absolute commandment; the compiler may override an ON directive. Also like ALIGN and DISTRIBUTE, the ON directive may affect the efficiency of computation, but not the final results.

The single-statement ON directive sets the active processor set for the first non-comment statement that follows it. It is said to apply to that statement. If the statement is a compound statement (e.g., a DO loop or an IF-THEN-ELSE construct), then the ON directive also applies to all statements nested therein. Similarly, the ON construct applies the initial ON clause to--i.e., sets the active processor set for--all statements up to the matching END ON directive.

The evaluation of any function referred to in the home expression is not affected by the ON directive; these functions are called on all processors active when control reached the directive. Thus,

!HPF$ ON HOME( P(1: (ACTIVE_NUM_PROCS() - 1)) ) ...
is a reasonable way to idle on one active processor, and is not paradoxically self-referential.

The HOME clause can name a program object, a template, or a processors arrangement. For each of these possibilities, it can specify a single element or multiple elements. This is translated into the processor(s) executing the ON block as follows:


next up previous contents
Next: Examples of ON Directives Up: The ON Directive Previous: Syntax of the ON