GNU Compiler Collection (GCC)¶
Supported versions¶
To check which GCC versions are currently supported on Discoverer, execute on the login node:
module avail gcc
The recipe, developed to carry on the compilation of the GCC code on Discoverer HPC, is publicly available online at:
Loading¶
To obtain access to the latest GCC, load the environment module gcc/latest
:
module load gcc/latest
otherwise replace latest
with the reqired version.
Compilers¶
Host/Target specification¶
The provided GNU Compiler Collection matches the following host/target specification:
x86_64-pc-linux-gnu
More about the host and target specifications:
Libraries embedded¶
All available GCC builds embed the following libraries:
which means you do not need to load those libraries explicitly through any other environment module. If the GCC environment module is loaded, that means the shared and static versions of those libraries become accessible from within the user environment.
Compiler optimization flags for AMD Zen2 CPU¶
Note
The compute nodes of Dicoverer HPC are equipped with AMD EPYC 7H12 64-Core processors, which implies AMD Zen2 CPU architecture.
The following compiler flags can be useful during the compile-time optimization of your binary code on AMD Zen2:
-march=znver2 -mtune=native
For example:
gcc -march=znver2 -mtune=native ...
g++ -march=znver2 -mtune=native ...
gfortran -march=znver2 -mtune=native ...
More on the supported compiler flags: AMD EPYC™ 7xx2-series Processors Compiler Options Quick Reference Guide
See also: Best Practice Guide - AMD EPYC
Interaction with CMake¶
It is recommended to specify the compiler executables when invoking cmake
tool:
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_Fortran_COMPILER=gfortran
The corresponding optimization compiler flags can be passed to cmake
as well:
-DCMAKE_C_FLAGS="-march=znver2 -mtune=native"
-DCMAKE_CXX_FLAGS="-march=znver2 -mtune=native"
-DCMAKE_Fortran_FLAGS="-march=znver2 -mtune=native"
Getting help¶
See Getting help