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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SyntaxMODULE [name][specification-part][ CONTAINS [module-subprogram-part]]END [MODULE [ module-name ]]nameis optional; if supplied it becomes the name of the program module andmust not clash with any other names used in the program. If it is notsupplied, a default name is used.specification-partcontains specification statements. See the Fortran 95 Handbook for acomplete description of the valid statements.module-subprogram-partcontains function and subroutine definitions for the module, precededby a single CONTAINS keyword.Modules can be independently compiled and used within programs using the USE statement. Useof Fortran 90/95 modules causes the compiler to create a filename.mod file in the current directory(a .mod file). This file contains all the information the compiler needs concerning interfacespecifications and the data types for the routines defined in the module. When a program, routine,or another module encounters the USE statement, the .mod file is read and "included" in theprogram, using the scope rules defined in Fortran 90/95 for USE association. If you are usingseparate modules, this creates another step in the program development process. When a module iscompiled, both a .mod and an object file are created. The .mod file is used when a USE statementis encountered, and the object file is used when the program is linked.For example, if module1.f contains a module with several procedures, and test1.f contains a USEstatement that uses module1, the compilation would involve the steps.% pgf95 -c module1.f% pgf95 –o test1 test1.f module1.oThe search for a .mod file includes the following directories:• Each –I directory specified on the command-line.• The directory containing the file that contains the USE statement (the current workingdirectory.)• The standard include area.Fortran Statements 111

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

Saved successfully!

Ooh no, something went wrong!