19.7.4. CMake Options for Build Performance - 19.7.4. CMake Options for Build Performance - 5.3 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2026-05-13
Version
5.3 English

The following table lists the CMake variable used to control parallel build performance.

Table 19.4 CMake Variables for Build Performance#
CMake Variable or Option
Usage
BUILD_CORES
-DBUILD_CORES=<number> to specify the number of CPU cores to
use for parallel builds. If not specified (empty), automatically
uses 50% of available cores to balance performance and memory usage.

BUILD_CORES Usage

  • Auto (Default): If BUILD_CORES is not specified or empty, the build system automatically detects available CPU cores and uses 50% of them for parallel compilation. This prevents memory exhaustion on systems with many cores.

  • User-Specified: Provide an exact number to use a specific core count (e.g., -DBUILD_CORES=8). The build system (make) will handle any invalid value appropriately.

Examples

# Use default (50% of available cores)
$ cmake --preset aocl-linux-make-lp-ga-gcc-config --fresh

# Use 8 cores for compilation
$ cmake --preset aocl-linux-make-lp-ga-gcc-config -DBUILD_CORES=8 --fresh

# Use all available cores (assumes 16 cores available)
$ cmake --preset aocl-linux-make-lp-ga-gcc-config -DBUILD_CORES=16 --fresh

# Use single core (for debugging or low-memory systems)
$ cmake --preset aocl-linux-make-lp-ga-gcc-config -DBUILD_CORES=1 --fresh

Note

This option is particularly useful on high-core-count systems where using all cores simultaneously may cause memory issues during compilation of large libraries.