|
Article ID: 691
Last updated: 13 Jan, 2026
The AMD Optimizing C/C++ and Fortran Compiler (AOCC) is highly optimized for x86 targets, especially for AMD Zen architecture-based processors. AOCC leverages LLVM, a project that includes a collection of modular and reusable compiler and toolchain technologies. With LLVM, converting a source code to a machine code (object code) for a specific processor involves three phases:
AOCC is a proprietary fork of LLVM+Clang, with changes to improve performance for processors based on the AMD Zen microarchitectures. For example, AOCC version 4.2 is based on LLVM version 16.0.3. AOCC 4.2 supports the following standards:
AOCC UsageMultiple versions of AOCC are installed on NAS systems. We recommend using the latest version. Load an AOCC ModulefileAfter one of the modules is loaded, the environment variables PATH, LIBRARY_PATH, LD_LIBRARY_PATH, C_INCLUDE_PATH, and CPLUS_INCLUDE_PATH are modified. You can load an AOCC modulefile as follows:
Compile and Link using the Clang, Clang++, or Flang Compiler DriverUse one of the following command lines:
A few command-line options are provided here:
You can find a list of command-line options on the Clang help page (clang --help) or in Chapter 5: Command-line Options in the AMD AOCC User Guide. Additional options can be found in Compiler Options Quick Reference Guide for Zen 3 and Zen 4 processors. Link to an AMD AOCL LibrarySome applications might perform better on the AMD Zen processors when they use AOCL, rather than using other scientific and math libraries from other sources. For more information, see AMD Optimizing CPU Libraries (AOCL). Link to an MPI LibraryHPE MPTHPE MPT provides the wrapper scripts mpicc, mpicxx, and mpif90 for compiling and linking MPI applications. Each of the scripts detects which compilers are available in your environment, and uses the first one it finds when checking against a list of compilers included in the script. With the module mpi-hpe/mpt.2.2825Apr23_rhe187, the list of precedence for the mpif90 script is {ifort openf90 pgf90 pgf95 lf95 gfortran}. For mpicc and mpicxx scripts, the only choice in the list is gcc and g++. In order to use an AOCC compiler with these wrapper scripts, you must set some environment variables, as shown below. You can use the option -show of these wrapper scripts to find out which compiler is chosen.
OpenMPIOpenMPI provides the wrapper compilers mpicc, mpic++ (or mpicxx, mpiCC), and mpifort for compiling and linking MPI applications. The legacy wrappers mpif77 and mpif90 still exist, but are symbolic links to mpifort. The compilers used by these wrappers default to the compilers used to build the OpenMPI library. After loading an OpenMPI module, you can run one of these commands to find the compilers used: ompi_info, mpicc --showme, mpic++ --showme, or mpifort --showme . When building your application with an AOCC compiler and an OpenMPI library, the OpenMPI library that you use should be one that is also built with the AOCC compiler. This is especially true if your application is written in Fortran. For applications written in C, you may be able to compile with an AOCC compiler and link with an OpenMPI library built with a different compiler, as shown below:
References |