next up previous contents
Next: Descriptive ALIGN Directives Up: The INHERIT Directive Previous: The INHERIT Directive

Examples

Here is a straightforward example of the use of INHERIT:

      REAL DOUGH(100)
!HPF$ DISTRIBUTE DOUGH(BLOCK(10))
      CALL PROBATE( DOUGH(7:23:2) )
      ...
      SUBROUTINE PROBATE(BREAD)
      REAL BREAD(9)
!HPF$ INHERIT BREAD

The inherited template of BREAD has shape [100]; element BREAD(I) is aligned with element 5 + 2*I of the inherited template, and that template has a BLOCK(10) distribution.

More complicated examples can easily be constructed. It is important to bear in mind that the rank of the inherited template may be different from the rank of the dummy, and it might even be different from the rank of the actual. For instance, one might have a program containing the following:

      REAL A(100,100)
!HPF$ TEMPLATE T(100,100,100)
!HPF$ DISTRIBUTE T(BLOCK,CYCLIC,*)
!HPF$ ALIGN A(I,J) with T(J,3,I)
      CALL SUBR(A(:,7))
      ...
      SUBROUTINE SUBR(D)
      REAL D(100)
!HPF$ INHERIT D

In this case, the dummy D has rank 1. It corresponds to a 1-dimensional section of a 2-dimensional actual A, which in turn is aligned with a 2-dimensional section of a 3-dimensional template T. The template of D is a copy of this three-dimensional template. D is aligned with the section (7, 3, :) of this inherited template. Thus, the ``visible'' dimension of the dummy D is distributed *, although if the call statement had been

      CALL SUBR(A(7,:))

for instance, the ``visible'' dimension of the dummy would be distributed BLOCK.