CHPC actively supports several different compilers. We support the GNU Compiler Suite, which includes ANSI C, C++ and Fortran 77 compilers. In addition to GNU compilers, we offer two commercial compiler suites. The Intel oneAPI compilers generally provide superior performance on the Intel CPUs. They include C, C++, Fortran 77/90/95, and Data Parallel C++. The Nvidia HPC compilers also support C, C++ and Fortran, as well as CUDA and OpenACC for GPU programming. All three compilers have OpenMP support (supported OpenMP version varies with the compiler).
All three C compilers interoperate with each other, although we only allow one compiler
to be active at the time, in order to keep the software stack consistent. Interoperation
with Fortran is more difficult, with separate libraries having the ability to be linked
if one also links the apropriate compiler Fortran runtime library (e.g.
-lgfortran for gfortran), but on the module level the compilers are not compatible. Therefore
we recommend using only a single Fortran compiler for the whole code if possible.
We do have other compilers, such as LLVM, though, we don't actively update them. If you need an update, please let us know at firstname.lastname@example.org.
To enable each compiler, and the software stack that was built with this compiler, one needs to load the compiler module as described below. When using the compiler, you may need to modify or set flags for makefiles or other build tools (e.g. CMake) provided by third party developers. Note that CHPC only allows one compiler module to be loaded at a time.
For help with compiler issues, please contact the CHPC help desk at email@example.com.
The current default version is 4.8.5, which is shipped with CentOS 7 that is run on
our systems. For those needing newer version, we have installed multiple other versions
in /uufs/chpc.utah.edu/sys/installdir/gcc. Run
module spider gcc to get a list of available versions. Note that different versions may have different
software stack built with them. In general, we build most of the dependencies with
the stock gcc 4.8.5 and provide limited stack for the higher versions based on demand.
CentOS 7 ships with version 4.8.5, however, some advanced compiler features, such as C++11 standard, are supported only from 4.9 series, therefore a number of third party software is built with gcc 4.9.2 or newer.
The system GNU distribution is located in the default areas: /usr/bin, /usr/lib or /usr/lib64 for libraries, /usr/include for headers, etc. The user should not need to do anything else than to invoke the compiler by its name:
gcc source.c -o executable
gfortran source.f -o executable
In order to also make available the libraries and binaries built with gcc 4.8.5, one
does need to load the (default) module:
module load gcc (or module load gcc/4.8.5)
To load a version different from the default 4.8.5, load the appropriate module, e.g.,
for gcc 8.1.0, do:
module load gcc/8.1.0
You can also put the above module load in your .custom.sh or .custom.csh shell init file so that the appropriate compiler is loaded upon login.
Documentation on the GNU compilers can be found at the GCC site.
Multiple versions of the Intel C and Fortran compiler suite are located at /uufs/chpc.utah.edu/sys/installdir/intel.
To find the default compiler version, use the -v flag (ie, icc -v, ifort -v, or icpc -v). Older version can be obtained by loading the particular module, run
module spider intel to find the versions available.
In order to use the compiler, users have to load the module that defines paths and some other environment variables.
module load intel
The compilers are invoked as icc, icpc and ifort for C, C++ and F90, respectively. For list of available flags, use the man pages
We generally recommend flag -fast for superior performance, however, some of the optimizations using this flag may
lose precision for floating-point divides. Also note that one can build optimized
executable that runs multiple CPU architectures, for CHPC clusters use
-axCORE-AVX512,CORE-AVX2,AVX. See our Single Executable page for details. This option runs but does not generate vectorized code for some
Lonepeak nodes. As of version 18 we have seen issues with compiling more complex code
with the wider encompassing
-axCORE-AVX512,CORE-AVX2,AVX,SSE4.2 option which does vectorize on Lonepeak. Therefore our recommendation is to try
to compile including the
SSE4.2 option and if there are problems, remove it. The code will still run on Lonepeak,
but utilize the generic x86 code path which is included whenver the
-ax option is used.
Intel has rebranded its compiler and software development suite as Intel oneAPI at the end of 2020. While the original functionality remains the same, some libraries that in the past were bundled with the compiler suite, like the Math Kernel Library (MKL), are now separate packages that are available as separate modules. For more information on this and all the tools available through the oneAPI Toolkit,visit our Intel oneAPI page, or the Intel oneAPI site.
Documentation including user's guide, language reference, etc. can be found in the Intel Software Documentation Library.
In the Fall 2020, Nvidia relased the High Performance Computing (HPC) Software Development Kit (SDK), which combines former Portland Group compilers with Nvidia CUDA compiler. The Nvidia HPC SDK compilers thus replace both the PGI and the CUDA compilers.
The latest version of Nvidia compilers are located at: /uufs/chpc.utah.edu/sys/installdir/nvidia.
To find the compiler version, use flag --version, i.e. nvc --version.
In order to use the compiler, users have to load the module that defines paths and some other environment variables. The default usually points to the latest version.
module load nvhpc
The compilers are invoked as nvc, nvc++, nvfortran for C, C++, and Fortran, or old PGI names, e.g. pgcc, pgc++ and pgfortran. The CUDA compiler's name remains the same as nvcc. For list of available flags, use the man pages (e.g. man nvc).
We generally recommend flag -fastsse for good performance.
Documentation including user's guide, language reference are available at the HPC compilers documentation.