Replication is also useful for specific reference patterns. A good example would be if the same section of an array is used in a calculation on every processor. We can align elements with one or more dimensions:
!HPF$ ALIGN Y(:) WITH X(*,:)
The general rule is: if a * appears in the align-subscript-list (the parenthesised list on the RHS of the WITH clause associated with the align-target) then the corresponding dimension is collapsed. In the quoted example, the * is in the first dimension meaning that Y is replicated along every row of X. (I like to think of it as aligning all dimensions that contain a colon; the * dimensions are left over so it is in this dimension that the alignee is replicated.)
A copy of the first element of Y is aligned with the first element in every row of X, a copy of the second element of Y is aligned with the second element of every row of X, and so on. The compiler make sure that all the copies have the same value. See Figure 47.
Figure 47: Visualisation of Replicating Dimensions
Every processor which receives any element of X(:,i) will also receive a copy of Y(i).
There must be the same number of non-* dimensions on either side of the WITH clause.
Return to corresponding overview page