AMD optimizing CPU libraries (AOCLs) are a set of numerical libraries that are optimized for AMD processors based on the Zen microarchitectures. Currently, Aitken contains AMD Rome (Zen 2) and Milan (Zen 3) processors. AOCL 3.x provides performance improvements for Zen 3 processors, such as Milan.
Detailed information about different AOCL numerical libraries can be found in various chapters of the AMD AOCL User Guide.
The AOCL 4.2.0 release includes the following libraries:
AOCL-BLAS
Basic Linear Algebra Subprograms; developed as a forked version of BLIS.
AOCL-LAPACK
Linear Algebra PACKage for dense matrix computations; based on libFLAME.
AOCL-FFTW
Fastest Fourier Transform in the West for computing Discrete Fourier Transform.
AOCL-libM
Includes many elementary math functions from the C99 standard (‑std=c99), optimized for x86‑64 processor based machines.
AOCL-ScaLAPCK
Includes high-performance linear algebra routines for parallel distributed memory machines; depends on BLAS and LAPACK for linear algebra computations.
AOCL-RNG
AMD Random Number Generator.
AOCL-SecureRNG
Provides APIs to access the cryptographically secure random numbers generated by the AMD hardware random number generator.
AOCL-Sparse
Includes basic linear algebra subroutines for sparse matrics and vectors optimized for AMD Zen-based CPUs.
AMD's optimized implementation of cryptographic functions.
AOCL-Compression
A software framework of various lossless data compression and decompression methods tuned and optimized for AM Zen-based CPUs.
AOCL-Utils
Provides APIs to check the available CPU features/flags, cache topology, etc., of AMD Zen-based CPUs.
Many of the AOCL libraries support the following features. For more information specific to each library, see the AMD AOCL User Guide (Table 1 and various chapters).
AVX512
Supports this feature in the Zen 4 microarchitecture.
Dynamic Dispatcher
Supports AMD Zen, Zen2, Zen3, and Zen4 architectures in a single binary. At runtime, this feature enables optimizations specific to the detected Zen architecture. When an unknown processor is detected, the slow "generic" code path will be used.
Vector
Has vector variants for some functions in the library.
Multi-threaded
Provides mutli-threaded support.
Precision
Provides various precisions such as single, double, complex, double complex, mixed precision, and so on.
AOCL 4.2.0 has been validated by AMD for use on:
Compilers
gcc 12.2 and 13.1; aocc 4.1 and 4.2; llvm 15 and 16.
Library
glibc 2.28 and 2.35; OpenSSL 3.0.0 through 3.0.5.
MPI
Linux OpenMPI 4.1.5.
Programming Language
Python 3.4, 3.6, 3.9 and 3.9; Perl 5.14 and 5.34.
Build Utilities
GNU Make 4.3; CMake 3.20.2, 3.22.1 and 3.26.2.
AOCL Usage:
Complete these steps to use AOCL.
Load an AOCL modulefile.
AMD provides two sets of AOCL pre-built binaries, one compiled with AOCC compiler and the other compiled with GCC:
% module use -a /nasa/modulefiles/testing
% module avail aocl
--- /nasa/modulefiles/testing ---
aocl/4.2.0_aocc aocl/4.2.0_gcc
% module load aocl/4.2.0_aocc
After one of these modulefiles is loaded, the following environment variables are modified to include the appropriate paths to the AOCL libraries and header files:
LIBRARY_PATH
LD_LIBRARY_PATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
For example, for AOCL 4.2, the path to the AMD library (path-to-amd-library) is added to LIBRARY_PATH and LD_LIBRARY_PATH. The path will be either /nasa/amd/aocl-linux-aocc-4.2.0/4.2.0/aocc/lib or /nasa/amd/aocl-linux-gcc-4.2.0/4.2.0/gcc/lib, depending on the modulefile loaded.
AOCL libraries support two integer types: 32 bit (LP64) and 64 bit (ILP64). The default, LP64, is used on NAS systems. If you need 64-bit integer support, you can download (either source or pre-built binaries) and install AOCL in your own directory, as instructed in the AMD AOCL User Guide.
Note: You can build from source for all AOCL libraries except AOCL-RNG and AOCL-SecureRNG, which can only be installed from pre-built binaries.
Include the appropriate AOCL header file in your application.
For example, a C code calling BLAS routines should use #include "blis.h".
Check the examples available in the path-to-amd-library/amd-xxx/examples directory (where amd-xxx represents one of the AOCL libraries) to learn which header files are needed.
Compile your application, and link with the appropriate AOCL library.
Basic instructions for some of the libraries are included here. For more information specific to each library, see the AMD AOCL User Guide.
AOCL-BLAS
Single-threaded with static linking: path-to-amd-library/libblis.a -lm -lpthread
Single-threaded with dynamic linking: -Lpath-to-amd-library -lblis -lm -lpthread
Multi-threaded with static linking: path-to-amd-library/libblis-mt.a -lm -fopenmp
Multi-threaded with dynamic linking: -Lpath-to-amd-library -lblis-mt -lm -fopenmp
When using a multi-threaded library during runtime, set the environment variable BLIS_NUM_THREADS (takes precedence) or OMP_NUM_THREADS.
AOCL-LAPACK
When linking AOCL-LAPACK, you also need to link with AOCL-BLAS and AOCL-Utils. For example:
This library includes scalar functions (libalm) and the faster but less accurate versions of some of the scalar functions (libalmfast).
When accessing functions in libalmfast, be sure to link libalmfast before libalm. In addition, the AOCL-LibM Linux libraries may have a dependency on the system math library. When linking AOCL-LibM, ensure that it precedes the system math library in the link order—that is, -lalm must appear before -lm.
AOCL-LibM also includes vector variants for many of the core math functions. They can be enabled by using the AOCC compiler with the -ffast-math -fveclib=AMDLIBM flags.
AOCL-RNG
AOCL-RNG (librng_amd) depends on AOCL-LibM and AOCL-BLAS. In addition to linking with librng_amd, you also need to link with libamdlibm (a symlink to libalm) and libblis.
AOCL-Sparse
AOCL-Sparse (libaoclsparse) depends on libflame, libblis, and libaoclutils, in that order.
AOCL-Sparse provides multi-thread support through OpenMP by default. To use it, add -fopenmp when building your application and set the environment variable AOCLSPARSE_NUM_THREADS (recommended and takes precedence) or OMP_NUM_THREADS.