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:

To find what GCC versions are available, use module spider:

module spider GCC

To learn how to load a specific module version, use module spider:

module spider GCC/13.2.0

To load GCC:

module load GCC/13.2.0

To find what GCC versions are available, use module spider:

module spider GCC

To learn how to load a specific module version, use module spider:

module spider GCC/13.3.0

To load GCC:

module load GCC/13.3.0

To find what GCC versions are available, use module spider:

module spider GCC

To learn how to load a specific module version, use module spider:

module spider GCC/13.3.0

To load GCC:

module load GCC/13.3.0

To find what GCC versions are available, use module spider:

module spider GCC

To learn how to load a specific module version, use module spider:

module spider GCC/13.3.0

To load GCC:

module load GCC/13.3.0

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.

To find what foss versions are available, use module spider:

module spider foss

To learn how to load a specific module version, use module spider:

module spider foss/2023b

To load foss:

module load foss/2023b

To find what foss versions are available, use module spider:

module spider foss

To learn how to load a specific module version, use module spider:

module spider foss/2024.05

To load foss:

module load foss/2024.05

To find what foss versions are available, use module spider:

module spider foss

To learn how to load a specific module version, use module spider:

module spider foss/2024.05

To load foss:

module load foss/2024.05

To find what foss versions are available, use module spider:

module spider foss

To learn how to load a specific module version, use module spider:

module spider foss/2024.05

To load foss:

module load foss/2024.05

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:

foss GCC OpenMPI OpenBLAS FFTW ScaLAPACK CUDA
2024.05 13.3.0 5.0.3 0.3.27 3.3.10 2.2.0-fb -
2023b 13.2.0 4.1.6 0.3.24 3.3.10 2.2.0-fb -
2023a 12.3.0 4.1.5 0.3.23 3.3.10 2.2.0-fb -
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 -

Notes:

  • 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.