The ALIGN HPF Directive

The ALIGN HPF Directive


Definition Back to Top

ALIGN is an HPF directive. It is used to specify that certain data objects are to be mapped in the same way as certain other data objects, so that data that are used together will be located on the same processor, avoiding unnecessary communication.

Syntax of the ALIGN Directive:

  !HPF$ ALIGN array WITH target

* is used to indicate a row or column of one array mapping to a single element of another array. This can be accomplished as collapsing or replicating.

:: is used to combine attributes such as ALIGN and DISTRIBUTE in one directive, as in

attribute list :: target

General Examples Back to Top

Example 1: Direct Alignment
!HPF$ ALIGN A WITH B
  or
!HPF$ ALIGN A(:,:) WITH B(:,:)


Example 2: Array alignment
!HPF$ ALIGN B(I,J) WITH A(I+1,J+1)


Example 3: Transposing two axes
!HPF$ ALIGN X(J,K) WITH D2(K,J)


Example 4: Whichever processor "owns" D1(J) should also "own" row j of X
!HPF$ ALIGN X(J,K) WITH D1(J)
  or
!HPF$ ALIGN X(:,*) WITH D1(:)


Example 5: Replicated representation along second axis of D3
!HPF$ ALIGN X(J,K) WITH D3(J,*,K)


Tariff Program Examples Back to Top

ALIGN is used twice in the Tariff Program:

!HPF$ ALIGN (:) WITH apatho(*,:) :: demand,demp
Move the program display to this line

!HPF$ ALIGN (i,j) WITH apatho(i,j) :: apathn
Move the program display to this line

dhxlin, thxlin, tar, dslope, and ind2 are not aligned or distributed, but instead are read in to each processor. This was done to resolve a bottleneck caused when all data were read in through node 0 and then redistributed. It is a good solution in this case, because there is enough space on each SP2 node to hold all of the input arrays, and the arrays are never updated. In this case, the data will be available on any node that requires it, and will not cause communication problems.

Note that any array aligned with apatho, which is distributed, will be distributed in the same way.


Exercise (short) Back to Top

Specify an ALIGN directive which will align the shaded areas of arrays A(2,5) and B(6,2).

Solution


Back to Top