Categories: Compilers, Software
Print this article
The GNU Compiler Collection (GCC) includes front ends for C, C++, Objective-C, Fortran, Java, Ada, Go, and libraries for many more. GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user’s freedom.
Cray provides the GNU compilers as part of several programming environments. Titan has GNU versions as part of the PrgEnv-gnu environment, and gcc in /usr/bin.
Note that Cray Systems have two different types of nodes, with implications to compiling code on each.
- Compute nodes running the CNL OS.
- To build code for the compute nodes, you should use the Cray wrappers cc, CC, and ftn.
- The wrappers will call the appropriate GNU compiler which will use the appropriate header files and link against the appropriate libraries.
- Service and login nodes running Linux.
- To build code for the Linux service nodes, you can call the GNU compilers directly. (See list below.)
- We strongly suggest that you don’t call the GNU compilers directly if you are building code to run on the compute nodes.
The Cray wrappers cc, CC, and ftn will automatically link against MPI (-lmpi) and SciLib (-lsci). This is not true when calling the GNU compilers directly. See the cc, CC, and ftn man pages for more information on their usage.
To see man pages on GNU compilers with a full list of compiler options, first make sure the “PrgEnv-gnu” module is loaded, and then do a man on any of the following:
It is best to review the gcc, g++, and gfortran man pages for a list of their options. To use the Cray wrappers with the GNU compilers, the PrgEnv-gnu module should be loaded:
module avail PrgEnv module swap PrgEnv-pgi PrgEnv-gnu # this loads the current version of gcc
To just use the GNU compilers directly, just load the gcc module you want:
module avail gcc module load gcc/4.5.3 # Note that this does not change/update the Cray wrappers.
It is possible to use the GNU compiler versions directly without loading the Cray Programming Environments, but note that the Cray wrappers will probably not work as expected if you do that.
The following information is available by running
module help gcc
----------- Module Specific Help for 'gcc/4.9.0' ------------------ gcc 4.9.0 ========= Release Date: ------------- June 5, 2014 Purpose: -------- The gcc 4.9.0 release. The additional cray-set-gcc-libs rpm sets up the linking infrastructure for gnu shared libraries. The following bug is fixed in the gcc 4.9.0 release. 808706 NAMD GPU version segfaults when compiled with gcc/4.8.2 [GCC Bug 58800] Product and OS Dependencies: ---------------------------- The gcc 4.9.0 release is supported on the following Cray systems: * Cray XE and XK systems with CLE 4.2 and CLE 5.2. * Cray XC systems with CLE 5.1 and CLE 5.2. Limitations: -------------- gcc 4.9.0 is not supported with Cuda 5.5. The Cuda runtime header will show an error when compiling with nvcc. It is recommended to only install gcc 4.9.0 as non-default on XK systems for this reason. Documentation: -------------- http://gcc.gnu.org/gcc-4.9 Modulefile: --------------------- module load gcc/4.9.0 This modulefile defines the system paths and environment variables needed to use gcc, gfortran and g++ on Cray systems. The gcc modulefile can be swapped for other gcc versions. This modulefile may be loaded as a standalone modulefile or as part of the GNU Programming Environment, PrgEnv-gnu. The CrayPE drivers, cc, CC, and gfortran, are recommended for use with PrgEnv-gnu to generate compilation and link lines. The following modulefiles support the GNU 4.9.0 based Programming Environment: For Cray XE and XK systems: xt-asyncpe 5.27 or later For Cray XC systems: craype 2.1.2 or later For Cray XE, XK, and XC systems: cray-mpich 7.0.0 or later cray-libsci 13.0.0 or later libsci_acc 3.0.2 or later cray-tpsl 1.4.1 or later cray-petsc 18.104.22.168 or later cray-trilinos 22.214.171.124 or later cray-hdf5 1.8.13 or later cray-hdf5-parallel 1.8.13 or later cray-netcdf 4.3.2 or later cray-netcdf-hdf5parallel 4.3.2 or later cray-parallel-netcdf 1.4.1 or later cray-ga 126.96.36.199 or later fftw2 188.8.131.52 or later fftw 184.108.40.206 or later Installation instructions: -------------------------- rpm -ihv cray-set-gcc-libs-1.0.0-02.x86_64.rpm rpm -ihv cray-gcc-4.9.0-09.x86_64.rpm To change the product version to default after installation: /opt/cray/admin-pe/set_default_files/set_default_gcc_4.9.0 Certain components, files or programs contained within this package or product are Copyright -2014 Cray Inc. All rights reserved. =================================================================== To re-display gcc/4.9.0 release information, type: less /opt/gcc/4.9.0/release_info ===================================================================