The PROCESSORS directive declares one or more rectilinear processor arrangements, specifying for each one its name, its rank (number of dimensions), and the extent in each dimension. It may appear only in the specification-part of a scoping unit. Every dimension of a processor arrangement must have nonzero extent; therefore a processor arrangement cannot be empty.
In the language of F95:14.1.2 in the Fortran standard, processor arrangements are local entities of class (1); therefore a processor arrangement may not have the same name as a variable, named constant, internal procedure, etc., in the same scoping unit. Names of processor arrangements obey the same rules for host and use association as other names in the long list in F95:220.127.116.11.1 in the Fortran standard.
A processor arrangement declared in a module has the default accessibility of the module.
If two processor arrangements have the same shape, then corresponding elements of the two arrangements are understood to refer to the same abstract processor. (It is anticipated that implementation-dependent directives provided by some HPF implementations could overrule the default correspondence of processor arrangements that have the same shape.)
If directives collectively specify that two objects be mapped to the same abstract processor at a given instant during the program execution, the intent is that the two objects be mapped to the same physical processor at that instant.
The intrinsic functions NUMBER_OF_PROCESSORS and PROCESSORS_SHAPE may be used to inquire about the total number of actual physical processors used to execute the program. This information may then be used to calculate appropriate sizes for the declared abstract processor arrangements.
H329 processors-directive is PROCESSORS processors-decl-list H330 processors-decl is processors-name [ ( explicit-shape-spec-list ) ]
!HPF$ PROCESSORS P(N) !HPF$ PROCESSORS Q(NUMBER_OF_PROCESSORS()), & !HPF$ R(8, NUMBER_OF_PROCESSORS()/8) !HPF$ PROCESSORS BIZARRO(1972:1997,-20:17) !HPF$ PROCESSORS SCALARPROC
If no shape is specified, then the declared processor arrangement is conceptually scalar.
Rationale. A scalar processor arrangement may be useful as a way of indicating that certain scalar data should be kept together but need not interact strongly with distributed data. Depending on the implementation architecture, data distributed onto such a processor arrangement may reside in a single "control" or "host" processor (if the machine has one), or may reside in an arbitrarily chosen processor, or may be replicated over all processors. For target architectures that have a set of computational processors and a separate scalar host computer, a natural implementation is to map every scalar processor arrangement ono the host processor. For target architectures every scalar processor arrangement onto the host processor. For target architectures that have a set of computational processors but no separate scalar "host" computer, data mapped to a scalar processor arrangement might be mapped to some arbitrarily chosen computational processor or replicated onto all computational processors. (End of Rational.)
An HPF compiler is required to accept any PROCESSORS declaration in which the product o the extents of each declared processor arrangement is equal to the number of physical processors that would be returned by the call NUMBER_OF PROCESSORS (). It must also accept all declarations of scalar PROCESSOR arrangements. Other cases may be handled as well, dependign on the implementation.
For compatibility with the Fortran attribute syntax, an optional "::" may be inserted. The shape may also be specified with the DIMENSION attribute:
As in Fortran, an explicit-shape-spec-list in a processors-decl will override an explicit DIMENSION attribute:!HPF$ PROCESSORS :: RUBIK(3,3,3) !HPF$ PROCESSORS, DIMENSION(3,3,3) :: RUBIK
Here RUBIKS_REVENGE is 4 x 4 x 4 while RUBIK and SOMA are each 3 x 3 x 3. (By the rules enunciated above, however, such a statement may not be completely prtable because no HPF language processor is required to handle shapes of total sizes 27 and 64 simultaneously.)!HPF$ PROCESSORS, DIMENSION(3,3,3) :: & !HPF$ RUBIK, RUBIKS_REVENGE(4,4,4), SOMA
Returning from a subprogram causes all processor arrangements declared local to that subprogram to become undefined. It is not HPF-conforming for any array or template to be distributed onto a processor arrangement at the time the processor arrangement becomes undefined unless at least one of two conditions holds:
Rationale. Note that this second condition is slightly less stringent than requiring all expressions to be constant. This allows calls to NUMBER_OF_PROCESSORS or PROCESSORS_SHAPE to appear without violating the condition. (End of rationale.)
Variables in COMMON or having the SAVE attribute may be mapped to a locally declared processor arrangement, but because the first condition cannot hold for such variables (they don't become undefined), the second condition must be observed. This allows COMMON variables to work properly through the customary strategy of putting identical declarations in each scoping unit that needs to depend on the value returned by NUMBER_OF_PROCESSORS. (See section3.8 for further information on mapping common variables.)
Advice to implementors. It may be desirable to have a way for the user to specify at compile time the number of physical processors on which the program is to be executed. This might be specified either by an implementation-dependent directive, for example, or through the programming environment (for example, as a UNIX command-line argument). Such facilities are beyond the scope of the HPF specification, but as food for thought we offer the following illustrative hypothetical examples:!Declaration for multiprocessor by ABC Corporation !ABC$ PHYSICAL PROCESSORS(8) !Declaration for mpp by XYZ Incorporated !XYZ$ PHYSICAL PROCESSORS(65536) !Declaration for hypercube machine by PDQ Limited !PDQ$ PHYSICAL PROCESSORS(2,2,2,2,2,2,2,2,2,2) !Declaration for two-dimensional grid machine by TLA GmbH !TLA$ PHYSICAL PROCESSORS(128,64) !One of the preceding might affect the following: !HPF$ PROCESSORS P(NUMBER_OF_PROCESSORS())
It may furthermore be desirable to have a way for the user to specify the precise mapping of the processor arrangement declared in a PROCESSORS statement to the physical processors of the executing hardware. Again, this might be specified either by a implementation-dependent directive or through the programming environment (for example, as a UNIX command-line argument); such facilities are beyond the scope of the HPF specification, but as food for thought we offer the following illustrative hypothetical example:!PDQ$ PHYSICAL PROCESSORS(2,2,2,2,2,2,2,2,2,2,2,2,2) !HPF$ PROCESSORS G(8,64,16) !PDQ$ MACHINE LAYOUT G(:GRAY(0:2),:GRAY(6:11),:BINARY(3:5,12))
This might specify that the first dimension of G should use hypercube axes 0, 1, 2 with a Gray-code ordering; the second dimension should use hypercube axes 6 through 11 with a Gray-code ordering; and the third dimension should use hypercube axes 3, 4, 5, and 12 with a binary ordering. (End of advice to implementors.)