Moore Threads GPU

Moore Threads GPU

이 문서는 Moore Threads GPU에서 SGLang을 실행하는 방법을 설명해요. 문제가 있거나 질문이 있다면 이슈를 열어 주세요.

출처: 문서

본문

SGLang은 torch_musatorchada를 통해 MUSA 런타임을 사용해요. python[all_musa] 엑스트라는 Moore Threads 패키지 인덱스에서 MUSA torch, Triton, TileLang, MATE 및 런타임 Python 스택을 설치하며, 일반적인 Python 의존성은 공개 PyPI를 폴백으로 사용해요.

사전 요구 사항 (Prerequisites)

SGLang을 설치하기 전에 Moore Threads 드라이버와 MUSA 툴킷을 설치하세요. MTT S5000의 경우 공식 드라이버 설치 가이드를 따르세요.

SGLang 설치 (Install SGLang)

다음 방법 중 하나를 사용해 SGLang을 설치할 수 있어요.

소스에서 설치 (Install from Source)

위의 사전 요구 사항이 설치된 환경에서 시작하세요.

git clone https://github.com/sgl-project/sglang.git
cd sglang

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

# MUSA Triton 휠(triton.backends.mtgpu 포함)이 설치되어 있는지 확인
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

Docker를 사용한 설치 (Install Using Docker)

Dockerfile은 python/pyproject_other.toml에 선언된 MUSA 런타임과 Python 스택을 설치해요.

git clone https://github.com/sgl-project/sglang.git
cd sglang

docker build -f docker/musa.Dockerfile -t sglang:main-musa .

호스트 컨테이너 툴킷이 노출한 MUSA 디바이스로 이미지를 실행하세요.

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")'

서버를 실행하세요:

drun sglang:main-musa \
  python3 -m sglang.launch_server \
  --model-path Qwen/Qwen3-8B \
  --host 0.0.0.0 \
  --port 30000

서버에 The server is fired up and ready to roll! 메시지가 표시되면 시작이 성공한 거예요.

검증 (Verify)

엔진에 OpenAI 호환 요청을 보내보세요:

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
  }'

또는 벤치마크를 실행하세요:

drun sglang:main-musa \
  python3 -m sglang.bench_serving \
  --backend sglang \
  --dataset-name random \
  --num-prompts 4000 \
  --random-input 128 \
  --random-output 128

더 알아보기 (Learn more)