Skip to content

HPC Compilers

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 (formerly known as Portland Group, PGI) 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 helpdesk@chpc.utah.edu.

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 helpdesk@chpc.utah.edu.

GNU Compilers

The current default version is 8.5.0, which is shipped with Rocky Linux 8 that is run on our systems. For those needing newer version, we are installing newer versions as needed. 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 8.5.0 and provide limited stack for the higher versions based on demand.

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/8.5.0)

To load a version different from the default 8.5.0, load the appropriate module, e.g., for gcc 10.2.0, do:
module load gcc/10.2.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.

Intel Compilers

Multiple versions of the Intel C and Fortran compiler suite are available as modules either under the older intel name, or under the current  intel-oneapi-compilers name. 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 intel-oneapi-compilers 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-oneapi-compilers

The compilers are invoked as icc, icpc and ifort for C, C++ and F90, respectively. For list of available flags, use the man pages (e.g. man icc).

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.

Nvidia Compilers

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 Nvidia compilers are available as the nvhpc modules. 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).

To find the compiler version, use flag --version, i.e. nvc --version. The newest NVHPC version that supports all CHPC clusters is 21.5, which is the default. Newer versions are available, but, from 22.1, will only work on Notchpeak. As such, we are providing the usual libraries only for version 21.5, as this version is set to be the default version.

We generally recommend flag -fastsse for good performance.

Documentation including user's guide, language reference are available at the HPC compilers documentation.

 

 

Last Updated: 6/4/24