next up previous contents index
Next: H. Data Mapping and Up: ADAPTOR HPF Language Reference Previous: F. Layout of Data   Contents   Index

Subsections


G. Underspecified Mappings

A full specified mapping is given if the mapping is exactly fixed by the mapping directives. This implies that there is not any choice for the compiler about the actual mapping.

An underspecified mapping is given if the mapping directives are not complete. For local arrays with underspecfied mappings the compiler might choose the final mapping that is a sepcialization of the underspecified mapping (see Section 7.4). For dummy arrays the compiler will generate code that can deal with all mappings of the actuals that are specializations of the underspecified mapping. If the actual mapping is not compatible with the dummy mapping, the data will be redistributed.

G..1 Underspecified Mappings

A full specified mapping is given if the mapping is exactly fixed by the mapping directives. This implies that there is not any choice for the compiler about the actual mapping.

An underspecified mapping is given if the mapping directives are not complete. For local arrays with underspecfied mappings the compiler might choose the final mapping that is a sepcialization of the underspecified mapping (see Section 7.4). For dummy arrays the compiler will generate code that can deal with all mappings of the actuals that are specializations of the underspecified mapping. If the actual mapping is not compatible with the dummy mapping, the data will be redistributed.

An underspecified mapping is given in the following situations:

An alignment to a target that has an underspecified distribution implies an underspecified mapping for the alignee. But it has to be observed that a specialization of the distribution of the target will result in a specialization for the mapping of the alignee.

G..2 Arbitrary Mappings and the Range Directive

If the INHERIT attribute is specified for a variable, it can have any mapping. A variable with the INHERIT attribute must not appear as an alignee in an ALIGN and not as a distributee in a DISTRIBUTE directive.

The RANGE directive is used to restrict the possible mapping formats of the actual argument.

!hpf$ inherit X
!hpf$ range X (block(),block()) (*,gen_block())

The object in the RANGE directive must have the INHERIT attribute or the DYNAMIC attribute.

G..3 Direct Alignments

An alignment of an array to its target is called direct if the following conditions hold:

Attention: The last condition implies that there is no stride. But there might be an offset.

      real A(N,N), B(0:N-1,0:N-1,0:N-1)
!hpf$ template T(N,N,N)
!hpf$ align A(I,J) with T(I,J,*)  ! not direct as there is a replication
!hpf$ align A(I,J) with T(2,I,J)  ! not direct as there is an embedding
!hpf$ align B(I,J,K) with T(I+1,J+1,K+1)  ! direct
!hpf$ align B(I,J,K) with T(J+1,I+1,K+1)  ! not direct as permutation

A direct alignment implies that the alignment can be replaced by a corresponding distribution if the align_target has a distribution.


G..4 Specialization of Underspecified Mappings

G..4.1 Specialization of Distribution Formats

First we define a notion of specialization for dist-format.

  1. Each dist-format is a specialization of itself. The following equivalences are given:


    \begin{displaymath}\begin{array}{rclcl}
