Compiling Fortran programs on Big Red II at IU

On Big Red II at Indiana University, Fortran code that will execute on the compute nodes should be compiled with the ftn command. The command will indirectly invoke the Cray, Portland Group (PGI), or GNU (GCC) Fortran compiler depending the programming environment you have loaded.

Note: You should not directly invoke the Cray (crayftn), PGI (pgf95), or GCC (gfortran) Fortran compiler on Big Red II if your code is going to execute on the compute nodes. You can use them only for programs that will run on the login or service nodes.

Programming environments on Big Red II are controlled using the Modules user environment package. The following programming environment modules are available on Big Red II; information about using ftn with each is provided below:

Programming environment Module
Cray PrgEnv-cray/4.1.40
PGI PrgEnv-pgi/4.1.40
GNU PrgEnv-gnu/4.1.40

The only compiler switch common to each programming environment is default64, which promotes all integers and real numbers to a 64-bit default, and is compatible with the 64-bit MPI libraries.


Cray

The ftn command will invoke the Cray Fortran compiler when the Cray programming environment module (PrgEnv-cray/4.1.40) is loaded. To load the module, on the command line, enter:

  module load PrgEnv-cray/4.1.40

Note: If a programming environment module is already loaded, you will need to unload it before you can load another.

To make permanent changes to your environment, edit your ~/.modules file. For more, see In Modules, how do I save my environment with a .modules file?

The Cray compiler switches are heavily treed. The top-level switches contain most legacy switches, such as -o (output file), -O (optimization; default is -O2), -l (library name), and -L (library directory). Other switches, such as -e (enable compiling options), -d (disable compiling options), and -h (arguments), have multiple sub-options.

For details about Cray Fortran compiler switches and options, see the crayftn manual page on Big Red II; on the command line, enter:

  man crayftn 

Portland Group (PGI)

The ftn command will invoke the PGI Fortran compiler when the PrgEnv-pgi/4.1.40 programming environment module is loaded. To load the module, on the command line, enter:

  module load PrgEnv-pgi/4.1.40

Note: If a programming environment module is already loaded, you will need to unload it before you can load another.

Although you'll use ftn to indirectly invoke the PGI Fortran compiler, you'll use it with most of the normal pgf95 compiler switches (except the -Mprof=mpi, -Mmpi, and -Mscalapack switches, which are not supported on Cray XT systems).

For details about the available PGI Fortran compiler switches and options, see the pgf95 manual page on Big Red II; on the command line, enter:

  man pgf95

GNU

The ftn command will invoke the GNU Compiler Collection (GCC) Fortran compiler when the PrgEnv-gnu/4.1.40 programming environment module is loaded. To load the module, on the command line, enter:

  module load PrgEnv-gnu/4.1.40

Note: If a programming environment module is already loaded, you will need to unload it before you can load another.

Although you'll use the ftn command to indirectly invoke the GCC Fortran compiler, you'll use it with the normal set of gfortran compiler switches.

For details about GCC Fortran compiler switches and options, see the gfortran manual page on Big Red II; on the command line, enter:

  man gfortran

This is document bdnm in the Knowledge Base.
Last modified on 2015-08-20 00:00:00.

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.