next up previous contents
Next: Examples Up: Alignment Previous: The Template of the

The INHERIT Directive

 

The INHERIT directive specifies that a dummy argument should be aligned to a copy of the template of the corresponding actual argument in the same way that the actual argument is aligned.

The INHERIT directive causes the named subprogram dummy arguments to have the INHERIT attribute. Only dummy arguments may have the INHERIT attribute. An object must not have both the INHERIT attribute and the ALIGN attribute. An object must not have both the INHERIT attribute and the DISTRIBUTE attribute. The INHERIT directive may appear only in a specification-part of a scoping unit.

The INHERIT attribute specifies that the template for a dummy argument should be inherited, by making a copy of the template of the actual argument. Moreover, no other explicit mapping directive may appear for an argument with the INHERIT attribute: the INHERIT attribute implies a distribution of DISTRIBUTE * ONTO * for the inherited template. Thus, the net effect is to tell the compiler to leave the data exactly where it is, and not attempt to remap the actual argument. The dummy argument will be mapped in exactly the same manner as the actual argument; the subprogram must be compiled in such a way as to work correctly no matter how the actual argument may be mapped onto abstract processors.

Note that if A is an array dummy argument, the directive

!HPF$ INHERIT A

is more general than

!HPF DISTRIBUTE A * ONTO *

for the following reason: The INHERIT directive states that the (inherited) template with which A is aligned is distributed * ONTO *, but that A may be aligned in some non-trivial manner with that template. On the other hand, the DISTRIBUTE directive states that A is aligned trivially with its natural template, which in turn is distributed * ONTO *.

For example, the following code  is not permitted:

!HPF$ PROCESSORS P(2)
      REAL, DIMENSION(100) :: A
!HPF$ DISTRIBUTE (BLOCK) ONTO P :: A

CALL FOO(A(1:50))

...

SUBROUTINE FOO(D) REAL, DIMENSION(50) :: D !HPF$ DISTRIBUTE D * !Nonconforming

The transcriptive distribution for D is nonconforming because the natural template for D is not distributed BLOCK. On the other hand, it would be correct to replace the illegal directive by

!HPF$ INHERIT D




nextuppreviouscontents
Next:ExamplesUp:Alignment Previous:The Template of the
H401 inherit-directiveis INHERIT inheritee-list
H402 inheriteeis object-name