next up previous contents
Next: Interfaces Up: HPF and Procedures Previous: Consequences

 

Templates and Modules

Modules are now supported by most compilers.

In order that the compiler can relate the mapping of one object to the mapping of another, it is good practise to supply a module containing global definitions of the PROCESSORS, TEMPLATE s and their distribution methods. This module should be USE d in every procedure and all dummy arguments should be aligned to the global template.

 MODULE Global_Mapping_Info
  !HPF$ PROCESSORS, DIMENSION(2,2)      :: P
  !HPF$ TEMPLATE, DIMENSION(4,6)        :: T
  !HPF$ DISTRIBUTE (BLOCK,BLOCK) ONTO P :: T
 END MODULE Global_Mapping_Info

Makes things easier,

    SUBROUTINE Subby(A,B,RES)
     USE Global_Mapping_Info
     IMPLICIT NONE
     REAL, DIMENSION(:,:), INTENT(IN) :: A, B
     REAL, DIMENSION(:,:), INTENT(OUT) :: RES
!HPF$ ALIGN WITH *T :: A, B, RES
       ...
    END SUBROUTINE Subby

Not for PURE procedures.

Now try this question gif

Return to corresponding overview page gif

 

There is a potential naming problem here. Templates and processors are not Fortran 90 objects and so cannot appear in USE statements making them impossible to rename or USE ONLY. For example,

    SUBROUTINE Subby(A,B,RES)
     USE Global_Mapping_Info, ONLY:ProcArr => P

is invalid Fortran 90.

Return to corresponding overview page gif


next up previous contents
Next: Interfaces Up: HPF and Procedures Previous: Consequences

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.