[ HPF Home | Versions | Compilers | Projects | Publications | Applications | Benchmarks | Events | Contact ] |
A template is simply an abstract space of indexed positions; it can be considered as an ``array of nothings'' (as compared to an ``array of integers,'' say). A template may be used as an abstract align-target that may then be distributed. XBNF template-directive -to -rule to to is TEMPLATE template-decl-list
template-decl -to -rule to to is template-name [ ( explicit-shape-spec-list ) ]
template-name -to -rule to to is object-name XBNF Examples: !HPF$ TEMPLATE B(N,N), C(N,2*N) !HPF$ TEMPLATE, DISTRIBUTE(BLOCK,*) :: & !HPF$ TEMPLATE, DIMENSION(91,91) :: BORED,WHEEZY,PERKY Templates are useful in the particular situation where one must align several arrays relative to one another but there is no need to declare a single array that spans the entire index space of interest. For example, one might want four arrays aligned to the four corners of a template of size : !HPF$ ALIGN NW(I,J) WITH EARTH( I , J ) !HPF$ ALIGN SW(I,J) WITH EARTH(I+1, J ) !HPF$ ALIGN SE(I,J) WITH EARTH(I+1,J+1) Templates may also be useful in making assertions about the mapping of dummy arguments (see Section ).
Templates are not passed through the subprogram argument interface. The template to which a dummy argument is aligned is always distinct from the template to which the actual argument is aligned, though it may be a copy (see Section ). On exit from a subprogram, an HPF implementation arranges that the actual argument is aligned with the same template with which it was aligned before the call.
Variables in COMMON or having the SAVE attribute may be mapped to a locally declared template, but because the first condition cannot hold for such variable (they don't become undefined), the second condition must be observed.
©2000-2006 Rice University | [ Contact Us | HiPerSoft | Computer Science ] |