Fortran
Several Fortran compilers are available on ewok. These include GNU, Portland Group, Pathscale and Intel. The compilers are accessed by loading the appropriate module file. Each compiler has a corresponding mvapich module. The mvapich modules take care of loading the correct compiler. So, if you wanted to unload the PGI compiler and load the Pathscale compiler, the best way would be to unload mvapich-pgi and load mvapich-pathscale. You may then use a module swap if you want to change between different versions of a compiler.
NOTE: Descriptions of compiler options have been taken from their respective man pages
Available Compilers
Portland Group (PGI) Fortran
Commands
pgf77: Fortran 77 compilerpgf90: Fortran 90/95 compiler (alias forpgf95)pgf95: Fortran 90/95 compiler
General Options
The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.
| Option | Description |
|---|---|
| -M fixed | The source code uses fixed-form syntax, as 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 | This option preprocesses each file and leaves the output in a file named file.f for each file named file.F. |
| -i8 | This option treats INTEGER variables as 8 bytes.
For operations involving integers, uses 64 bits for computations. |
| -r8 | This option interprets REAL variables as DOUBLE PRECISION.Equivalent to using the options -Mr8 and -Mr8intrinsics. |
Debugging
The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.
| Option | Description |
|---|---|
| -g | Generates symbolic debugging information. Turns off optimization. |
| -Mbounds | Adds array bound checking. |
| -Mchkptr | Checks for unintended dereferencing of null pointers. |
Optimization
For most cases, the usual levels of optimization are appropriate (-O0, -O1, -O2 [default], -O3). Here are a few exceptions.
| Option | Description |
|---|---|
| -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; see |
| -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 | Sets 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 | Generates an optimization report to standard error. This has several suboptions, so check the man page. |
| -Mlist | Generates a listing file. |
| -mp | Enables the compiler to generate multithreaded code based on the OpenMP directives. |
PGI Documentation
See man pgf77, man pgf90 or man pgf95 for a full list of compiler options. PDF and HTML documentation is also available online from PGI at http://www.pgroup.com/resources/docs.htm.
Pathscale Fortran
Commands
pathf90: Fortran 77, 90 and 95 compilerpathf95: Fortran 77, 90 and 95 compiler
General Options
The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.
| Option | Description |
|---|---|
| -fixedform | The source code uses fixed-form syntax, as in Fortran 77. This option is on by default for source files ending in .f or .F. |
| -freeform | 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. |
| -cpp | This option preprocesses each file with the C preprocessor. By default, files ending in .F, .F90, and .F95 are run through the preprocessor while those ending in .f, .f90 and .f95 are not. |
| -i8 | Sets the default length of INTEGER constants, INTEGER variables, and LOGICAL quantities to 8 bytes. |
| -r8 | Sets the default specification for REAL variables to REAL(KIND=8) and the default for COMPLEX variables to COMPLEX(KIND=8). |
Debugging
The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.
| Option | Description |
|---|---|
| -g | Generates symbolic debugging information. Turns off optimization. |
| -ffortran-bounds-check | Adds array bound checking. |
Optimization
For most cases, the usual levels of optimization are appropriate (-O0, -O1, -O2 [default], -O3). Here are a few exceptions.
| Option | Description |
|---|---|
| -Ofast | Chooses flags to optimize performance. Equivalent to -O3 -ipa -OPT:Ofast -fno-math-errno -ffast-math. |
| -pg | Generate extra code to provide information for profiling with pathprof. |
| -Minfo | Generates an optimization report to standard error. This has several suboptions, so check the man page. |
| -mp | Enables the compiler to generate multithreaded code based on the OpenMP directives. |
Pathscale Documentation
See man pathf90, man pathf95, or man eko for a full list of compiler options. Additional documentation is also available online from Pathscale at http://pathscale.com/ws/node/70.
Intel Fortran
Commands
ifort: Fortran compiler.
General Options
The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.
| Option | Description |
|---|---|
| -fixed | The source code uses fixed-form syntax, as in Fortran 77. This option is on by default for source files ending in .f, .ftn, and .for. |
| -free | The source code uses free-form syntax. This option is on by default for source files ending in .f90, .F90, .f95, .F95. |
| -fpp -cpp |
Runs the fortran preprocessor on source files prior to compilation. By default, files ending in .fpp, .F, .FOR, .FTN, .FPP, .F90 and .S are run through the preprocessor prior to compilation or assembly. |
| -i8 -integer-size 64 |
Makes default INTEGER and LOGICAL variables 8 bytes.
For operations involving integers, uses 64 bits for computations. |
| -r8 -real-size 64 -autodouble |
Makes default REAL and COMPLEX variables 8 bytes long. Treats REAL variables as DOUBLE PRECISION (REAL(KIND=8)) and COMPLEX as DOUBLE COMPLEX (COMPLEX(KIND=8)). |
Debugging
The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.
| Option | Description |
|---|---|
| -g | Generates symbolic debugging information. Turns off optimization. |
| -check bounds | Generate code to perform compile-time and run-time checks on array subscript and character substring expressions. |
| -check pointers | Enables run-time checking for disassociated or uninitialized Fortran pointers, unallocated allocatable objects, and integer pointers that are uninitialized. |
Optimization
For most cases, the usual levels of optimization are appropriate (-O0, -O1, -O2 [default], -O3). Here are a few exceptions.
| Option | Description |
|---|---|
| -fast | Maximize speed across the program. Equivalent to -ipo -O3 -no-prec-div -static -xP. |
| -p -pg |
Compile and link for profiling with gprof |
| -opt-report | Generates an optimization report to standard error. |
| -openmp | Enables the compiler to generate multithreaded code based on the OpenMP directives. |
Intel Documentation
See man ifort for a full list of compiler options. Additional documentation is also available online from Intel at http://www.intel.com/support/performancetools/fortran/linux/.
GNU Fortran
Commands
g77: GNU Fortran 77 compilergfortran: GNU Fortran 95 compiler
General Options
The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.
| Option | Description |
|---|---|
| -ffixed-form | The source code uses fixed-form syntax, as in Fortran 77. |
| -ffree-form | The source code uses free-form syntax, introduced in Fortran 90. |
| -F | This option preprocesses each file and leaves the output in a file named file.f for each file named file.F. |
| -fdefault-integer-8 | (gfortran only) Set default INTEGER and LOGICAL types to 8 bytes. |
| -fdefault-real-8 | (gfortran only) Set default REAL variables to 8 bytes. |
| -fdefault-double-8 | (gfortran only) Set default DOUBLE PRECISION variables to 8 bytes. |
Debugging
The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.
| Option | Description |
|---|---|
| -g | Generates symbolic debugging information. Turns off optimization. |
| -fbounds-check | Adds array bound checking. |
Optimization
For most cases, the usual levels of optimization are appropriate (-O0, -O1, -O2 [default], -O3). Here are a few exceptions.
| Option | Description |
|---|---|
| -pg | Instrument program for profiling with gprof. |
| -p | Instrument program for profiling with prof. |
| -fopenmp | (only gfortran) Enables the compiler to generate multithreaded code based on the OpenMP directives. |
GNU Documentation
See man g77 or man gfortran for a full list of compiler options. Additional documentation is also available online from Intel (online and as a downloadable .pdf, .ps, or .tar file) at http://gcc.gnu.org/onlinedocs/.
