This chapter describes intrinsic and library routines that have been approved as extensions to HPF Version 2.0.
The extended intrinsic procedures include a transpose function that generalizes the Fortran TRANSPOSE intrinsic function. Certain algorithms require access to multidimensional arrays along different axes. In modern machines, it will usually be best to make the array axis along which an inner loop runs the first axis, so that in local memory the elements will be contiguous. A generalized transpose is required to do this data rearrangement, which is not simply a data remapping. In many cases, the result of the transpose will be assigned to a variable whose first axis is distributed with a dist-format of (*).
For this sort of operation, FORALL is adequate when the rank and the particular set of axes to be exchanged are known; for example:
FORALL(I1 = 1:SIZE(ARRAY,1)) FORALL(I2 = 1:SIZE(ARRAY,2)) FORALL(I3 = 1:SIZE(ARRAY,3)) RESULT(I3,I1,I2) = ARRAY(I1,I2,I3) ENDFORALL ENDFORALL ENDFORALL
If, however, the relation between input and result axes is to be variable, FORALL is an inconvenient idiom. Thus we have generalized the TRANSPOSE intrinsic function, allowing as arguments an input array (which is to be transposed) of any nonzero rank, and an integer rank-one array (giving the axis permutation) whose size is the rank of the first input array.
The default value for the order argument makes this an extension of the existing Fortran one-argument TRANSPOSE function.
Two new intrinsic inquiry functions, ACTIVE_NUM_PROCS and ACTIVE_PROCS_SHAPE are useful for determining the size and the shape of the processor subset executing the program, as modified by ON constructs.
The extended library consists of mapping inquiry subroutines. Extended versions of HPF_ALIGNMENT and HPF_TEMPLATE allow an additional, optional, DYNAMIC output argument. This allows a program to determine whether an object, or its align ultimate target, has the DYNAMIC attribute. There is a new version of HPF_DISTRIBUTION, and two new mapping inquiry subroutines that are especially useful for determining mappings produced by the general block and indirect distribution forms.