Next:
HPF Local Routine Up: Local Routines Written Previous: Restrictions

## Argument Association

If a dummy argument of an EXTRINSIC(HPF_LOCAL) routine is an array, then the corresponding dummy argument in the specification of the local procedure must be an array of the same rank, type, and type parameters. When the extrinsic procedure is invoked, the local dummy argument is associated with the local array that consists of the subgrid of the global array that is stored locally. This local array will be a valid HPF array.

If a dummy argument of an EXTRINSIC(HPF_LOCAL) routine is a scalar then the corresponding dummy argument of the local procedure must be a scalar of the same type. When the extrinsic procedure is invoked then the local procedure is passed an argument that consists of the local copy of the replicated scalar. This copy will be a valid HPF scalar.

If an EXTRINSIC(HPF_LOCAL) routine is a function, then the local procedure is a function that returns a scalar of the same type and type parameters, or an array of the same rank, type, and type parameters, as the HPF extrinsic function. The value returned by each local invocation is the local part of the value returned by the HPF invocation.

Each physical processor has at most one copy of each HPF variable.

Consider the following extrinsic interface: INTERFACE EXTRINSIC(HPF_LOCAL) FUNCTION MATZOH(X, Y) RESULT(Z) REAL, DIMENSION(:,:) :: X REAL, DIMENSION(SIZE(X,1)) :: Y, Z !HPF\$ DISTRIBUTE X(BLOCK, CYCLIC) END FUNCTION END INTERFACE The corresponding local HPF procedure is specified as follows.

EXTRINSIC(HPF_LOCAL) FUNCTION MATZOH(XX, YY) RESULT(ZZ) REAL, DIMENSION(:,:) :: XX REAL, DIMENSION(5 : SIZE(XX,1)+4) :: YY, ZZ NX1 = SIZE(XX, 1) LX1 = LBOUND(XX, 1) UX1 = UBOUND(XX, 1) NX2 = SIZE(XX, 2) LX2 = LBOUND(XX, 2) UX2 = UBOUND(XX, 2) NY = SIZE(YY, 1) LY = LBOUND(YY, 1) UY = UBOUND(YY, 1) ... END FUNCTION Assume that the function is invoked with an actual (global) array X of shape and an actual vector Y of length on a 4-processor machine, using a processor arrangement (assuming one abstract processor per physical processor).

Then each local invocation of the function MATZOH receives the following actual arguments:

Here are the values to which each processor would set NX1, LX1, UX1, NX2, LX2, UX2, NY, LY, and UY:

The return array ZZ is distributed identically to YY: Processors (1,1) and (1,2) should return identical rank one arrays of size 2; processors (2,1) and (2,2) should return identical rank one arrays of size 1.

An actual argument to an extrinsic procedure may be a pointer. Since the corresponding dummy argument may not have the POINTER attribute, the dummy argument becomes associated with the target of the HPF global pointer. In no way may a local pointer become pointer associated with a global HPF target. Therefore, an actual argument may not be of a derived-type containing a pointer component.

• []Rationale. It is expected that global pointer variables will have a different representation from that of local pointer variables, at least on distributed memory machines, because of the need to carry additional information for global addressing. This restriction could be lifted in the future. (End of rationale.)

Other inquiry intrinsics, such as ALLOCATED or PRESENT, should also behave as expected. Note that when a global array is passed to a local routine, some processors may receive an empty subarray. Such argument is PRESENT and has SIZE zero.

Next:
HPF Local Routine Up: Local Routines Written Previous: Restrictions

paula@erc.msstate.edu
Thu Dec 8 16:17:11 CST 1994