In a multi-processor implementation, the processors may be arranged in an implementation-dependent multi-dimensional processor array. The system inquiry functions return values related to this underlying machine and processor configuration, including the size and shape of the underlying processor array. NUMBER_OF_PROCESSORS returns the total number of processors available to the program or the number of processors available to the program along a specified dimension of the processor array. PROCESSORS_SHAPE returns the shape of the processor array.
The Fortran definition of restricted expression is extended to permit references to the HPF system inquiry intrinsic functions. In particular, at the end of the numbered list in Section 184.108.40.206 of the Fortran standard, add:
(13) A reference to one of the system inquiry functions NUMBER_OF_PROCESSORS or PROCESSORS_SHAPE, where any argument is a restricted expression.
A variable that appears in a restricted expression in an HPF directive in the scoping unit of a module or main program must be an implied-DO variable or an argument in a reference to an array inquiry function, bit inquiry function, character inquiry function, kind inquiry function, or numeric inquiry function.
The values returned by the system inquiry intrinsic functions remain constant for the duration of one program execution. Thus, NUMBER_OF_PROCESSORS and PROCESSORS_SHAPE have values that are restricted expressions and may be used wherever any other Fortran restricted expression may be used. In particular, NUMBER_OF_PROCESSORS may be used in a specification expression.
The values of system inquiry functions may not occur in initialization expressions, because they may not be assumed to be constants. In particular, HPF programs may be compiled to run on machines whose configurations are not known at compile time.
Note that the system inquiry functions query the physical machine, and have nothing to do with any PROCESSORS directive that may occur. If an HPF program is running on a physical partition of a larger machine, then it is the smaller partition that actually executes the HPF program whose parameters are returned by the system inquiry functions.
Some machines may not have a ``natural'' shape to return as the value of the function PROCESSORS_SHAPE, for example, a machine with a tree topology. In these cases, the implementation must provide some reasonable, consistent description of the machine, such as an rank-one array of size NUMBER_OF_PROCESSORS(). The compiler will also have to arrange to map between this description and the underlying hardware processor identification mechanism.
INTEGER, DIMENSION(SIZE(PROCESSORS_SHAPE())) :: PSHAPE !HPF$ TEMPLATE T(100, 3*NUMBER_OF_PROCESSORS())
(End of advice to users.)