There are some considerations about what HPF features may be used in writing a local, per-processor procedure.
Local program units can use all HPF constructs except for REDISTRIBUTE and REALIGN. Moreover, DISTRIBUTE, ALIGN, and INHERIT directives may be applied only to dummy arguments; that is, every alignee and distributee must be a dummy argument, and every align-target must be a template or a dummy argument. Mapping directives in local HPF program units are understood to have global meaning, as if they had appeared in global HPF code, applying to the global array of which a portion is passed on each processor. (The principal use of such mapping directives is in an HPF_LOCAL module that is used by a global HPF module.)
HPF_ALIGNMENT, HPF_TEMPLATE, and HPF_DISTRIBUTION, the distribution query library subroutines, may be applied to non-sequential local arrays. Their outcome is the same as for a global array that happens to have all its elements on a single node.
As introduced in Section 6.3.1, a local HPF program unit may not access global HPF data other than data that is accessible, either directly or indirectly, via the actual arguments. In particular, a local HPF program unit does not have access to global HPF COMMON blocks; COMMON blocks appearing in local HPF program units are not identified with global HPF COMMON blocks. The same name may not be used to identify a COMMON block both within a local HPF program unit and an HPF program unit in the same executable program.
Like local variables in local subprograms, COMMON blocks in local subprograms contain local data, held in local storage on each processor. This storage is only accessible locally, and it will in general contain data that is different on each processor. Indeed, the size of a local COMMON block can be different on each processor.
According to the Fortran specification, a COMMON block that goes out of scope is not preserved, unless it has the SAVE attribute. This is true of local COMMON blocks, which should be given the SAVE attribute if they are intended to convey information between calls to the local subprogram.
Scalars of an explicitly mapped derived type cannot be passed to an HPF_LOCAL subprogram.
The attributes (type, kind, rank, optional, intent) of the dummy arguments must match the attributes of the corresponding dummy arguments in the explicit interface. A dummy argument of an EXTRINSIC("0DHPF"0D,"0DLOCAL"0D) routine may not be a procedure name.
A dummy argument of an EXTRINSIC("0DHPF"0D,"0DLOCAL"0D) routine may not have the POINTER attribute.
A nonsequential dummy array argument of an EXTRINSIC("0DHPF"0D,"0DLOCAL"0D) routine must have assumed shape. Note that, in general, the shape of a dummy array argument differs from the shape of the corresponding actual argument, unless there is a single executing processor.
Explicit mapping directives for dummy arguments may appear in a local procedure. Such directives are understood as applying to the global array whose local sections are passed as actual arguments or results on each processor. If such directives appear, corresponding mapping directives must be visible to every global HPF caller. This may be done by providing an interface block in the caller, or by placing the local procedure in a module of extrinsic kind HPF_LOCAL that is then used by the global HPF program unit that calls the local procedure.
An EXTRINSIC("0DHPF"0D,"0DLOCAL"0D) routine may not be invoked, either directly or indirectly, in the body of a FORALL construct or in the body of an INDEPENDENT loop.
A local procedure may have several ENTRY points. A global HPF caller must contain a separate extrinsic interface for each entry point that can be invoked from the HPF program.