NERSC logo National Energy Research Scientific Computing Center
  A DOE Office of Science User Facility
  at Lawrence Berkeley National Laboratory
 

PGI Fortran Compiler on Franklin

The Portland Group Fortran compilers are available on Franklin. The PGI Fortran compiler offers full support for the Fortran 77, 90 and 95 language standards. Users should call the Cray wrappers cc and CC directly for compilation on the compute nodes. We do not recommend directly calling pgf77, pgf90, and pgf95.

Contents


Invoking the compiler

Franklin has two kinds of nodes. The compute nodes run a limited functionality OS called Catamount and the service and login nodes run Linux. To compile code for the compute nodes use the Cray wrapper to the PGI compilers called 'ftn'.` The most basic form being:

franklin% ftn source.f

Running the ftn command on any Fortran 77, 90 and 95 program will produce an executable named a.out.

Similar to most Unix compilers, the compilation process can be stopped before linking by using "-c", and specifying ".o" files on the command line will cause them to be linked:

Source Files and language dialects

The Portland Group Fortran compiler supports the following file extensions

.f, .F, .for, .fpp, .f90, .F90, .f95, and .F95

By default, the compilers with Fortran 77 defaults require fixed form Fortran source. Compilers with Fortran 90 defaults require free form Fortran source. To change the defaults use the following flags:

  • -Mextend
  • -Mfixed Indicates source code uses fixed-form syntax as in Fortran 77, option is included by default for files with suffixes .f, .F, .for, and .fpp
  • -Mfreeform Indicates source code written with free-form syntax as in Fortran 90, option is included by default for files with suffixes .f90, .F90, .f95, and .F95

Optimization

Using the optimization flags when compiling with the Portland Group compilers can significantly increase the performance of your programs.

  • NERSC recommends the following as a standard compile line for modern Fortran production parallel codes:

    franklin% ftn -fastsse filename.f
    
  • If you use Interprocedural Analysis (IPA) -Mipa=fast,inline must be included on the link line as well.
  • PGI7 family compiler has -fast setting same as -fastsse, which is different from PGI6 family. Use "pgf95 -help -fast" or "pgf95 -help -fastsse" to find out the detailed settings.
  • See Important Portland Group Compiler Options for a detailed description of the most useful compiler options.

IBM/XT4 Common Fortran Compiler Flags Comparison

This table lists some common compiler options in the Cray XT's ftn and IBM's xlf90 Fortran 90 compilers.

IBM xlf90Cray XT ftnMeaning
File Handling Options
-c -c compile to .o files but do not link to build an executable
-o -o name executable output file
-S -S produce assembler source output file
-I -module specify directory to search for module files (.mod)
-I -I specify directory to search for #include files
-L, -l -L, -l specify directory to search for libraries
Source File Options
-qsuffix=f=f90 (default for free form) Use .f90 filename extension for Fortran source code files
(default) (default for fixed form) Use .f filename extension for Fortran source code files
-qlanglvl=90std -Mstandard warn of nonstandard language usage
-k, -qfree[=f90] -Mfree[form] expect free-form (fortran 90) source input
-qfixed -Mfixed expect fixed-form (fortran 77) source input
-qfixed=72 -Mfixed specifies 72 column source input form
-qfixed=80 No ftn equivalent specifies 80 column source input form
-qfixed=132 -Mextend specifies 132 column source input form
-u -Mdclchk specifies no implicit data typing ("implicit none")
Source Preprocessing
-qsuffix=cpp=F90 (default for free form) Invoke preprocessor first on .F90 filename extension for Fortran source code files
(default) (default for fixed form) Invoke preprocessor first on .F filename extension for Fortran source code files
-Wf,-Dname[=def] -Dname[=def] Define variables used for source preprocessing
Message Output Options
-qversion -v, -show print the version number of the compiler
-w -Minform=severe, -silent suppress all compiler messages except errors
-qsource -Mlist produce source code listing
-qflag={I,L,W,E,S,U} -Minform=level specify level of message output (level can be fatal, severe, warn, or inform)
-V, -v -v verbose output from compiler, showing progress of each phase
Runtime Checking Options
-C, -qcheck -C, -Mbounds run-time checking of array bounds
-qextchk No ftn equivalent argument or procedure interface checking (runtime, for f90)
Code Generation Options
-g -g compile for debugging
-qsave -Msave make all local storage static
-1, -qonetrip -Monetrip execute all do-loops at least once (Fortran-IV compatibility)
-qinitauto No ftn equivalent initialize all local variables to zero
-qrecur -Mrecursive compile for recursive subroutine calling
-qfloat=rndsngl -Kieee compile for IEEE-conformant arithmetic
Profiling Options
-p, -pg -pg compile with support for profiling
Optimization Options
-O{2-4} -O{0-4} specifies optimization level
-qhot -Ofastsse specifies a very high level of optimization

Pathscale/XT4 Common Fortran Compiler Flags Comparison

This table lists some common compiler options of the Cray XT4 ftn and the Pathscale pathf90 Fortran 90 compilers. The Pathscale compiler is the default compiler on Jacquard.

Jacquard pathf90Cray XT ftnMeaning
File Handling Options
-c -c compile to .o files but do not link to build an executable
-o -o name executable output file
-S -S produce assembler source output file
-module -module specify directory to search for module files (.mod)
-I -I specify directory to search for #include files
-L, -l -L, -l specify directory to search for libraries
Source File Options
default for free form default for free form Use .f90 filename extension for Fortran source code files
default for fixed form default for fixed form Use .f filename extension for Fortran source code files
-ansi -Mstandard warn of nonstandard language usage
-freeform -Mfree[form] expect free-form (fortran 90) source input
-fixedform -Mfixed expect fixed-form (fortran 77) source input
-col72 -Mfixed specifies 72 column fixed source input form
-col80 No ftn equivalent specifies 80 column fixed source input form
-extend-source -Mextend specifies 132 column fixed source input form
No Pathscale equivalent -Mdclchk specifies no implicit data typing ("implicit none")
Source Preprocessing
default for free form default for free form Invoke preprocessor first on .F90 filename extension for Fortran source code files
default for fixed form default for fixed form Invoke preprocessor first on .F filename extension for Fortran source code files
-Dname[=def] -Dname[=def] Define variables used for source preprocessing
Message Output Options
-version, -dumpversion -V, -show print the version number of the compiler
-w -Minform=severe, -silent suppress all compiler messages except errors
-flist -Mlist produce source code listing
No Pathscale equivalent -Minform=level specify level of message output (level can be fatal, severe, warn, or inform)
-v -v verbose output from compiler, showing progress of each phase
No Pathscale equivalent -Minfo=mp feedback from parallelization process
Runtime Checking Options
-C, -ffortran-bounds-check -C, -Mbounds run-time checking of array bounds
No Pathscale equivalent No ftn equivalent argument or procedure interface checking (runtime, for f90)
Code Generation Options
-g -g compile for debugging
-static-data -Msave make all local storage static
No Pathscale equivalent -Monetrip execute all do-loops at least once (Fortran-IV compatibility)
-zerouv No ftn equivalent initialize all local variables to zero
-LANG:recursive=ON -Mrecursive compile for recursive subroutine calling
-OPT:IEEE_arithmetic=1 -Kieee compile for IEEE-conformant arithmetic
Profiling Options
-pg -pg compile with support for profiling
Optimization Options
-O{0-3} -O{0-4} specifies optimization level
-Ofast -fastsse specifies a very high level of optimization

Related Information


LBNL Home
Page last modified: Tue, 30 Oct 2007 20:43:54 GMT
Page URL: http://www.nersc.gov/nusers/systems/franklin/software/ftn.php
Web contact: webmaster@nersc.gov
Computing questions: consult@nersc.gov

Privacy and Security Notice
DOE Office of Science