Skip to content

User manual for ppu

zhzhcookie edited this page Aug 6, 2026 · 3 revisions

💫 T-Head(平头哥)ppu3.6

  • Based on Triton 3.6, x64
  • Available for 810E

1. Build and run environment

1.1 Use the image (810E)

If your network connection is available, you do not need to perform the later step 1.x, because dependencies will be fetched automatically during the build.

# Plan A: docker pull (40.3GB)
IMAGE=harbor.baai.ac.cn/flagtree/flagtree-ppu-py312-torch2.10.0-sdk2.1.0-cu130-ubuntu24.04:202607-3.6-base
docker pull ${IMAGE}
# Plan B: docker load (17GB)
IMAGE=flagtree-ppu-py312-torch2.10.0-sdk2.1.0-cu130-ubuntu24.04:202607-3.6-base
wget https://baai-cp-web.ks3-cn-beijing.ksyuncs.com/trans/flagtree-ppu-py312-torch2.10.0-sdk2.1.0-cu130-ubuntu24.04.202607-3.6-base.tar.gz
docker load -i flagtree-ppu-py312-torch2.10.0-sdk2.1.0-cu130-ubuntu24.04.202607-3.6-base.tar.gz
CONTAINER=flagtree-dev-xxx
devices=()
for i in {0..15}; do
  devices+=(--device=/dev/alixpu_ppu$i)
done
docker run -dit \
    --network=host \
    --device=/dev/alixpu \
    --device=/dev/alixpu_ctl \
    "${devices[@]}" \
    -v /etc/localtime:/etc/localtime:ro \
    -v /home:/home \
    -w /root --name ${CONTAINER} ${IMAGE} bash
docker exec -it ${CONTAINER} /bin/bash

1.2 Manually download the LLVM

RES="--index-url=https://resource.flagos.net/repository/flagos-pypi-hosted/simple"
python3.12 -m pip install mlir $RES

1.3 Manually download the Triton dependencies

The Triton dependencies are already downloaded and installed in the image. If you do not want to build FlagTree or Triton from source, you do not need to download the Triton dependencies.

cd ${YOUR_CODE_DIR}/FlagTree
# For Triton 3.6 (x64)
wget https://baai-cp-web.ks3-cn-beijing.ksyuncs.com/trans/build-deps-triton_3.6.x-linux-x64.tar.gz
sh python/scripts/unpack_triton_build_deps.sh ./build-deps-triton_3.6.x-linux-x64.tar.gz

After executing the above script, the original ~/.triton directory will be renamed, and a new ~/.triton directory will be created to store the pre-downloaded packages. Note that the script will prompt for manual confirmation during execution.

2. Installation Commands

2.1 Source-free Installation

# Note: First install PyTorch, then execute the following commands
python3 -m pip uninstall -y triton  # Repeat the cmd until fully uninstalled
RES="--index-url=https://resource.flagos.net/repository/flagos-pypi-hosted/simple"
python3.12 -m pip install flagtree===0.6.1a1+ppu3.6 $RES

After installing flagtree, you can check it with:

python3 -m pip show flagtree

2.2 Build from Source

cd ${YOUR_CODE_DIR}/FlagTree
git checkout main
export FLAGTREE_BACKEND=ppu
MAX_JOBS=32 python3 -m pip install . --no-build-isolation -v

3. Testing and validation

Refer to Tests of ppu3.6 backend

Clone this wiki locally