From 18b74ff68ee797fea9b6562c31e8af091e16e6f1 Mon Sep 17 00:00:00 2001 From: R0CKSTAR Date: Tue, 29 Sep 2026 16:42:20 +0800 Subject: [PATCH] musa: build the docker image and CI container from the MUSA SDK images (#29624) * musa: build the docker image and CI container from the MUSA SDK images Use registry.mthreads.com/mcconline/musa_sdk:5.2.0-{devel,runtime}-ubuntu22.04-s5000 instead of registry.mthreads.com/mcconline/inference/pytorch:2.9.1.post1-py3.10-musa5.2.0-mp31-devel-ubuntu22.04-amd64 for the MUSA docker image and the MUSA CI container, and let the runtime stage use the runtime image instead of reusing the devel one, which drops the MUSA toolchain from the published images. * musa: install the MUSA headers and loader path the SDK images omit musa_sdk:5.2.0-*-s5000 does not ship the cub and thrust headers that the MUSA backend builds against, and its runtime image does not register /usr/local/musa/lib with the dynamic loader. Install both header packages in the build stage and in the MUSA CI container, and write the loader path in the runtime stage. * musa: install libmthreads-compute for the MUSA runtime library The MUSA SDK images do not install libmthreads-compute, which provides libmusa.so.1 in /usr/lib/x86_64-linux-gnu, so linking anything against the MUSA backend fails. * musa: install libmthreads-compute in the runtime stages The MUSA runtime image does not install libmthreads-compute, so the published images would have no libmusa.so.1 at run time. --------- Co-authored-by: yeahdongcn --- .devops/musa.Dockerfile | 14 ++++++++++---- .github/workflows/build-cuda-ubuntu.yml | 4 ++-- ci/README-MUSA.md | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.devops/musa.Dockerfile b/.devops/musa.Dockerfile index 33ac6bb82..0e3f63359 100644 --- a/.devops/musa.Dockerfile +++ b/.devops/musa.Dockerfile @@ -1,9 +1,9 @@ ARG UBUNTU_VERSION=22.04 # This needs to generally match the container host's environment. # Target the MUSA build image -ARG BASE_MUSA_DEV_CONTAINER=registry.mthreads.com/mcconline/inference/pytorch:2.9.1.post1-py3.10-musa5.2.0-mp31-devel-ubuntu${UBUNTU_VERSION}-amd64 +ARG BASE_MUSA_DEV_CONTAINER=registry.mthreads.com/mcconline/musa_sdk:5.2.0-devel-ubuntu${UBUNTU_VERSION}-s5000 -ARG BASE_MUSA_RUN_CONTAINER=${BASE_MUSA_DEV_CONTAINER} +ARG BASE_MUSA_RUN_CONTAINER=registry.mthreads.com/mcconline/musa_sdk:5.2.0-runtime-ubuntu${UBUNTU_VERSION}-s5000 ARG BUILD_DATE=N/A ARG APP_VERSION=N/A @@ -36,7 +36,10 @@ RUN apt-get update && \ python3-pip \ git \ libssl-dev \ - libgomp1 + libgomp1 \ + musa-mualg-5-2 \ + musa-muthrust-5-2 \ + libmthreads-compute WORKDIR /app @@ -79,13 +82,16 @@ LABEL org.opencontainers.image.created=$BUILD_DATE \ org.opencontainers.image.source=$IMAGE_SOURCE RUN apt-get update \ - && apt-get install -y libgomp1 curl ffmpeg \ + && apt-get install -y libgomp1 curl ffmpeg libmthreads-compute \ && apt autoremove -y \ && apt clean -y \ && rm -rf /tmp/* /var/tmp/* \ && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \ && find /var/cache -type f -delete +# The MUSA runtime image does not register its library directory +RUN echo "/usr/local/musa/lib" > /etc/ld.so.conf.d/musa-runtime.conf && ldconfig + COPY --from=build /app/lib/ /app ### Full diff --git a/.github/workflows/build-cuda-ubuntu.yml b/.github/workflows/build-cuda-ubuntu.yml index 3dc9255be..68b6c0190 100644 --- a/.github/workflows/build-cuda-ubuntu.yml +++ b/.github/workflows/build-cuda-ubuntu.yml @@ -145,7 +145,7 @@ jobs: musa: runs-on: ubuntu-22.04 - container: registry.mthreads.com/mcconline/inference/pytorch:2.9.1.post1-py3.10-musa5.2.0-mp31-devel-ubuntu22.04-amd64 + container: registry.mthreads.com/mcconline/musa_sdk:5.2.0-devel-ubuntu22.04-s5000 steps: - name: Clone @@ -156,7 +156,7 @@ jobs: id: depends run: | apt-get update - apt-get install -y build-essential git cmake libssl-dev jq python3-venv + apt-get install -y build-essential git cmake libssl-dev jq python3-venv musa-mualg-5-2 musa-muthrust-5-2 libmthreads-compute - name: ccache uses: ggml-org/ccache-action@v1.2.24 diff --git a/ci/README-MUSA.md b/ci/README-MUSA.md index 2101dfa2c..40e9ea5af 100644 --- a/ci/README-MUSA.md +++ b/ci/README-MUSA.md @@ -21,13 +21,13 @@ docker run --privileged -it \ -v $HOME/llama.cpp/ci-cache:/ci-cache \ -v $HOME/llama.cpp/ci-results:/ci-results \ -v $PWD:/ws -w /ws \ - registry.mthreads.com/mcconline/inference/pytorch:2.9.1.post1-py3.10-musa5.2.0-mp31-devel-ubuntu22.04-amd64 + registry.mthreads.com/mcconline/musa_sdk:5.2.0-devel-ubuntu22.04-s5000 ``` Inside the container, execute the following commands: ```bash -apt update -y && apt install -y bc cmake ccache git python3.10-venv time unzip wget +apt update -y && apt install -y bc cmake ccache git python3.10-venv time unzip wget musa-mualg-5-2 musa-muthrust-5-2 libmthreads-compute git config --global --add safe.directory /ws GG_BUILD_MUSA=1 bash ./ci/run.sh /ci-results /ci-cache ```