[ HPF Home | Versions | Compilers | Projects | Publications | Applications | Benchmarks | Events | Contact ] |
Consider:
PROGRAM DUMPLING INTERFACE EXTRINSIC('HPF','LOCAL') SUBROUTINE GNOCCHI(P, L, X) INTERFACE SUBROUTINE P(Q) REAL Q END SUBROUTINE P EXTRINSIC('COBOL','LOCAL') SUBROUTINE L(R) REAL R(:,:) END SUBROUTINE L END INTERFACE REAL X(:) END SUBROUTINE GNOCCHI EXTRINSIC('HPF','LOCAL') SUBROUTINE POTSTICKER(Q) REAL Q END SUBROUTINE POTSTICKER EXTRINSIC('COBOL','LOCAL') SUBROUTINE LEBERKNOEDEL(R) REAL R(:,:) END SUBROUTINE LEBERKNOEDEL END INTERFACE ... CALL GNOCCHI(POTSTICKER, LEBERKNOEDEL, (/ 1.2, 3.4, 5.6 /) ) ... END PROGRAM DUMPLING
The main program, DUMPLING, when compiled by an HPF compiler, is implicitly of extrinsic kind HPF. Interfaces are declared to three external subroutines GNOCCHI, POTSTICKER, and LEBERKNOEDEL. The first two are of extrinsic kind HPF_LOCAL and the third is of an extrinsic kind specified by the language COBOL and the local model. Now, GNOCCHI accepts two dummy procedure arguments and so interfaces must be declared for those. Because no extrinsic-prefix is given for dummy argument P, its extrinsic kind is that of its host scoping unit, the declaration of subroutine GNOCCHI, which has extrinsic kind HPF_LOCAL. The declaration of the corresponding actual argument POTSTICKER needs to have an explicit extrinsic-prefix because its host scoping unit is program DUMPLING, of extrinsic kind HPF.
Here are some more examples. In the first example, note that the declaration of the explicit size of BAGEL as 100 refers to its global size and not its local size:
INTERFACE EXTRINSIC('HPF','LOCAL') FUNCTION BAGEL(X) REAL BAGEL(100) REAL X(:) !HPF$ DISTRIBUTE (CYCLIC) :: BAGEL, X END FUNCTION END INTERFACE
In the next example, note that the ALIGN statement asserts that X, Y, and Z all have the same shape:
INTERFACE OPERATOR (+) EXTRINSIC('C','LOCAL') FUNCTION LATKES(X, Y) RESULT(Z) REAL, DIMENSION(:,:), INTENT(IN) :: X REAL, DIMENSION(:,:), INTENT(IN) :: Y REAL, DIMENSION(SIZE(X,1), SIZE(X,2)) :: Z !HPF$ ALIGN WITH X :: Y, Z !HPF$ DISTRIBUTE (BLOCK, BLOCK) X END FUNCTION END INTERFACE
In the interface block in this final example, 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:
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
©2000-2006 Rice University | [ Contact Us | HiPerSoft | Computer Science ] |