next up previous contents
Next: New HPF Intrinsics Up: Extrinsic instead of INDEPENDENT Previous: Extrinsic instead of INDEPENDENT

 

Calls to the NAG Library

This example demonstrates the use of the NAg FORTRAN 77 library from within an HPF program. The cited example calls one of the simplest NAg library routines, X01AAF which returns the value of tex2html_wrap_inline21966 . Clearly, a far more substantial routine could have been called from within the extrinsic instead.

      DOUBLE PRECISION FUNCTION Pi()
       DOUBLE PRECISION X01AAF, x
        Pi = X01AAF(x)
      END

The extrinsic does not need any mapping information because it does not reference any mapped objects.

The calling program could be:

PROGRAM Using_NAG_4_Pi
  !HPF$ PROCESSORS, DIMENSION(4)   :: P
  DOUBLE PRECISION, DIMENSION(100) :: A
  !HPF$ DISTRIBUTE (BLOCK) ONTO P  :: A
  INTERFACE
   EXTRINSIC(F77_LOCAL) DOUBLE PRECISION FUNCTION Pi()
   END FUNCTION Pi
  END INTERFACE
  A   = Pi()
END PROGRAM Using_NAG_4_Pi

All scalars in a program must have the same value. As Pi is a scalar routine each version of it must return the same value (which they do).

It must be ensured that the correct libraries are linked at compile time. Use the link editors' -l switch:

  $ pghpf -Mnohpfc NagLib_Calc_u_like.f
  $ pghpf Extrinsic.hpf NagLib_Calc_u_like.o -lnag


next up previous contents
Next: New HPF Intrinsics Up: Extrinsic instead of INDEPENDENT Previous: Extrinsic instead of INDEPENDENT

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996
Not for commercial use.