permutation
- Date:
01-09-2012
NAME
permutation - specifies that an integer array has no repeated values
SYNOPSIS
#pragma _CRI permutation symbol[, symbol ] ...
!DIR$ PERMUTATION (ia [, ia ] ...)
IMPLEMENTATION
Cray Linux Environment (CLE)
DESCRIPTION
The permutation directive specifies that an integer array has no repeated values. This directive is useful when the integer array is used as a subscript for another array (vector-valued subscript). This directive may improve code performance.
In a sequence of array accesses that read array element values from the specified symbols with no intervening accesses that modify the array element values, each of the accessed elements will have a distinct value.
When an array with a vector-valued subscript appears on the left side of the equal sign in a loop, many-to-one assignment is possible. Many-to-one assignment occurs if any repeated elements exist in the subscripting array. If it is known that the integer array is used merely to permute the elements of the subscripted array, it can often be determined that many-to-one assignment does not exist with that array reference.
Sometimes a vector-valued subscript is used as a means of indirect addressing because the elements of interest in an array are sparsely distributed; in this case, an integer array is used to select only the desired elements, and no repeated elements exist in the integer array (see example 1).
EXAMPLES
Example 1: permutation directive
Sometimes a vector-valued subscript is used as a means of indirect addressing because the elements of interest in an array are sparsely distributed; in this case, an integer array is used to select only the desired elements, and no repeated elements exist in the integer array, as in the following example:
int *ipnt;
#pragma permutation ipnt
...
for ( i = 0; i < N; i++ ) {
a[ipnt[i]] = b[i] + c[i];
}
The permutation directive does not apply to the array a. Rather, it applies to the pointer used to index into it, ipnt. By knowing that ipnt is a permutation, the compiler can safely generate an unordered scatter for the write to a.
SEE ALSO
intro_directives(1)