Build ROCm ThunderGBM from source

Build ROCm ThunderGBM from source#

2025-12-15

2 min read time

Applies to Linux

Prerequisites#

Before proceeding, ensure that you have installed a supported ROCm version, operating system, and Python environment that are compatible with the ROCm Finance libraries. Verify that your system includes a supported AMD Instinct GPU. For guidance, see ROCm finance installation prerequisites.

For a consistent and streamlined setup experience, it’s recommended to use a ROCm development environment Docker container. See Install ROCm Finance for instructions.

Build from source#

  1. Install required software dependencies.

    apt-get update && apt-get install -y --no-install-recommends  git libomp-dev python3-venv curl ca-certificates gpg wget
    wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
    apt-get update && apt-get install -y --no-install-recommends cmake
    
  2. Clone the ROCm/thundergbm source code from GitHub.

    git clone --recurse-submodules https://github.com/rocm/thundergbm.git
    
  3. Create and activate a Python virtual environment.

    python -m venv thundergbm-build
    source thundergbm-build/bin/activate
    
  4. Build the shared object library.

    # Set the GPU target
    export AMDGPU_TARGETS="gfx942"
    export CMAKE_PREFIX_PATH=/opt/rocm/lib/cmake/
    export CMAKE_MODULE_PATH=/opt/rocm/lib/cmake
    export CMAKE_POLICY_VERSION_MINIMUM=3.5
    export CMAKE_C_COMPILER=hipcc
    export CMAKE_CXX_COMPILER=hipcc
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib/llvm/lib/
    export LDFLAGS="-L/opt/rocm/lib -Wl,-rpath,/opt/rocm/lib"
    
    cd thundergbm
    cmake -S . -B build
    cmake --build build -- -j 8
    
  5. Build and install the Python package.

    cd python
    pip install setuptools
    python setup.py bdist_wheel
    pip install dist/amd_thundergbm.whl
    
  6. Verify the installation.

    pip show -v amd_thundergbm
    
    Example output
    Name: amd_thundergbm
    Version: 0.3.16
    Summary: A Fast GBM Library on GPUs and CPUs with ROCm support
    Home-page: https://github.com/rocm/thundergbm
    Author: Xtra Computing Group
    
  7. Run the Python examples.

    cd examples
    LD_PRELOAD="/opt/rocm/lib/llvm/lib/libomp.so" python ranking_demo.py
    LD_PRELOAD="/opt/rocm/lib/llvm/lib/libomp.so" python classification_demo.py
    LD_PRELOAD="/opt/rocm/lib/llvm/lib/libomp.so" python regression_demo.py