Native compilers on NERSC systems¶
Cori provides three compiler suites:
Each suite provides compilers for C, C++, and Fortran. Each compiler has different characteristics - different compilers generate faster code under different circumstances. All three compilers provide support for OpenMP.
All compilers on Cori (Intel, Cray, and GNU), are provided via three "programming environments" that are accessed via the
module utility. Each programming environment contains the full set of compatible compilers and libraries. To change from one compiler to the other you change the programming environment via the
module swap command.
Additionally, NERSC provides the LLVM compilers
flang for C, C++, and Fortran, respectively. These are not supported by Cray and therefore are not compatible with all of the same software and libraries that the Cray-provided compiler suites are, but are nevertheless useful for users who require an open-source LLVM-based compiler toolchain.
The Intel compiler suite is available via the
PrgEnv-intel module, and is loaded by default on Cori. The native compilers in this suite are:
Full documentation of the Intel compilers is provided here. Additionally, compiler documentation is provided through
man pages (e.g.,
man icpc) and through the
-help flag to each compiler (e.g.,
The GCC compiler suite is available via the
PrgEnv-gnu module. The native compilers in this suite are:
Full documentation of the GCC compilers is provided here. Additionally, compiler documentation is provided through
man pages (e.g.,
man g++) and through the
--help flag to each compiler (e.g.,
The Cray compiler suite is available via the
PrgEnv-cray module. The native compilers in this suite are:
Full documentation of the Cray compilers is provided here for the C/C++ compilers, and here for the Fortran compiler. Additionally, compiler documentation is provided through
man pages (e.g.,
Major changes to Cray compilers starting in version 9.0
Verison 8.7.9 of the Cray compiler (CCE) is the last version based on the old compiler environment and default settings. Starting in version 9.0, Cray made major changes to the C/C++ compilers, and smaller changes to the Fortran compiler. In particular:
- The C/C++ compilers have been replaced with LLVM and clang, with some additional Cray enhancements. This means that nearly all of the compiler flags have changed, and some capabilities available in CCE 8 and previous versions are no longer available in CCE 9. It may also result in performance differences in code generated using CCE 8 vs CCE 9, due to the two versions using different optimizers.
- OpenMP has been disabled by default in the C, C++, and Fortran compilers. This behavior is more consistent with other compilers. To enable OpenMP, one can use the following flags:
For users who are unable to migrate their workflows to the clang/LLVM-based CCE 9 C/C++ compilers, Cray has simultaneously released a CCE 9 "classic" version, which continues to use the same compiler technology in CCE 8 and older versions. This version of CCE is available as the module
cce/9.0.0-classic. However, users should be aware that "classic" CCE is now considered "legacy," and that future versions of CCE will likely be based on clang/LLVM. The Cray documentation for CCE "classic" is provided here.
The LLVM core libraries along with the compilers are available only on Cori. It is compiled against the GCC compiler suite and thus cannot be used with the Intel or Cray programming environments.
In order to enable clang compiler, first make sure to load the gnu programming environment
module load PrgEnv-gnu module load gcc module load llvm/<version>
module avail llvm displays which versions are currently installed.
llvm/5.0.0-gnu-flang contains the LLVM-based Fortran compiler
flang. However, this compiler is highly experimental and should not be used for production applications. Furthermore, it does not find the standard headers and Fortran modules by default. Therefore, those need to be added manually to the compilation flags using
-I. Please use
module show llvm/5.0.0-gnu-flang to find the corresponding include paths for these headers and modules.
Common compiler options¶
Below is a table documenting common flags for each of the three compilers.
|Overall optimization|| || || ||Replace |
|Enable OpenMP|| || || ||OpenMP enabled by default in Cray.|
|Free-form Fortran|| || || ||Also determined by file suffix ( |
|Fixed-form Fortran|| || || ||Also determined by file suffix ( |
|Debug symbols|| || ||N/A||Debug symbols enabled by default in Cray.|