17.1.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

Complete the following steps to build different packages of the library, including dependencies and test application:

  1. Install AOCL-BLAS, AOCL-LAPACK, and AOCL-Utils.

  2. Define the environment variable AOCL_ROOT to point to AOCL Libs installation:

    $ export AOCL_ROOT=/opt/aocl
    

    For the case where AOCL_ROOT cannot be exported by placing AOCL-BLAS, AOCL-LAPACK, and AOCL-Utils libraries in the same path, you can use the following variables during the CMake configuration to point to the location of the dependent libraries and headers:

    • AOCL_BLIS_LIB

    • AOCL_LIBFLAME

    • AOCL_UTILS_LIB

    • AOCL_BLIS_INCLUDE_DIR

    • AOCL_LIBFLAME_INCLUDE_DIR

    • AOCL_UTILS_INCLUDE_DIR

  3. Download the latest release of AOCL-Sparse (amd/aocl-sparse),

    or

    Clone the Git repository (amd/aocl-sparse.git).

  4. Configure the project using the following tables:

    Table 17.1 Compiler and Library Type#

    Compiler

    Library Type

    ILP 64 Support

    Command

    G++ (Default)

    Static

    OFF (Default)

    cmake -S . -B out_sparse -DBUILD_SHARED_LIBS=OFF

    ON

    cmake -S . -B out_sparse -DBUILD_SHARED_LIBS=OFF -DBUILD_ILP64=ON

    Shared (Default)

    OFF (Default)

    cmake -S . -B out_sparse

    ON

    cmake -S . -B out_sparse -DBUILD_ILP64=ON

    AOCC

    Static

    OFF (Default)

    cmake -S . -B out_sparse -DCMAKE_CXX_COMPILER=clang++ -DBUILD_SHARED_LIBS=OFF

    ON

    cmake -S . -B out_sparse -DCMAKE_CXX_COMPILER=clang++ - DBUILD_SHARED_LIBS=OFF -DBUILD_ILP64=ON

    Shared (Default)

    OFF (Default)

    cmake -S . -B out_sparse -DCMAKE_CXX_COMPILER=clang++

    ON

    cmake -S . -B out_sparse -DCMAKE_CXX_COMPILER=clang++ -DBUILD_ILP64=ON

    Table 17.2 AOCL-Sparse - CMake Build Options#

    Build Option

    Feature

    CMAKE_INSTALL_PREFIX

    Use -DCMAKE_INSTALL_PREFIX=<path> to choose the custom path. The default install path is /opt/aoclsparse/

    CMAKE_BUILD_TYPE

    • Release => Release Library (Default)

    • Debug => Debug Library

    CMAKE_CXX_COMPILER

    Use -DCMAKE_CXX_COMPILER=clang++ for AOCC builds

    BUILD_SHARED_LIBS

    • OFF => Build Static Library

    • ON => Build Dynamic/Shared library (Default)

    BUILD_ILP64

    Integer length:

    • OFF => 32-bit integer length (Default)

    • ON => 64-bit integer length

    SUPPORT_OMP

    Multi-threading using OpenMP:

    • OFF => Disable OpenMP

    • ON => Enable OpenMP (Default)

    USE_AVX512

    • OFF => Disables AVX512 kernel support

    • ON => Enables AVX512 kernel support (Default)

    BUILD_CLIENTS_BENCHMARKS

    • OFF => Disable building benchmarks (Default)

    • ON => Build benchmark framework (requires Boost library)

    BUILD_CLIENTS_SAMPLES

    • OFF => Disable building sparse API examples

    • ON => Enable building sparse API examples (Default)

    BUILD_UNIT_TESTS

    • OFF => Unit tests are not built

    • ON => Unit tests are built and target test is activated. This target should be used to test the correctness of the compiled library (requires GTest)

    BUILD_DOCS

    • OFF => No documentation target is activated. (Default)

    • ON => Build PDF and HTML API documentation, this adds targets docs, doc_html and doc_pdf (requires Linux and modern LaTeX distribution). Uses latest rocm-docs-core python package (python3 -m pip install --upgrade rocm-docs-core==<version-number>)

  5. Build the AOCL-Sparse library:

    $ cmake --build out_sparse --config <build_type> --parallel <nproc>
    

    where,

    • build_type can be Release/Debug as configured during configuration.

    • nproc is the number of cores for the build to run in parallel.

  6. Install AOCL-Sparse to the directory /opt/aoclsparse or a custom path given by CMAKE_INSTALL_PREFIX:

    cmake --build out_sparse --target install
    

Note

If AOCL_ROOT contains the shared and static libraries in the same directory for any dependent library, Sparse will link to the library according to BUILD_SHARED_LIBS preference with fallback option to the appropriate library avaiable (static or shared).