Jean Zay: The Fortran and C/C++ compilation system (Intel)

The various Intel compiler versions available on Jean Zay may be activated through the module command.

Example of loading:

$ module avail intel-compilers
----------------------- /gpfslocalsup/pub/module-rh/modulefiles  --------------------------
intel-compilers/16.0.4 intel-compilers/18.0.5 intel-compilers/19.0.2 intel-compilers/19.0.4
 
$ module load intel-compilers/19.0.4
 
$ module list
Currently Loaded Modulefiles:
 1) intel-compilers/19.0.4

The compilation commands in Fortran, C et C++ :

Language Command Source file suffixes
Fortran ifort .f90 : free format ; .F90 : free format, pre-compiled by fpp
.f, .for, or .ftn : fixed format; .fpp, .F, .FOR, .FTN, or .FPP: fixed format, pre-compiled by fpp
C icc .c, .i
C++ icpc .C, .cxx, .c++, .cc, .cp, .cpp

Examples of how to generate executable files

$ ifort prog.f90 -o prog
 
$ icc  prog.c -o prog
 
$ icpc prog.C -o prog

Notes on the Fortran source code format

By default, the Intel compilers determine the source code format according to the file name suffix. However, the code source format can be manually defined by using the option -free (free format) or -nofree (fixed format). It should be noted that the fixed format has been considered as obsolete since publication of the Fortran 95 standard.

Examples:

  • If prog.f90 contains a code source written in free format:
    $ ifort prog.f90 -o prog
  • If prog.f90 contains a code source written in fixed format:
    $ ifort -nofree prog.f90 -o prog
  • If prog.f contains a code source written in fixed format:
    $ ifort prog.f -o prog
  • If prog.f contains a code source written in free format:
    $ ifort -free prog.f -o prog