8.2.2. Building from Source on Linux - 5.2 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2025-12-29
Version
5.2 English

AOCL-DLP uses CMake for its build system. For detailed build instructions including system requirements, configuration options, and platform-specific setup, refer to the BUILD.md file in the repository.

Quick Build Steps:

$ git clone https://github.com/amd/aocl-dlp.git
$ cd aocl-dlp
$ mkdir -p build && cd build
$ cmake ..
$ make -j$(nproc)

Build Configuration Options:

AOCL-DLP provides extensive build configuration options:

Table 8.1 Build Configuration Matrix#

Option

Default

Description

General Build Options

BUILD_EXAMPLES

OFF

Build example programs

BUILD_BENCHMARKS

OFF

Build benchmark programs

BUILD_TESTING

OFF

Build test programs (requires DLP_TESTING_CTEST_DISABLED=OFF for CTest)

BUILD_DOXYGEN

OFF

Build Doxygen documentation

BUILD_SPHINX

OFF

Build Sphinx documentation

CMAKE_EXPORT_COMPILE_COMMANDS

OFF

Generate compile_commands.json for tooling

CMAKE_BUILD_TYPE

Release

Build type (Release, Debug, RelWithDebInfo, Coverage)

CMAKE_INSTALL_PREFIX

/usr/local

Installation directory

Compiler Options

CMAKE_CXX_COMPILER

system

Specify C++ compiler (e.g., g++)

CMAKE_C_COMPILER

system

Specify C compiler (e.g., gcc)

Threading & Sanitizers

DLP_THREADING_MODEL

none

Threading model (none, openmp, pthread)

DLP_ENABLE_OPENMP

ON

Override OpenMP support (auto-enabled by threading model)

DLP_OPENMP_ROOT

β€œβ€

Custom path to OpenMP installation

DLP_USE_LLVM_OPENMP

OFF

Force using LLVM OpenMP implementation

DLP_ENABLE_ASAN

OFF

Enable AddressSanitizer

DLP_ENABLE_TSAN

OFF

Enable ThreadSanitizer

DLP_ENABLE_UBSAN

OFF

Enable UndefinedBehaviorSanitizer

DLP_TESTING_CTEST_DISABLED

ON

Disable CTest integration (set to OFF to enable with BUILD_TESTING)

Testing Options

DLP_TESTING_LINK_STATIC

OFF

Link tests with static AOCL-DLP library for better performance

DLP_TESTING_ENABLE_HIGH_PRECISION_FLOAT

OFF

Enable high precision float (double) support for tests

DLP_TESTING_ENABLE_DETAILED_DEBUG

OFF

Enable detailed debug information for tests

Benchmarking Options

DLP_BENCHMARKS_LINK_STATIC

OFF

Link benchmarks with static AOCL-DLP library for better performance

Build Target Options

DLP_EXAMPLES_LINK_STATIC

OFF

Link examples with static AOCL-DLP library for better performance

Advanced Options

DLP_ENABLE_LOGGING

OFF

Enable logging support for debugging (use AOCL_ENABLE_LPGEMM_LOGGER at runtime; requires DLP_ENABLE_LOGGING=ON at build time)

Common Configuration Examples:

# Basic build with testing
$ cmake -B build -DBUILD_TESTING=ON -DDLP_TESTING_CTEST_DISABLED=OFF

# Build with benchmarks and OpenMP threading
$ cmake -B build -DBUILD_BENCHMARKS=ON -DDLP_THREADING_MODEL=openmp

# Debug build with sanitizers
$ cmake -B build -DCMAKE_BUILD_TYPE=Debug -DDLP_ENABLE_ASAN=ON

# Release build with specific compiler
$ cmake -B build -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Release

Using Ninja Generator (Recommended):

For faster incremental builds, use the Ninja generator:

# Configure with Ninja generator
$ cmake -G Ninja -B build

# Build with Ninja (automatically uses all cores)
$ ninja -C build

# Or traditional approach
$ cd build && ninja

Installation:

After building, install AOCL-DLP system-wide or to a custom location:

# Install to default location (/usr/local)
$ sudo make install

# Or install to custom prefix
$ cmake -DCMAKE_INSTALL_PREFIX=$HOME/local/aocl-dlp ..
$ make -j$(nproc)
$ make install  # No sudo needed for user-local install