6.6 Extrinsic Procedures

HPF provides a mechanism by which HPF programs may call procedures written in other parallel programming styles or other programming languages. Because such procedures are themselves outside HPF, they are called extrinsic procedures.

In Digital Fortran 90, there are three kinds of EXTRINSIC procedures:

  1. EXTRINSIC(HPF) (data parallel),
  2. EXTRINSIC(HPF_LOCAL) (explicit SPMD), and
  3. EXTRINSIC(HPF_SERIAL) (single processor).

These three kinds are explained in Section 6.6.1.

6.6.1 Programming Models and How They Are Specified

The following list describes programming models:

The compiler can be invoked in several ways, corresponding to these different programming models:

An EXTRINSIC(HPF_LOCAL) or an EXTRINSIC(HPF_SERIAL) declaration in a procedure overrides the -wsf switch - as if that switch were not invoked for the procedure. This makes it possible to have an HPF_ LOCAL or HPF_SERIAL subprogram in the same file as that procedure. The compiler is invoked with the -wsf switch, but that switch has no effect on the compilation of the HPF_LOCAL or HPF_SERIAL subprocedure.

6.6.2 Who Can Call Whom

A single processor procedure which is the main program always executes on processor 0. Other than that, there is no restriction on where a single processor procedure executes.

A single processor procedure can call a single processor procedure.

A global HPF procedure can call:

An HPF_LOCAL procedure can call:

An explicit SPMD procedure which is not an HPF_LOCAL procedure (such as subroutine bar in Section 6.6.2.1) can call:

This relaxes some of the restrictions in Annex A of the High Performance Fortran Language Specification.

6.6.2.1 Calling Non-HPF Subprograms from EXTRINSIC(HPF_LOCAL) Routines

According to the High Performance Fortran Language Specification, EXTRINSIC(HPF_LOCAL) routines are only allowed to call other EXTRINSIC(HPF_LOCAL) routines, EXTRINSIC(F90_LOCAL) routines, or other extrinsic routines that preserve EXTRINSIC(HPF) semantics.

Digital Fortran 90 does not currently support the optional extrinsic prefix EXTRINSIC(F90_LOCAL). However, Digital relaxes the restriction given in the High Performance Fortran Language Specification and allows (non-HPF) Fortran routines to be called from EXTRINSIC(HPF_ LOCAL) routines. This is done by calling the non-HPF subprogram without an EXTRINSIC prefix, as in the following example:

! The main program is an EXTRINSIC(HPF) routine
      PROGRAM MAIN
      INTERFACE
         EXTRINSIC(HPF_LOCAL) SUBROUTINE foo
         END SUBROUTINE foo
      END INTERFACE

      CALL foo()
      END

! foo is an EXTRINSIC(HPF_LOCAL) routine

      EXTRINSIC(HPF_LOCAL) SUBROUTINE foo
      INTERFACE
        SUBROUTINE bar(B)
        REAL B(100)
        END SUBROUTINE bar
      END INTERFACE
      REAL A(100)

      CALL bar(A)
      PRINT *, A(1)
      END SUBROUTINE foo

! bar is declared without an EXTRINSIC prefix

      SUBROUTINE bar(B)
      REAL B(100)

      B = 1.0
      END SUBROUTINE bar

The non-HPF routine bar is called from an EXTRINSIC(HPF_LOCAL) routine. It is declared without using an EXTRINSIC prefix. This is the only method of calling existing routines with non-assumed-shape arguments from EXTRINSIC(HPF_LOCAL) routines. This can be useful, for example, if you wish to call an existing routine written in Fortran 77, or in C.

6.6.3 Requirements on the Called EXTRINSIC Procedure

HPF requires a called EXTRINSIC(HPF_LOCAL) or EXTRINSIC(HPF_SERIAL) procedure to satisfy the following behavioral requirements:

For More Information:

6.6.4 Calling C Subprograms from HPF Programs

To write EXTRINSIC routines in C (or other non-HPF languages), you must make your subprogram conform to Fortran calling conventions. In particular, the subprogram may have to access information passed through dope vectors.

For More Information: