Install FlagTree#

Option 1: Install from prebuilt Docker image#

For installing FlagTree on different backends from prebuilt Docker image, see the following list:

Option 2: Install from source#

  1. Clone FlagTree and enter the FlagTree directory.

    #    Clone the FlagTree project from the remote Git repository to local
    git clone https://github.com/flagos-ai/flagtree
    #    Switch the current working directory to the cloned FlagTree project directory
    cd flagtree
    
  2. Install Ubuntu and Python dependencies.

    # Install dependencies for Ubuntu
    apt install zlib1g zlib1g-dev libxml2 libxml2-dev  # ubuntu
    # Install dependencies for Python
    # The dependencies are included in the requirements.txt in the flagtree/python directory.
    cd python; python3 -m pip install -r requirements.txt
    
  3. Build and install FlagTree Below are the common commands used to build and install FlagTree. However, different backends have different requirements. For more information, see the “Install FlagTree for different backends” section.

    # Set FLAGTREE_BACKEND using the backend name from the table above
    export FLAGTREE_BACKEND=${backend_name}  # Do not set it on nvidia/amd/triton-shared
    
    # For Triton 3.1/3.2/3.3 (branch: main, triton_v3.2.x, triton_v3.3.x)
    cd python
    python3 -m pip install . --no-build-isolation -v  # Install flagtree and uninstall triton
    
    # For Triton 3.4/3.5/3.6 (branch: triton_v3.4.x, triton_v3.5.x, triton_v3.6.x)
    python3 -m pip install . --no-build-isolation -v  # Install flagtree and uninstall triton
    
  4. Verify FlagTree installation

    python3 -m pip show flagtree
    cd ${ANY_DIR_OTHER_THAN_FLAGTREE_PYTHON}; python3 -c 'import triton; print(triton.__path__)'
    

Option 3: Install wheel package#

If you do not wish to build from source, you can directly pull and install whl (partial backend support). The best practice to avoid environment compatibility issues is to use the image recommended in Tips for building.

  1. Install PyTorch

  2. Uninstall Triton

    python3 -m pip uninstall -y triton  # Repeat the cmd until fully uninstalled
    RES="--index-url=https://resource.flagos.net/repository/flagos-pypi-hosted/simple"
    
  3. Install FlagTree and Triton

    Backend

    Install command
    (The version corresponds to the git tag)

    Triton
    ver.

    libc.so &
    libstdc++.so

    nvidia

    python3.12 -m pip install flagtree===0.5.0 $RES

    3.6

    GLIBC_2.39
    GLIBCXX_3.4.33
    CXXABI_1.3.15

    nvidia

    python3.12 -m pip install flagtree==0.5.0+3.5 $RES

    3.5

    GLIBC_2.39
    GLIBCXX_3.4.33
    CXXABI_1.3.15

    nvidia

    python3.12 -m pip install flagtree==0.4.0+3.3 $RES

    3.3

    GLIBC_2.30
    GLIBCXX_3.4.28
    CXXABI_1.3.12

    nvidia

    python3.12 -m pip install flagtree==0.5.0+3.1 $RES

    3.1

    GLIBC_2.39
    GLIBCXX_3.4.33
    CXXABI_1.3.15

    iluvatar

    python3.12 -m pip install flagtree==0.5.1+iluvatar3.1 $RES

    3.1

    GLIBC_2.39
    GLIBCXX_3.4.33
    CXXABI_1.3.15

    iluvatar

    python3.10 -m pip install flagtree==0.5.1+iluvatar3.1 $RES

    3.1

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    mthreads

    python3.10 -m pip install flagtree==0.5.1+mthreads3.1 $RES

    3.1

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    mthreads

    python3.10 -m pip install flagtree==0.5.1+mthreads3.2 $RES

    3.2

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    mthreads

    python3.10 -m pip install flagtree==0.5.1+mthreads3.6 $RES

    3.6

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    xpu

    python3.10 -m pip install flagtree==0.5.1+xpu3.0 $RES

    3.0

    GLIBC_2.31
    GLIBCXX_3.4.28
    CXXABI_1.3.12

    metax

    python3.12 -m pip install flagtree==0.5.1+metax3.0 $RES

    3.0

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    hcu

    python3.10 -m pip install flagtree==0.5.1+hcu3.1 $RES

    3.1

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    hcu

    python3.10 -m pip install flagtree==0.5.1+hcu3.6 $RES

    3.6

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    ascend

    python3.11 -m pip install flagtree==0.5.0+ascend3.2 $RES

    3.2

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    tsingmicro

    python3.10 -m pip install flagtree==0.5.0+tsingmicro3.3 $RES

    3.3

    GLIBC_2.30
    GLIBCXX_3.4.28
    CXXABI_1.3.12

    aipu

    python3.10 -m pip install flagtree==0.5.0+aipu3.3 $RES

    3.3

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    sunrise

    python3.10 -m pip install flagtree==0.4.0+sunrise3.4 $RES

    3.4

    GLIBC_2.39
    GLIBCXX_3.4.33
    CXXABI_1.3.15

    enflame

    python3.10 -m pip install flagtree==0.4.0+enflame3.3 $RES

    3.3

    GLIBC_2.35
    GLIBCXX_3.4.30
    CXXABI_1.3.13

    enflame

    python3.12 -m pip install flagtree==0.5.0+enflame3.5 $RES

    3.5

    GLIBC_2.39
    GLIBCXX_3.4.33
    CXXABI_1.3.15

    enflame

    python3.12 -m pip install flagtree==0.5.0+enflame3.6 $RES

    3.6

    GLIBC_2.39
    GLIBCXX_3.4.33
    CXXABI_1.3.15

Historical versions of flagtree can be found at https://resource.flagos.net/#browse/search/pypi/=assets.attributes.pypi.description%3Dflagtree

Running tests#

After installation, you can generally run the following tests. For specific backend support tests, please refer to .github/workflow/${backend_name}-build-and-test.yml in the corresponding branch.

# nvidia/amd
cd python/test/unit
python3 -m pytest -s
# other backends
cd third_party/${backend_name}/python/test/unit
python3 -m pytest -s

Q&A#

Q: After installation, running the program reports: version GLIBC or GLIBCXX not found

A: Check which GLIBC / GLIBCXX versions are supported by libc.so.6 and libstdc++.so.6.0.30 in your environment:

strings /lib/x86_64-linux-gnu/libc.so.6 |grep GLIBC
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30 | grep GLIBCXX

If the required GLIBC / GLIBCXX version is supported, you can also try:

export LD_PRELOAD="/lib/x86_64-linux-gnu/libc.so.6"  # If GLIBC cannot be found
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30"  # If GLIBCXX cannot be found
export LD_PRELOAD="/lib/x86_64-linux-gnu/libc.so.6 \
    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30"  # If neither GLIBC nor GLIBCXX can be found