There are two flavors of the ON directive: a single-statement form and a multi-statement form. The syntax for these directives is
H902 on-directive is ON on-stuff H903 on-stuff is home [ , resident-clause ] [ , new-clause ] H904 on-construct is
H905 block-on-directive is ON on-stuff BEGIN
H906 end-on-directive is END ON
H907 home is HOME ( variable )
or HOME ( template-elmt )
or ( processors-elmt )
H908 template-elmt is template-name [ ( section-subscript-list ) ]
H909 processors-elmt is processors-name [ ( section-subscript-list ) ]
The nonterminal resident-clause will be defined in Section 9.3. For the present, it suffices to say that this is a form of the RESIDENT directive mentioned in the introduction.
The home is often called the HOME clause, even in cases where the keyword HOME is not used. Note that variable is a Fortran syntax term that means (roughly) ``a reference, including an array element, array section, or derived type field''; variable does not include template or processor elements because they are defined only in directives. Note also that block is a Fortran syntax term for ``a series of statements treated as a group''--for example, the body of a DO construct.
The on-directive is a kind of executable-directive (see rule H205). This means that an on-directive can appear wherever an executable statement can.
An on-construct is a Fortran executable-construct. This syntax implies that such constructs can be nested, and if so they will be properly nested.
INTEGER X(4) ! X(I) will be on processor I !HPF$ PROCESSORS HOME(4) !HPF$ DISTRIBUTE X(BLOCK) X = (/ 4,3,2,1 /) !HPF$ ON(HOME(X(2)) X(2) = X(1)
If the parentheses were not required, where should the computation be done?
The definition of ONclearly indicates that interpretation 1 is correct. One can get the effect of interpretation 2 by the directive
There is no way to get the effect of interpretation 3. Introducing reserved keywords into Fortran was suggested as a better solution to this problem, but was seen as too large a change to the underlying language. (End of rationale.)