Fortran

The users have at their disposal several versions of Fortran (77/90/95) compilers.

GNU Compiler

GNU developped Fortran (77/90/95) compilers delivered with the Linux system. In order to compile, load the environment with the command ccenv gcc <version>. To see the available versions of gcc use ccenv gcc --list.

Fortran77

g77 is the GNU compiler for Fortran77. In order to compile, load the environment with the command ccenv gcc 3.4.6 and then use g77. To know the compiler options do:

% ccenv gcc 3.4.6
% man g77

To compile the program test.f and to build the file test.o:

% g77 -O -c test.f

If your program is using CERN libraries routines (CERNLIB), you should use the command cernlib in order to define the librairies names. Here is an example how to compile, create the executable module and execute the test program:

% g77 -O -o test  test.f  `cernlib` -lm
% ./test

Warning

You should use the backquotes with cernlib!

Fortran 90/95

gfortran is the compiler for Fortran 90/95. To use this compiler, you must load the environment using ccenv gcc <version> and use the command gfortran.

To see the options use:

% ccenv gcc 7.3.0
% man gfortan

PGI compilers

CC-IN2P3 has some number of licences (via FlexLM) for the Fortran (77/90/95) compilers supplied by PGI (Portland group). In order to compile your program you should first load the environment by the command ccenv pgi <version>. To see the available versions use ccenv pgi --list.

You can use also the debuggers: pgdbg and pgprof.

Please find here the offcial PGI documentation.

Fortran77

pgf77 is the PGI compiler for Fortran77 language . To use this compiler, you must load the environment using ccenv pgi 18.10.

To see the compiler options use:

% ccenv pgi 18.10
% man pgf77

Example how to compile:

% ccenv pgi 18.10
% pgf77 -O -c test.f

If you need to edit the links (linker) and execute your program with the CERNLIB, you should add the libg2c.a which is supplied with g77 compiler (the CERNlib compiler):

% ccenv pgi 18.10
% set g2c = '-lg2c'
% pgf77 -O -o test  test.f   `cernlib`  -lm ${g2c}
% ./test

Fortran90

pgf90 is the PGI compiler for Fortran90 language. In order to compile your program you should first load the environment by the command ccenv pgi <version>.

To see the available versions use ccenv pgi --list.

To see the pgf90 command options use:

% ccenv pgi 19.7
% man pgf90

Example:

% ccenv pgi 19.7
% pgf90 -O -c test.f90

Fortran95

pgf90 is the PGI compiler for Fortran95 (et HPF). In order to compile your program you should load the environment via ccenv pgi <version>:

% ccenv pgi 19.7
% man pgf95

Example:

% ccenv pgi 19.7
% pgf95 -O -c test.hpf

Intel Compiler

CC-IN2P3 provides some number of licences (via FlexLM) for the compilers supplied by Intel .

This software contains the C/C++ and Fortran compilers with the interactive debug idb and with the libraries:

  • MKL (Math Kernel Library)
  • IPP (Integrted Performance Primitives)
  • Threading Building Blocks for Linux

To compile your source code with this compiler, load the environment by the command ccenv intel <version> and use the command icc. To see the available versions use ccenv intel --list. To look at the compiler options:

% ccenv intel 2019
% man ifort

Please find here the offical Intel C++ documentation.

Example how to compile:

% ccenv intel 2019
% ifort -O -c test.f

In Fortran 77, if you are using the CERNLIB, you should add the library libg2c.a available with g77 compiler. The same comment is true for any other library compiled with g77 (like NAG library, for example).

% ccenv intel
% set g2c = '-lg2c'
% ifort -O -o test  -nofor_main  test.f  `cernlib`  -lm  ${g2c}
% ./test

NAG Libraries

To use the NAG Fortran libraries, load the environment (use the --list option to have the available libraries listed):

% ccenv Nag_Fortran <NAG product code>

For a complete documentation, please refer to proprietary site.

NAG Compiler

CC-IN2P3 has a number of licences for the Fortran 95 compiler supplied by NAG. To compile your source code with this compiler, load the environment using ccenv f95 <version>.

To see the available versions use ccenv f95 --list and to see the f95 options, use:

% ccenv f95 6.2
% f95 -help