Skip to content

GNU Compiler Collection (GCC)

The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project. GCC is a key component of the GNU toolchain and the standard compiler for most projects related to GNU and the Linux kernel. Our GCC installations include compilers for the C (gcc), C++ (g++) and Fortran (gfortran) languages.

There are other compiler suites available, with the Intel oneAPI version being the most notable. The Intel suite is generally faster than GCC on serial programs, although the differences between GCC and Intel have been steadily decreasing in recent years. The Intel ancillary libraries for MPI, BLAS, LAPACK, etc. are, however, still significantly faster than those for GCC, although they can be somewhat more difficult to use. It is a matter for individuals to decide which compiler suite is best for their given software and needs.

GCC Versions

The basic version of GCC you'll find upon logging in to one of our machines is the version that is included with the operating system. This can be identified via, for example:

module purge
gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-16)

It is not recommended to use this GCC version for research compiling purposes. It typically lags - and considerably so - the most recently available version of GCC, which is 12.2.0 as of this writing. Also, the basic operating system does not include the additional libraries required to take advantage of HPC hardware. It would take much more effort by a user to attempt to install these libraries using the system GCC than to simply load an appropriate module.

The available versions of GCC are loaded as modules on our system and can be found via:

module spider GCC

      The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, and Ada, as well as libraries for
      these languages (libstdc++, libgcj,...).


We can load one of these and see what we've loaded via:

module purge
module load GCC/12.2.0
module list

Currently Loaded Modules:
  1) GCCcore/12.2.0   2) zlib/1.2.12   3) binutils/2.39   4) GCC/12.2.0

This loads `binutils` as well as the compilers, since it is required to produce executables if any external libraries are to be linked.  The `GCCcore` module is required for other modules such as the Intel compiler modules to work correctly.  It should not be loaded by itself for compilation purposes.

We recommend loading the most recent version of the GCC module, unless there is a compelling reason to do otherwise.  The older versions are available for those with software that will not correctly compile on newer GCC versions.  Also, occasionally a researcher requires an older version to attempt to replicate previous research results. 

## The foss Chain

The GCC compilers are by themselves insufficient for the needs of those wishing to compile and run software on HPC systems with multiple CPUs per node, cores per CPU, and nodes as well as hardware accelerators such as GPUs.  This is why the `foss` chains are available.  They contain the GCC compilers as well as various libraries needed to take advantage of typical HPC hardware infrastructure.

module purge module load foss/2022b module list

Currently Loaded Modules: 1) GCCcore/12.2.0 5) numactl/2.0.16 9) hwloc/2.8.0 13) libfabric/1.16.1 17) OpenMPI/4.1.4 21) FFTW.MPI/3.3.10 2) zlib/1.2.12 6) XZ/5.2.7 10) OpenSSL/1.1 14) PMIx/4.2.2 18) OpenBLAS/0.3.21 22) ScaLAPACK/2.2.0-fb 3) binutils/2.39 7) libxml2/2.10.3 11) libevent/2.1.12 15) UCC/1.1.0 19) FlexiBLAS/3.2.1 23) foss/2022b 4) GCC/12.2.0 8) libpciaccess/0.17 12) UCX/1.13.1 16) CUDA/12.0.0 20) FFTW/3.3.10 ```

Loading this module enables you to take full advantage of the capabilities of OpenMP, MPI, FFTW, BLAS, LAPACK and CUDA on HPC hardware along with GCC.

The GCC and library versions included with recent foss versions are:

2022b 12.2.0 4.1.4 0.3.21 3.3.10 2.2.0-fb 12.0.0
2022a 11.3.0 4.1.4 0.3.20 3.3.10 2.2.0-fb 11.7.0
2021b 11.2.0 4.1.1 0.3.18 3.3.10 2.1.0-fb -
2021a 10.3.0 4.1.1 0.3.15 3.3.9 2.1.0-fb -
2020b 10.2.0 4.0.5 0.3.12 3.3.8 2.1.0 -
2020a 9.3.0 4.0.3 0.3.9 3.3.8 2.1.9 -
2019b 8.3.0 3.1.4 0.3.7 3.3.8 2.0.2 -


  • A CUDA-enabled version of OpenMPI is included starting with foss/2022a, which automatically loads the most recent available version of CUDA. The CUDA module can be simply and easily changed to any available version with module load CUDA/version.
  • An MPI-enabled version of FFTW is included via the FFTW.MPI module starting with foss/2022a.
  • A FlexiBLAS-enabled version of ScaLAPACK is included starting with foss/2021a. This enables exchanging the BLAS/LAPACK implementations used by a program without recompiling or relinking. The default version is OpenBLAS.
Back to top