Next:
Requirements on the Up: Extrinsic Procedures Previous: Overview

Definition and Invocation of Extrinsic Procedures

The extrinsic-kind-keyword indicates the kind of extrinsic interface to be used. (It may be helpful to think of this name as being to the subprogram calling interface what a KIND parameter is for a numeric type. However, an extrinsic-kind is not integer-valued; it is merely a keyword.) HPF defines three such keywords: HPF$, HPF_LOCAL, and HPF_SERIAL. The keyword HPF_LOCAL is intended for use in calling routines coded in the ``local HPF'' style described in Annex . The keyword HPF$ refers to the interface normally used for calling ordinary HPF routines.

A subprogram with an extrinsic interface lies outside the scope of HPF. However, explicit interfaces to such subprograms must conform to HPF. Note that any particular HPF implementation is free to support any selection of extrinsic kind keywords, or none at all except for HPF$ itself. Examples:

INTERFACE EXTRINSIC(HPF_LOCAL) FUNCTION BAGEL(X) REAL X(:) REAL BAGEL(100) !HPF$ ALIGN WITH X :: Y, Z !HPF$ DISTRIBUTE (BLOCK, BLOCK) X END FUNCTION END INTERFACE INTERFACE KNISH

FUNCTION RKNISH(X) !normal HPF interface REAL X(:), RKNISH END RKNISH

EXTRINSIC(SISAL) FUNCTION CKNISH(X) !extrinsic interface COMPLEX X(:), CKNISH END CKNISH

END INTERFACE In the last interface block, two external procedures, one of them extrinsic and one not, are associated with the same generic procedure name, which returns a scalar of the same type as its array argument.

The intent is that a call to an extrinsic subprogram behaves, as observed by a calling program coded in HPF, exactly as if the subprogram has been coded in HPF.

  • []Advice to implementors. This is an obligation placed on the implementation of the interface and perhaps on the programmer when coding an extrinsic routine. However, it is also desirable to grant a certain freedom of implementation strategy so long as the obligation is satisfied. To this end an implementation may place certain restrictions on the programmer; moreover, each extrinsic-kind-keyword may call for a different set of restrictions.

    For example, an implementation on a parallel processor may find it convenient to replicate scalar arguments so as to provide a copy on every processor. This is permitted so long as this process is invisible to the caller. One way to achieve this is to place a restriction on the programmer: on return from the subprogram, all the copies of this scalar argument must have the same value. This implies that if the dummy argument has INTENT(OUT), then all copies must have been updated consistently by the time of subprogram return. (End of advice to implementors.)



Next:
Requirements on the Up: Extrinsic Procedures Previous: Overview


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