[MUSA] Add installation guide and Dockerfile (#36709)
Co-authored-by: zhiguo.qin <zhiguo.qin@mthreads.com> Co-authored-by: Kangyan-Zhou <zky314343421@gmail.com>
This commit is contained in:
co-authored by
zhiguo.qin
Kangyan-Zhou
parent
707da81e84
commit
39a80354aa
@@ -4,7 +4,20 @@ metatags:
|
||||
description: "Run SGLang on Moore Threads GPUs."
|
||||
---
|
||||
|
||||
This document describes how run SGLang on Moore Threads GPUs. If you encounter issues or have questions, please [open an issue](https://github.com/sgl-project/sglang/issues).
|
||||
This document describes how to run SGLang on Moore Threads GPUs. If you
|
||||
encounter issues or have questions, please [open an issue](https://github.com/sgl-project/sglang/issues).
|
||||
|
||||
SGLang uses the MUSA runtime through
|
||||
[`torch_musa`](https://github.com/MooreThreads/torch_musa) and
|
||||
[`torchada`](https://github.com/MooreThreads/torchada). The
|
||||
`python[all_musa]` extra installs the MUSA torch, Triton, TileLang, MATE, and
|
||||
runtime Python stack from the Moore Threads package index, with public PyPI as
|
||||
the fallback for common Python dependencies.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Install the Moore Threads driver and MUSA toolkit before installing SGLang. For
|
||||
MTT S5000, follow the [official driver installation guide](https://docs.mthreads.com/driver-linux-server/driver-linux-server-doc-online/MTT_S5000/install_guide).
|
||||
|
||||
## Install SGLang
|
||||
|
||||
@@ -12,18 +25,92 @@ You can install SGLang using one of the methods below.
|
||||
|
||||
### Install from Source
|
||||
|
||||
```bash
|
||||
# Use the default branch
|
||||
Start from an environment with the prerequisites above installed.
|
||||
|
||||
```bash Command
|
||||
git clone https://github.com/sgl-project/sglang.git
|
||||
cd sglang
|
||||
|
||||
# Compile sgl-kernel
|
||||
pip install --upgrade pip
|
||||
cd python/sglang/kernels/aot
|
||||
python setup_musa.py install
|
||||
python -m pip install --upgrade pip "setuptools<82" wheel
|
||||
cp python/pyproject_other.toml python/pyproject.toml
|
||||
python -m pip install -e "python[all_musa]" \
|
||||
--index-url https://dl.mthreads.com/repo/api/pypi/pypi/simple \
|
||||
--extra-index-url https://pypi.org/simple \
|
||||
--trusted-host dl.mthreads.com \
|
||||
--no-build-isolation
|
||||
|
||||
# Install sglang python package along with diffusion support
|
||||
cd ../../../..
|
||||
rm -f python/pyproject.toml && mv python/pyproject_other.toml python/pyproject.toml
|
||||
pip install -e "python[all_musa]"
|
||||
# Ensure the MUSA Triton wheel (with triton.backends.mtgpu) is installed.
|
||||
python -m pip install --no-cache-dir --force-reinstall --no-deps \
|
||||
--index-url https://dl.mthreads.com/repo/api/pypi/pypi/simple \
|
||||
--trusted-host dl.mthreads.com \
|
||||
triton==3.2.0
|
||||
python -c 'import triton.backends.mtgpu'
|
||||
|
||||
cd python/sglang/kernels/aot
|
||||
cp pyproject_musa.toml pyproject.toml
|
||||
MTGPU_TARGET=mp_31 python setup_musa.py install
|
||||
```
|
||||
|
||||
### Install Using Docker
|
||||
|
||||
The Dockerfile installs the MUSA runtime and Python stack declared by
|
||||
`python/pyproject_other.toml`.
|
||||
|
||||
```bash Command
|
||||
git clone https://github.com/sgl-project/sglang.git
|
||||
cd sglang
|
||||
|
||||
docker build -f docker/musa.Dockerfile -t sglang:main-musa .
|
||||
```
|
||||
|
||||
Run the image with MUSA devices exposed by the host container toolkit.
|
||||
|
||||
```bash Command
|
||||
alias drun='docker run -it --rm --network=host \
|
||||
--env MTHREADS_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
|
||||
--env MTHREADS_DRIVER_CAPABILITIES=all \
|
||||
--shm-size=32g \
|
||||
-v ~/.cache/huggingface:/root/.cache/huggingface'
|
||||
|
||||
drun sglang:main-musa \
|
||||
python3 -c 'import triton.backends.mtgpu; print("MUSA Triton backend OK")'
|
||||
```
|
||||
|
||||
Launch the server:
|
||||
|
||||
```bash Command
|
||||
drun sglang:main-musa \
|
||||
python3 -m sglang.launch_server \
|
||||
--model-path Qwen/Qwen3-8B \
|
||||
--host 0.0.0.0 \
|
||||
--port 30000
|
||||
```
|
||||
|
||||
When the server displays `The server is fired up and ready to roll!`, startup is
|
||||
successful.
|
||||
|
||||
## Verify
|
||||
|
||||
You can send an OpenAI-compatible request to the engine:
|
||||
|
||||
```bash Command
|
||||
curl http://127.0.0.1:30000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "Qwen/Qwen3-8B",
|
||||
"messages": [{"role": "user", "content": "Hello!"}],
|
||||
"max_tokens": 32
|
||||
}'
|
||||
```
|
||||
|
||||
Or run a benchmark:
|
||||
|
||||
```bash Command
|
||||
drun sglang:main-musa \
|
||||
python3 -m sglang.bench_serving \
|
||||
--backend sglang \
|
||||
--dataset-name random \
|
||||
--num-prompts 4000 \
|
||||
--random-input 128 \
|
||||
--random-output 128
|
||||
```
|
||||
|
||||
@@ -10,3 +10,4 @@ description: Platform-specific guides for running SGLang on GPUs, TPUs, NPUs, CP
|
||||
- [NVIDIA Jetson Orin](./nvidia_jetson)
|
||||
- [TPU](./tpu)
|
||||
- [XPU](./xpu)
|
||||
- [Moore Threads GPUs](./mthreads_gpu)
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ import { PopularModels } from "/src/snippets/_popular_models.jsx";
|
||||
|
||||
<Card title="Extensive Hardware Support" icon="microchip">
|
||||
Native support across <a href="./docs/hardware-platforms/overview">Hardware Platforms</a>
|
||||
including NVIDIA, AMD, Intel Xeon, Google TPU, and Ascend NPU accelerators.
|
||||
including NVIDIA, AMD, Intel Xeon, Google TPU, Ascend NPU, and Moore Threads MUSA accelerators.
|
||||
</Card>
|
||||
|
||||
<Card title="Community & Training" icon="users">
|
||||
|
||||
Reference in New Issue
Block a user