This cluster has 3 different kinds of compilers

  1. GNU
  2. Portland Group (PGI)
  3. Intel

Below is a table that shows the different compilers:

LANGUAGE

GNU COMMAND(S)

PGI COMMAND

INTEL COMMAND

FILE SUFFIX

Fortran 77 gfortran pgf77 ifort .f .for .FOR
** .F .fpp .FPP
Fortran 90 gfortran pgf90 ifort .f .for
** .F .f90 .F90 .fpp
Fortran 95 gfortran N/A N/A .f95
C gcc pgcc icc .c
C++ g++ pgCC icc .cc .cpp .cxx .C

** Use these suffixes for code that needs preprocessing with cpp.

    • No one compiler works best for all kinds of code.
    • If you are interested in speeding up your application, you will want to test various compiler options and compilers to see which ones work the best for your application.
    • There is a man page for each compiler that lists the compiler options.
    • In general, gcc/g++ is the most flexible since it runs on a variety of different computer platforms.
    • Many people use gcc/g++ so it will be easy to port their code to other platforms.
    • g77 was previously the fortran77 GNU compiler and is now retired and replaced by gfortran.
    • The PGI compilers will compile f77,f90, C, and C++ codes.
        • They compile a variety of codes with fewer errors than the Intel compilers.
        • Many Fortran codes use extensions to the language and the Portland Group compilers support those extensions.
      • Portland Group recommends that you use the pgf90 for both Fortran 90 and fortran 77 codes to gain additional code speed up.
  • All of the compiler commands listed above are in the standard user path.

Useful Compiler Options

    • Here are some useful compilers optimizations options to know about for each of the three kinds of compilers.
    • All three kinds of compilers generate code that is optimized for the platform where they are compiled.
    • The comments below apply to both C/C++ and Fortran77/90 codes.
  • These optimizations will not necessarily speed up all kinds of code and should be tested individually.
Portland Group: pgcc, pgCC, pgf77, pgf90
    • If you want to use a number of more aggressive optimizations that makes use of the features of the AMD  processors to speed up your code and use the options  -fastsse -O4.
  • In addition, there are other optimization options to try.

PG COMPILER OPTION

DESCRIPTION OF OPTION

-Munroll unroll loops
-Mvect vectorize code
-Mvect=sse make use of the sse/see2 vectorization
-Mconcur auto-parallelization using OpenMP
Mipa inter-procedural analysis
GNU compilers: gcc, g++

Use option -O3 for the most aggressive optimization. Here are some optimization options.

GCC/G++ COMPILER OPTION

DESCRIPTION OF OPTION

-march=machinetype (i.e. pentium4) Generate instruction of the machine type (i.e. pentium4)
ffast-math use optimized math functions
(this should be used with caution)
-mfpmath=sse make use of sse vectorization for math calculations
funroll-loops unroll loops
Intel Compilers: ifort, icc
    • Use the option -O3 to obtain more aggressive optimization.
    • You can use the -parallel option to have the compiler insert multi-threaded code in loops that can be safely parallelized.
  • Here are some other optimization options.

INTEL COMPILER OPTION

DESCRIPTION OF OPTION

-ipo multi-file interprocedural analysis
-unroll[n] unroll loops
-openmp generate OpenMP code in loops that can be parallelized