\texttt{BLOCK}(n) &\equiv& \texttt{BLOC...
...
\texttt{CYCLIC} &\equiv& \texttt{CYCLIC}(1) \\
\end{array}\end{displaymath}

  2. BLOCK is a specialization of BLOCK(), GEN_BLOCK and CYCLIC().

  3. BLOCK() is a specialization of CYLCIC().

  4. CYCLIC(m) is a specialization of CYCLIC().

  5. GEN_BLOCK(int_array) is a specialization of GEN_BLOCK.

  6. INDIRECT(int_array) is a specialization of INDIRECT.

  7. * is a specialization of every dist-format.

  8. Every dist-format is a specialization of ALL.

G..4.2 Specialization via Distributed Objects

Let S and G be two named objects that are both distributed by a DISTRIBUTE directive.

The distribution of S is a specialization of the distribution of G if the following constraints hold:

  1. The shapes of S and G are the same.
  2. The distribution directive of G must have a dist-onto-clause of ``ONTO *'', or it must have a dist-onto-clause specifying the same processor arrangement as that specified in the distribution directive for S.
  3. Each dist-format must be a specialization (in the sense defined above) to the dist-format in the corresponding position of the dist-format-clause in the distribution directive of S.
  4. If the onto-clause of the distribution of G specifies a processor arrangement, then '*' can only be a specialization of '*'.

Note: The last condition guarantees that corresponding dimensions of S and G are mapped to the same dimension of the processor array if they are distributed.

      real, dimension (N,N) :: S1, S2, S3
      real, dimension (N,N) :: G1, G2, G3

!hpf$ distribute S1 (block(10), block) onto P
!hpf$ distribute S2 (block, block) onto Q
!hpf$ distribute S3 (block, CYLCIC) onto Q

!hpf$ distribute G1 (block(),block()) onto P
!hpf$ distribute G2 (block(),block()) onto *
!hpf$ distribute G3 (CYCLIC(),CYCLIC()) onto *

For this example, the following relations hold:

      real, dimension (N,N) :: S1, S2, S3, S4
      real, dimension (N,N) :: G1, G2, G3

!hpf$ distribute S1 (block, *) onto P
!hpf$ distribute S2 (*, block) onto P
!hpf$ distribute S3 (block, *) onto Q
!hpf$ distribute S4 (*,*)

!hpf$ distribute G1 * onto P
!hpf$ distribute G2 (block(),block()) onto Q
!hpf$ distribute G3 (block(),block()) onto *

For this example, the following relations hold:

G..4.3 Specialization via Aligned Objects

Let S and G be two named objects where G is distributed by a DISTRIBUTE directive and S by a ALIGN directive.

The mapping of S is a specialization of the mapping of G if all of the following relations hold:

  1. The shapes of S and G are the same.
  2. If the distribution directive of G has a dist-onto-clause that specifies a processor arrangement, then the ultimate target of S must also be distributed onto this processor arrangement.
  3. Each dimension of S is either collapsed or aligned to a certain dimension of its ultimate target. In the last case the dimension of the target must have a dist-format that is a specialization of the dist-format in the corresponding position of the dist-format-clause in the distribution directive of S.
  4. If the dist-format of G is not underspecified, then the corresponding dimension of S must be directly aligned (same size as the align target).
  5. If the onto-clause of the distribution of G specifies a processor arrangement, then '*' can only be a specialization of '*'.
  6. If the onto-clause of the distribution of G specifies a processor arrangement, then the corresponding dimensions of G and S must map to the same dimension of the processor arrangement.

The above definition is very general. It says that the mapping of an aligned array can also be a specialization if it contains permutations, linear embeddings, embedded dimensions or replicated dimensions. It must only be guaranteed that the dimension to which the dimension of the alignee is aligned to must be distributed in a certain way.

!hpf$ template, dimension (N2,N2) :: T
!hpf$ distribute (block, block) onto P
      real, dimension (N,N) :: A1, A2, A3
!hpf$ ALIGN A1(I,J) with T(I,J)
!hpf$ ALIGN A2(J,I) with T(J,I)
!hpf$ ALIGN A3(I,J) with T(2*I,2*J)

      real, dimension (N,N) :: G
!hpf$ distribute G (block(),block()) onto P

G..4.4 Aligmments to Underspecified Distributions

If an array is aligned to a target that has an underspecified distribution, its mapping is in a certain sense also underspecified. Nevertheless, it makes no sense to define a specialization of the aligned array without considering the target. As soon as the distribution of the target has been specialized, it implies a specialization of the alignee.

      REAL G1(N,N), G2(N,N)

!hpf$ distribute G1(block(),block()) onto *
!hpf$ align G2(I,J) with G1(I,J)

In this example, the object G2 is aligned with the object G1. As the distribution of G1 is underspecified, the distribution of G2 is also underspecified. In case of local arrays, the compiler will choose a full specified mapping for G1 and G2. As soon as the mapping of G1 is fixed, it implies a mapping of G2.

      real, dimension (N,N) :: S1, S2, S3
      real, dimension (N,N) :: G1, G2

!hpf$ distribute S1(block, block) onto P
!hpf$ align S2(I,J) with S1(I,J)
!hpf$ distribute S3(block,block) onto Q

!hpf$ distribute G1(block(),block()) onto *
!hpf$ align G2(I,J) with G1(I,J)

Attention: The HPF 2.0 standard says that S3 is a specialization of G1 and S1 is also a specialization of G2. But S1 is obviously not aligned to S3.


next up previous contents index
Next: H. Data Mapping and Up: ADAPTOR HPF Language Reference Previous: F. Layout of Data   Contents   Index
Thomas Brandes 2004-03-18