Taichi Lang on ROCm installation#
2025-12-09
4 min read time
System requirements#
To use Taichi Lang 1.8.0b1, you need the following prerequisites:
Install Taichi#
To install Taichi Lang on ROCm, you have the following options:
Use a prebuilt Docker image with Taichi Lang pre-installed#
Docker is the recommended method to set up a Taichi Lang environment, as it avoids potential installation issues. The tested, prebuilt image includes Taichi, Python, ROCm, and other dependencies.
Pull the Docker image:
docker pull rocm/taichi:taichi-1.8.0b1_rocm6.3.2_ubuntu22.04_py3.10.12
Launch and connect to the container:
docker run -it -d --network=host --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size 64G \ --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(pwd):/taichi_dir \ --name rocm_taichi rocm/taichi:taichi-1.8.0b1_rocm6.3.2_ubuntu22.04_py3.10.12
Use a wheels package#
The Taichi Lang .whl packages are hosted on the AMD PyPI repository.
Instead of manually downloading the files, you can simply install Taichi Lang using pip with the provided URL.
This command will automatically download and install the appropriate .whl file.
pip install amd-taichi==1.8.0b1 --extra-index-url=https://pypi.amd.com/simple
sudo apt-get update
sudo apt-get install -y lld
Build your own Docker image#
If you prefer to use the ROCm Ubuntu image, or already have a ROCm Ubuntu container, follow these steps to install Taichi in the container.
Pull the ROCm Ubuntu Docker image:
docker pull rocm/dev-ubuntu-22.04:6.3.2
Launch the Docker container:
docker run -it -d --network=host --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size 64G \ --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(pwd):/taichi_dir \ --name rocm_taichi rocm/dev-ubuntu-22.04:6.3.2 /bin/bash
Inside the running container, install build dependencies:
sudo apt-get update && apt-get install -y --no-install-recommends \ git wget vim \ freeglut3-dev libglfw3-dev libglm-dev libglu1-mesa-dev \ libjpeg-dev liblz4-dev libpng-dev libssl-dev \ libwayland-dev libx11-xcb-dev libxcb-dri3-dev libxcb-ewmh-dev \ libxcb-keysyms1-dev libxcb-randr0-dev libxcursor-dev libxi-dev \ libxinerama-dev libxrandr-dev libzstd-dev \ python3-pip cmake pybind11-dev ca-certificates \ llvm-15 clang-15 lld-15 \ && apt-get clean && rm -rf /var/lib/apt/lists/*
Add LLVM 15 to PATH:
export LLVM_DIR=/usr/lib/llvm-15 export PATH=${LLVM_DIR}/bin:$PATH
Clone the ROCm/taichi repository with the desired branch:
cd <working-directory> git clone --recursive https://github.com/ROCm/taichi -b amd-release/v1.8.0b1 cd taichi
Build the Taichi Lang wheel:
export GPU_TARGETS=gfx90a export TAICHI_CMAKE_ARGS="-DTI_WITH_VULKAN=OFF -DTI_WITH_OPENGL=OFF -DTI_BUILD_TESTS=ON -DTI_BUILD_EXAMPLES=OFF -DCMAKE_PREFIX_PATH=${LLVM_DIR}/lib/cmake -DCMAKE_CXX_COMPILER=${LLVM_DIR}/bin/clang++ -DTI_WITH_AMDGPU=ON -DTI_WITH_CUDA=OFF -DTI_AMDGPU_ARCHS=${GPU_TARGETS}" ./build.py
Install the Taichi Lang
.whlfile:pip3 install <taichi-src-dir>/dist/taichi*.whl
Test the Taichi Lang installation#
Clone the ROCm/taichi repository:
sudo apt-get update
sudo apt-get install -y git
git clone --recursive https://github.com/ROCm/taichi -b amd-release/v1.8.0b1
To test the Taichi Lang installation, run the laplace example in the source code:
python3 taichi/python/taichi/examples/algorithm/laplace.py
Example output using laplace:
[Taichi] version 1.8.0, llvm 15.0.0, commit f7911653, linux, python 3.10.12
[Taichi] Starting on arch=amdgpu
0.0
4.0
0.0
0.0
4.0
0.0
0.0
4.0
0.0
0.0
Run a Taichi Lang example#
A set of examples is available to help you get started. See run a Taichi Lang example for more details.