15.3.9 TEMPLATE Directive (TU*X only)

The TEMPLATE directive declares one or more templates (an abstract space of indexed positions), specifying for each the name, the rank and the extent in each dimension.

The TEMPLATE directive takes the following form:

!HPF$ TEMPLATE object [(e-spec)] [, object [(e-spec)]]...

object
Is the name of the template object.


e-spec
Is an explicit-shape array specification.

Rules and Behavior

Templates are useful when you 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. Templates can also be useful in making assertions about the mapping of dummy arguments.

The TEMPLATE directive can appear only in the specification part of a scoping unit.

Templates cannot appear in COMMON blocks.

Templates are not passed through the subprogram argument interface.

Returning from a subprogram causes all templates declared local to that subprogram to become undefined.

A TEMPLATE directive can be combined with other directives as part of a combined directive.

Examples

The following are examples of the TEMPLATE directive:

 !HPF$ TEMPLATE A(N)
 !HPF$ TEMPLATE B(N,N), C(N,2*N)
 !HPF$ TEMPLATE D(100,100), S(24), G(17,3,5)

If an optional double colon (::) is used, declared templates can be distributed in the same combined directive. In this case, all templates declared by the directive must have the same rank. The shape can also be specified by using the DIMENSION attribute. For example:

 !HPF$ TEMPLATE, DISTRIBUTE(BLOCK,*) :: W1(64,64), M(128,128)
 !HPF$ TEMPLATE, DIMENSION(91,91) :: B2, W2, P

For More Information:


Previous Page Next Page Table of Contents