Personal tools
You are here: Home Computing Hardware Power6 Compilers

Compilers

IBM's XL series compilers are provided for Fortran, C, and C++. (You may read XL as either "exceptional" or "extended language".)

Fortran

Here are just a few hints to get you started. For details, please refer to the Fortran language reference and user's guide

The Fortran compiler comes under a confusing variety of names: xlf, f77 (Fortran 77), xlf90 (Fortran 90), xlf_r (threadsafe Fortran 77), and xlf90_r (threadsafe Fortran 90). These are just different names for the same binary. They differ in some of the default settings, and which source format and file suffixes (.f .F .f90 .F90) are expected:

 

    default compiler option for
command file name suffix source format language level
xlf .f -qfixed=72 -langlvl=extended
xlf90 .f90 -qfree=f90 -langlvl=extended
f77 .f -qfixed=72 -langlvl=77STD
f90 .f90 -qfree=f90 -langlvl=90STD

 

There are some other compiler options that are associated with the compiler command name, e.g. -qsave / -qnosave. These can lead to subtle bugs or performance problems. To get a list of all compiler options that are in effect, compile the program with option -qsource and check the output file with file name suffix .lst.

Free format source codes should always be stored in files with file name extension .f90 or .f95 while files containing fixed format source code should have the file name extension .f.

Fortran programs using MPI

To compile an MPI (message passing interface) Fortran program, you have to use mpxlf (Fortran 77) or mpxlf90 (Fortran 90), depending on the source format (see above). Please note some puzzling side effects of the -q64 compiler option: in 64-bit mode you must call the threadsafe versions mpxlf_r or mpxlf90_r.

Fortran programs using OpenMP

If you want to run your program on several processors using OpenMP, please make sure that you select a threadsafe version (xlf_r or xlf90_r) in your makefile, e.g.
    FC = xlf90_r
You also need the compiler option -qsmp, most likely in the form -qsmp=omp.

C and C++

The C compiler comes under the name xlc, but the traditional name cc is also understood. The C++ compiler is named xlC (with an uppercase C). For programs to be run on several processors, please make sure to use the threadsafe versions of the compilers, i.e. with an underscore "_r" appended!

MPI users have to call the compilers by the name mpcc and mpCC, or mpcc_r and mpCC_r, respectively.

 

UPC

The UPC (Unified Parallel C) compiler comes under the name xlupc. It can be enabled with the command module load upc. The module also shows links to documentation and example code.
Document Actions