GNU Compiler Collection

Overview of the installation and usage of the GCC on LRZ platforms

The GNU Compiler Collection provides front ends for C, C++, Objective-C, Fortran, Java, Go, and Ada, as well as libraries for these languages. For details on GCC, please refer to the GCC home page. This document provides an overview of the GCC installations on LRZ platforms as well as documentation and additional hints for the installed releases. 

The GCC is free software distributed under the terms of the GNU General Public License.

Accessing the compilers

A default version of the GCC is installed on all Linux-based systems. However, more recent releases of the GCC are separately installed and therefore can only be accessed by loading a suitable environment module:

module load gcc/<version>

(where <version> refers to one of the available release numbers). The command module avail gcc will give you an overview of available versions.

Support for parallel programming

MPI support

For software stack Spack/22.2.1 and below

Intel MPI and OpenMPI are compatible with GNU Compilers.

You typically need to load an environment module of the form

module load intel-mpi/<version>-gcc

or

module load openmpi/<version>-gcc11

to make use of this functionality. Since the accessed installation depends on the used GCC version, you need to do this after the desired gcc module has been loaded.

For software stack Spack/23.1.0 and above

Intel MPI and OpenMPI are compatible with GNU Compilers.

  • Intel MPI modules will not have -intel and -gcc suffixes.
    • Intel-mpi will have a module naming scheme such as

      • intel-mpi/version

      compared to the existing naming scheme, the module with suffixes such as,

      • intel-mpi/version-gcc or -intel


  • MPI variables (MPI_CC, MPI_CXX, MPI_FC, MPI_F77, MPI_F90) in the module will be set to compatible MPI wrappers based on the already loaded compiler module (intel or gcc).
  • What if both intel and gcc compiler modules are loaded together?
    • In this case, when loading intel-mpi the preferred compiler will be Intel (that means MPI_* variables will set intel-compatible wrappers).
  • module swap intel gcc or other way around will swap intel-mpi module with correct MPI_* variables.


  • Any MPI modules, intel-mpi or openmpi,  will have a prereq of the compatible compiler. What does it mean?
    • If you load an MPI module, a compiler module will be auto-loaded.
  • For OpenMPI modules, 
    • openmpi module naming scheme is openmpi/version-compilername-majorcompilerversion
    • if you load a openmpi module with -intel*, this will auto load intel compiler. 
    • if you load a openmpi module with -gcc*, this will auto load gcc compiler.


  • We have introduced the prerequeste of compatible MPI module in all the packages which are dependents of MPI.

OpenMP support

The Fortran, C and C++ compilers support the OpenMP standard, which provides directives and a small API for shared memory parallelization. Please study the compiler documentation of the GCC release you want to use for the level of support for this programming model.

PGAS: Partitioned Global Address Space

Please consult the LRZ PGAS page for details on this programming model.

C and C++ compilers

Invocation of the C compiler is via the gcc command, and of the C++ compiler via the g++ command.

Fortran compiler

The Fortran compiler is invoked via the gfortran command.

Documentation

Documentation for the various compilers is available on the GCC online docs page.

Please note that the Copyright for all information in this section belongs to the Free Software Foundation.