12.07.2015 Views

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

HPFExampleDIMENSION R(10)COMMON /HOST/ A, R, Q(3), UThis declares a common block called HOSTname to the next. This is an alternative to the use of continuation lineswhen declaring a common block with many symbols.Common blocks with the same name that are declared in differentprogram units share the same storage area when combined into oneexecutable program and they are defined using the SEQUENCEattribute.In HPF, a common block is non-sequential by default, unless there is anexplicit SEQUENCE directive that specifies the array as sequential.Note this may require that older FORTRAN 77 programs assumingsequence association in COMMON statements have SEQUENCEstatements for COMMON variables.Note: The different types of declaration used for R (declared in a DIMENSION statement) and Q(declared in the COMMON statement).The declaration of HOST in a SUBROUTINE in the same executable program, with a differentshape for its elements would require that the array be declared using the SEQUENCE attribute.SUBROUTINE DEMO!HPF$ SEQUENCE HOSTCOMMON/HOST/STORE(15)...RETURNENDCommon Blocks and SubroutinesIf the main program has the common block declaration as in the previous example, the COMMONstatement in the subroutine causes STORE(1) to correspond to A, STORE(2) to correspond toR(1), STORE(3) to correspond to R(2), and so on through to STORE(15) corresponding to thevariable U.Common Block Records and CharactersYou can name records within a COMMON block. Because the storage requirements of records aremachine-dependent, the size of a COMMON block containing records may vary between66 Chapter 3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!