C/C++

The users at CC-IN2P3 may use the different C/C++ compilers.

GNU compilers

GNU developped C/C++ compilers delivered with the Linux system.

  • gcc (via gcc or cc) is the compilateur for C.
  • g++ (via g++ or c++) is the compilateur for C.

The version of the compilers is available via:

% gcc -v
% cc -v
% g++ -v

You can change the version using the command ccenv gcc <version>. To see the available versions use ccenv pgi --list.

To see the compiler options use:

% man gcc
% man g++

PGI compilers

CC-IN2P3 has some number of licences (via FlexLM) for the C/C++ 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.

Please find here the offcial PGI documentation.

  • pgcc is the PGI compiler for C
  • pgc++ is the PGI compiler for C++`
  • pgdbg is the debuggers
  • pgprof is the profiler

To see the pgcc and pgc++ compiler options use:

% ccenv pgi 19.7
% man pgcc
% man pgc++

Exemple:

% ccenv pgi 19.7
% pgcc -O -c test.c

For linking your program with the ( CERNLIB ), you should add the library libg2c.a which is a part of g77 compiler. The same remark is valid for other libraries compiled with g77 (like the NAG library).

% ccenv pgi 19.7
% set g2c = '-lg2c'
% pgcc -O -o test  test.c   `cernlib`  -lpthread  -lm ${g2c}
% ./test

Intel compilers

CC-IN2P3 has 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 (Integrated Performance Primitives)
  • Threading Building Blocks for Linux

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

% ccenv intel 2019
% man icc

Example:

% ccenv intel 2019
% icc -O -c test.c

For linking your program with the (CERNLIB), you should add the library libg2c.a which is a part of g77 compiler. The same remark holds for other libraries compiled with g77 (like the NAG library).

% ccenv intel 2019
% set g2c = '-lg2c'
% icc -O -o test    test.c  `cernlib`  -lpthread  -lm  ${g2c}
% ./test

Please find here the offical Intel C++ documentation.

NAG Libraries

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

% ccenv Nag_C <NAG product code>

For a complete documentation, please refer to proprietary site.