next up previous contents
Next: Further Examples of Template Up: Combined Directive Previous: Combined Directive

 

Another Template Example

Consider,

    PROGRAM Warty
     IMPLICIT NONE
     REAL, DIMENSION(4) :: C
     REAL, DIMENSION(8) :: D
     REAL, DIMENSION(2) :: E
!HPF$ TEMPLATE, DIMENSION(8) :: T
!HPF$ ALIGN D(:) WITH T(:)
!HPF$ ALIGN C(:) WITH T(::2)
!HPF$ ALIGN E(:) WITH T(::4)
!HPF$ DISTRIBUTE (BLOCK) :: T
      C = 1; D = 2
      E = D(::4) + C(::2)
    END PROGRAM Warty

This is very similar to an earlier example which demonstrated stride array alignment. This time, however, all the arrays are aligned to a template which is then distributed. As expected, the template must be the same size as or larger in each dimension than anything that is aligned to it.

Return to corresponding overview page gif

 

   figure16250
Figure 50: Visualisation of Strided Template Alignment

Figure 50 shows how each array is aligned with the template. At the bottom there is an exploded view of how each individual array relates to the template. The element from each array denoted by the shaded blob can all be seen to be aligned with T(5).

Return to corresponding overview page gif


next up previous contents
Next: Further Examples of Template Up: Combined Directive Previous: Combined Directive

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.