Compilers#
Many commercial and open-source compilers fully support NVIDIA Vera and the Olympus CPU core in it. This section provides information about the available compilers, the recommended versions, and the recommended command-line options.
GNU Toolchain#
When using the GNU toolchain, we recommend GCC version 15.2 or later. Older versions of GCC that support AArch64 can be used on NVIDIA Vera, but because these older compilers target earlier Armv8-A architecture variants, the performance will be suboptimal. The latest and greatest binary versions of GNU toolchain can be found from your GNU/Linux distribution or downloaded using Spack.
Note
When possible, always use the latest version of GCC.
Even with the latest version of GCC, unless your toolchain has been configured and built for Vera, additional command-line options are necessary to generate optimal code for NVIDIA Vera. If no additional flags are provided, GCC will generate code targeting a generic Armv8-A CPU. The recommended flags are provided in the following table.
Note
More aggressive optimizations will trade floating point accuracy for performance.
Optimization Level |
Flags |
Notes |
|---|---|---|
Aggressive |
-Ofast -mcpu=olympus |
Enable fast math optimizations |
Moderate |
-O3 -mcpu=olympus |
Recommended in most cases |
The -mcpu=olympus flag is used in all cases. NVIDIA recommends that you
use the -mcpu flag instead of the -march and -mtune flags because
the -mcpu flag will select the CPU that you were targeting instead of
specifying the architecture with the required extensions using the -march
option and then specifying the -mtune option. Refer to
https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#aarch64-feature-modifiers
for more information about the features that can be turned on and off for each feature.
When compiling natively on an NVIDIA Vera GNU/Linux system we recommend that
you use the -mcpu=native flag. That will cause the compiler to autodetect
the host CPU and tune the code accordingly for that CPU.
The __sync built-ins in GNU C or GNU C++ are precursors to modern
atomic extensions that are used in the C11 / C++11 standards. These
built-ins are now considered legacy, and users should port the atomic
extensions in C11 / C++11. This is good advice for any platform, but it
is particularly relevant for CPUs that implement the AArch64 architecture
because the legacy __sync built-ins tend to enforce more strict
orderings than are necessary. Refer to
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html for
more information.
The C standard does not specify the signedness of the char type. On x86,
a char is assumed to be signed by default, and on Arm, char is assumed to
be unsigned. This difference can be addressed by using the standard int
types that specify signedness when the sign of a number is important (for
example, uint8_t and int8_t) or by compiling with the
-fsigned-char flag to set the signedness of char at compile time.
Refer to https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/AArch64-Options.html for more information about the command-line options that are required for the AArch64 target in GCC.
LLVM Clang and Flang Compilers#
When you use LLVM, we recommend LLVM version 21 or later. As with GNU compilers, we recommend that you use the latest compiler version available to you. LLVM compilers support AArch64 CPUs but mainly for C and C++ (the clang and clang++ commands). LLVM’s Fortran compiler (flang) is not yet widely used and is still maturing. Like the GNU compilers, Clang prioritizes portability over performance and, to enable optimization, additional flags must be added.
NVIDIA provides builds of LLVM Clang at developer.nvidia.com/grace/clang that are specially packaged for NVIDIA CPUs like Grace and Vera. These builds are mainline Clang that are configured to support Vera, so the builds can be used as a drop-in replacement for Clang in your current workflows. The following table provides information about the optimization levels and flags.
Optimization Level |
Flags |
Notes |
|---|---|---|
Aggressive |
-O3 -ffast-math -mcpu=olympus |
Enables fast math optimizations. |
Moderate |
-O3 -mcpu=olympus |
Recommended in most cases. |
Conservative |
-O3 -ffp-contract=off -mcpu=olympus |
Disables fused math operations. |
The -mcpu=olympus flag is used in all cases, and we recommend using
the -mcpu flag instead of the -march and -mtune flags.
When compiling natively on an NVIDIA Vera GNU/Linux system we recommend that
you use the -mcpu=native flag. That will cause the compiler to autodetect
the host CPU and tune the code accordingly for that CPU.
Arm Architecture Feature Support#
Like other major CPU architectures, there are instructions that cannot be reached directly by translating C/C++. These instructions are usually supported by the weight of compiler intrinsics and a set of feature macros that can be used in applications to test for the specific architecture extension support at compile time. The common set of intrinsics, additional data types, architectural feature macros, among others for the Arm architecture for compilers, are defined by the Arm C / C++ Language Extensions (ACLE). Refer to ARM-software/acle for more information.
A discussion on ACLE and intrinsics programming is out of scope for this document, and users should refer to it and their compiler documentation, for the compliance level.
NVIDIA Vera implements the Armv9.2-A architecture and several further architectural extensions. To see which Arm architectural features are enabled at compile time, run the following command:
gcc -dM -E -mcpu=olympus - < /dev/null | grep ARM_FEATURE
Here is an example of the output with GCC 15.2 on NVIDIA Vera:
$ gcc -dM -E -mcpu=olympus - < /dev/null | grep ARM_FEATURE | sort
#define __ARM_FEATURE_AES 1
#define __ARM_FEATURE_ATOMICS 1
#define __ARM_FEATURE_BF16 1
#define __ARM_FEATURE_BF16_SCALAR_ARITHMETIC 1
#define __ARM_FEATURE_BF16_VECTOR_ARITHMETIC 1
#define __ARM_FEATURE_BTI 1
#define __ARM_FEATURE_CLZ 1
#define __ARM_FEATURE_COMPLEX 1
#define __ARM_FEATURE_CRC32 1
#define __ARM_FEATURE_CRYPTO 1
#define __ARM_FEATURE_DOTPROD 1
#define __ARM_FEATURE_FAMINMAX 1
#define __ARM_FEATURE_FMA 1
#define __ARM_FEATURE_FP16_FML 1
#define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
#define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
#define __ARM_FEATURE_FP8 1
#define __ARM_FEATURE_FP8DOT2 1
#define __ARM_FEATURE_FP8DOT4 1
#define __ARM_FEATURE_FP8FMA 1
#define __ARM_FEATURE_FRINT 1
#define __ARM_FEATURE_IDIV 1
#define __ARM_FEATURE_JCVT 1
#define __ARM_FEATURE_LS64 1
#define __ARM_FEATURE_LUT 1
#define __ARM_FEATURE_MATMUL_INT8 1
#define __ARM_FEATURE_MEMORY_TAGGING 1
#define __ARM_FEATURE_NUMERIC_MAXMIN 1
#define __ARM_FEATURE_PAUTH 1
#define __ARM_FEATURE_QRDMX 1
#define __ARM_FEATURE_RCPC 1
#define __ARM_FEATURE_RNG 1
#define __ARM_FEATURE_SHA2 1
#define __ARM_FEATURE_SHA3 1
#define __ARM_FEATURE_SHA512 1
#define __ARM_FEATURE_SM3 1
#define __ARM_FEATURE_SM4 1
#define __ARM_FEATURE_SVE 1
#define __ARM_FEATURE_SVE2 1
#define __ARM_FEATURE_SVE2_AES 1
#define __ARM_FEATURE_SVE2_BITPERM 1
#define __ARM_FEATURE_SVE2_SHA3 1
#define __ARM_FEATURE_SVE2_SM4 1
#define __ARM_FEATURE_SVE_BF16 1
#define __ARM_FEATURE_SVE_BITS 0
#define __ARM_FEATURE_SVE_MATMUL_INT8 1
#define __ARM_FEATURE_SVE_VECTOR_OPERATORS 2
#define __ARM_FEATURE_UNALIGNED 1