Skip to content

Commit 76d0ba4

Browse files
authored
[Image][Build] Cherry pick #4062 from main (#4506)
### What this PR does / why we need it? This patch aims to integrate the mooncake [v0.3.7.2.post2](https://github.com/kvcache-ai/Mooncake/releases/tag/v0.3.7.post2) to vllm-ascend images Signed-off-by: wangli <[email protected]>
1 parent 2b4f7a5 commit 76d0ba4

File tree

5 files changed

+401
-26
lines changed

5 files changed

+401
-26
lines changed

Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,29 @@ FROM quay.io/ascend/cann:8.3.rc2-910b-ubuntu22.04-py3.11
1919

2020
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
2121
ARG COMPILE_CUSTOM_KERNELS=1
22+
ARG MOONCAKE_TAG="v0.3.7.post2"
2223

2324
# Define environments
2425
ENV DEBIAN_FRONTEND=noninteractive
2526
ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS}
2627

27-
RUN apt-get update -y && \
28-
apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev && \
29-
rm -rf /var/cache/apt/* && \
30-
rm -rf /var/lib/apt/lists/*
31-
3228
WORKDIR /workspace
3329

3430
COPY . /vllm-workspace/vllm-ascend/
3531

32+
# Install Mooncake dependencies
33+
RUN apt-get update -y && \
34+
apt-get install -y git vim wget net-tools gcc g++ cmake libnuma-dev && \
35+
git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \
36+
cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \
37+
cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \
38+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \
39+
mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \
40+
make -j$(nproc) && make install && \
41+
rm -fr /vllm-workspace/Mooncake/build && \
42+
rm -rf /var/cache/apt/* && \
43+
rm -rf /var/lib/apt/lists/*
44+
3645
RUN pip config set global.index-url ${PIP_INDEX_URL}
3746

3847
# Install vLLM
@@ -54,7 +63,7 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi
5463
python3 -m pip cache purge
5564

5665
# Install modelscope (for fast download) and ray (for multinode)
57-
RUN python3 -m pip install modelscope 'ray>=2.47.1' 'protobuf>3.20.0' && \
66+
RUN python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
5867
python3 -m pip cache purge
5968

6069
CMD ["/bin/bash"]

Dockerfile.a3

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,29 @@ FROM quay.io/ascend/cann:8.3.rc2-a3-ubuntu22.04-py3.11
1919

2020
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
2121
ARG COMPILE_CUSTOM_KERNELS=1
22+
ARG MOONCAKE_TAG=v0.3.7.post2
2223

24+
COPY . /vllm-workspace/vllm-ascend/
2325
# Define environments
2426
ENV DEBIAN_FRONTEND=noninteractive
2527
ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS}
2628

27-
RUN apt-get update -y && \
28-
apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev && \
29-
rm -rf /var/cache/apt/* && \
30-
rm -rf /var/lib/apt/lists/*
29+
RUN pip config set global.index-url ${PIP_INDEX_URL}
3130

3231
WORKDIR /workspace
3332

34-
COPY . /vllm-workspace/vllm-ascend/
35-
36-
RUN pip config set global.index-url ${PIP_INDEX_URL}
33+
# Install Mooncake dependencies
34+
RUN apt-get update -y && \
35+
apt-get install -y git vim wget net-tools gcc g++ cmake libnuma-dev && \
36+
git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \
37+
cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \
38+
cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \
39+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \
40+
mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \
41+
make -j$(nproc) && make install && \
42+
rm -fr /vllm-workspace/Mooncake/build && \
43+
rm -rf /var/cache/apt/* && \
44+
rm -rf /var/lib/apt/lists/*
3745

3846
# Install vLLM
3947
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
@@ -54,7 +62,7 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi
5462
python3 -m pip cache purge
5563

5664
# Install modelscope (for fast download) and ray (for multinode)
57-
RUN python3 -m pip install modelscope 'ray>=2.47.1' 'protobuf>3.20.0' && \
65+
RUN python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
5866
python3 -m pip cache purge
5967

6068
CMD ["/bin/bash"]

Dockerfile.a3.openEuler

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,36 @@ FROM quay.io/ascend/cann:8.3.rc2-a3-openeuler24.03-py3.11
1919

2020
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
2121
ARG COMPILE_CUSTOM_KERNELS=1
22+
ARG MOONCAKE_TAG="v0.3.7.post2"
2223

2324
ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS}
2425

25-
RUN yum update -y && \
26-
yum install -y python3-pip git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \
27-
rm -rf /var/cache/yum
28-
2926
RUN pip config set global.index-url ${PIP_INDEX_URL}
3027

3128
WORKDIR /workspace
3229

3330
COPY . /vllm-workspace/vllm-ascend/
3431

32+
SHELL ["/bin/bash", "-c"]
33+
34+
RUN yum update -y && \
35+
yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \
36+
git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \
37+
cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \
38+
ARCH=$(uname -m) && \
39+
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
40+
export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/lib64:$LD_LIBRARY_PATH && \
41+
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/${ARCH}-openEuler-linux && \
42+
cd /vllm-workspace/Mooncake && \
43+
bash mooncake_installer.sh -y && \
44+
mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \
45+
make -j$(nproc) && make install && \
46+
rm -fr /vllm-workspace/Mooncake/build && \
47+
rm -rf /var/cache/yum/*
48+
3549
# Install vLLM
3650
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
3751
ARG VLLM_TAG=v0.11.0
38-
3952
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
4053
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
4154
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
@@ -52,7 +65,7 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi
5265
python3 -m pip cache purge
5366

5467
# Install modelscope (for fast download) and ray (for multinode)
55-
RUN python3 -m pip install modelscope 'ray>=2.47.1' 'protobuf>3.20.0' && \
68+
RUN python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
5669
python3 -m pip cache purge
5770

5871
CMD ["/bin/bash"]

Dockerfile.openEuler

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,37 @@ FROM quay.io/ascend/cann:8.3.rc2-910b-openeuler24.03-py3.11
1919

2020
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
2121
ARG COMPILE_CUSTOM_KERNELS=1
22+
ARG MOONCAKE_TAG="v0.3.7.post2"
2223

2324
ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS}
2425

25-
RUN yum update -y && \
26-
yum install -y python3-pip git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \
27-
rm -rf /var/cache/yum
2826

2927
RUN pip config set global.index-url ${PIP_INDEX_URL}
3028

3129
WORKDIR /workspace
3230

3331
COPY . /vllm-workspace/vllm-ascend/
3432

33+
SHELL ["/bin/bash", "-c"]
34+
35+
RUN yum update -y && \
36+
yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \
37+
git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \
38+
cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \
39+
ARCH=$(uname -m) && \
40+
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
41+
export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/lib64:$LD_LIBRARY_PATH && \
42+
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/${ARCH}-openEuler-linux && \
43+
cd /vllm-workspace/Mooncake && \
44+
bash mooncake_installer.sh -y && \
45+
mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \
46+
make -j$(nproc) && make install && \
47+
rm -fr /vllm-workspace/Mooncake/build && \
48+
rm -rf /var/cache/yum/*
49+
3550
# Install vLLM
3651
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
37-
ARG VLLM_TAG=v0.11.0
38-
52+
ARG VLLM_TAG=v0.11.2
3953
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
4054
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
4155
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
@@ -52,7 +66,7 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi
5266
python3 -m pip cache purge
5367

5468
# Install modelscope (for fast download) and ray (for multinode)
55-
RUN python3 -m pip install modelscope 'ray>=2.47.1' 'protobuf>3.20.0' && \
69+
RUN python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
5670
python3 -m pip cache purge
5771

5872
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)