=====Portland Group Fortran=====

The Fortran compiler on Tiger is Portland Group Fortran. Tiger will most likely have several versions of the PGI compilers installed at any given time. A ''module avail'' will show what is available. A "''module list''" will show what is loaded (if anything.)

The PGI 6.0 Fortran compiler has three commands

* pgf77: Fortran 77 compiler
* pgf90: Fortran 90/95 compiler (alias for pgf95)
* pgf95: Fortran 90/95 compiler

=======Important Notes =======

Upon login, your environment does not have any compilers loaded. You will need to do a ''module load <compiler>''. After that, you can use the compiler and read its man page. Please use " module avail" to see the available modules.

When you load a compiler module, a related mpich module will be loaded as well. This module contains header files and libraries for MPI. In addition, it contains the mpif77 and mpif90 commands. To compile an MPI program, you will need to use mpif77 or mpif90 instead of the pgf77 or pgf90. Using mpif77/mpif90 will call the appropriate compiler, and it will set up the appropriate header and library paths for MPI. It will also automatically link in any necessary libraries for MPI. Thus, there is no need to add ''-lmpi'' to your command line.

=====Options=====

The following options control how source files are translated into machine code.

''-M fixed''

The source code uses fixed-form syntax, like in Fortran 77. This option is on by default for source files ending in ''.f'', ''.F'', ''.for'', and ''.fpp''.

''-M free''

The source code uses free-form syntax, introduced in Fortran 90. This option is on by default for source files ending in ''.f90'', ''.F90'', ''.f95'', ''.F95''

''-F''

Preprocess each file and leave the output in a file named file.f for each file named file.F.
<>
''-i8''

<> Treat INTEGER variables as eight bytes. For operations involving integers, use 64-bits for computations.
<>
<>
''-r8''

<> Interpret REAL variables as DOUBLE PRECISION. Equivalent to using the options -Mr8 and -Mr8intrinsics

----

The following option controls the memory model used by the resulting executable. It can be critical for applications that use more than 2 GB of memory per process.

''-mcmodel=medium''

Use the memory model that allows data sections to be larger than 2 GB. (Implies ''-Mlarge_arrays".) **Applications using more then 2 GB that don't use this option can produce incorrect results!**

----

The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.

''-g''

Generate symbolic debug information. Turns off optimization.

''-Mbounds''

Add (don't add) array bound checking.

----

For most cases, the usual levels of optimization are appropriate (-O0, -O1, -O2 (default), -O3). Here are a few exceptions.

''-fast''

Chooses generally optimal flags for the target platform. Use pgf90 -fast -help to see the equivalent switches. Note this sets the optimization level to a minimum of 2;

''-fastsse''

Chooses generally optimal flags for a processor that supports the SSE (Pentium 3/4, AthlonXP/MP, Opteron) and SSE2 (Pentium 4, Opteron) instructions. Use pgf90 -fastsse -help to see the equivalent switches.

''-Mflushz''

Set SSE to flush-to-zero mode.

''-pg'
''-ql''
''-Mprof''

Instrument program for profiling. These flags imply different types of profiling. Please check the pgf77 or pgf90 man page.

''-Minfo''

Generate an optimization report to stderr. This has several suboptions, so check the man page.

''-Mlist''

Generate a listing file.

''-mp''

Enable the compiler to generate multi-threaded code based on the OpenMP directives. There are only 2 processors per node, so the available multithreading is limited.

=====Documentation=====

See ''man pgf77'' or ''man pgf90'' for a full list of compiler options. PDF and HTML documentation is also available online from Portland Group at the following URL.

http://www.pgroup.com/doc/pgiug.pdf

http://www.pgroup.com/resources/tips.htm