From 6c0815555d8fccfd3e83655808f7bf47c7581fbc Mon Sep 17 00:00:00 2001 From: wangli Date: Fri, 7 Nov 2025 17:16:22 +0800 Subject: [PATCH 1/8] opt dockerfile to build mooncake Signed-off-by: wangli --- Dockerfile | 17 +++++++++++++++-- Dockerfile.a3 | 24 +++++++++++++++++------- Dockerfile.a3.openEuler | 26 +++++++++++++++++++++----- Dockerfile.openEuler | 24 ++++++++++++++++++++---- 4 files changed, 73 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index f01284b4911..a28f85867f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,19 +19,32 @@ FROM quay.io/ascend/cann:8.3.rc1-910b-ubuntu22.04-py3.11 ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" ARG COMPILE_CUSTOM_KERNELS=1 +ARG MOONCAKE_TAG="v0.3.7.post2" # Define environments ENV DEBIAN_FRONTEND=noninteractive ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS} +WORKDIR /workspace + +COPY . /vllm-workspace/vllm-ascend/ + +# Install Mooncake dependencies +RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ + cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ + cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ + mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ + make -j2 && make install && \ + rm -rf /var/cache/apt/* && \ + rm -rf /var/lib/apt/lists/* + RUN apt-get update -y && \ apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* -WORKDIR /workspace -COPY . /vllm-workspace/vllm-ascend/ RUN pip config set global.index-url ${PIP_INDEX_URL} diff --git a/Dockerfile.a3 b/Dockerfile.a3 index 59c4cbbbebd..10605892711 100644 --- a/Dockerfile.a3 +++ b/Dockerfile.a3 @@ -19,21 +19,31 @@ FROM quay.io/ascend/cann:8.3.rc1-a3-ubuntu22.04-py3.11 ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" ARG COMPILE_CUSTOM_KERNELS=1 +ARG MOONCAKE_TAG=v0.3.7.post2 +COPY . /vllm-workspace/vllm-ascend/ # Define environments ENV DEBIAN_FRONTEND=noninteractive ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS} -RUN apt-get update -y && \ - apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev && \ - rm -rf /var/cache/apt/* && \ - rm -rf /var/lib/apt/lists/* +RUN pip config set global.index-url ${PIP_INDEX_URL} WORKDIR /workspace -COPY . /vllm-workspace/vllm-ascend/ +RUN apt-get update -y && \ + apt-get install -y git vim wget net-tools gcc g++ cmake libnuma-dev && \ + rm -rf /var/cache/apt/* && \ + rm -rf /var/lib/apt/lists/* -RUN pip config set global.index-url ${PIP_INDEX_URL} +# Install Mooncake dependencies +RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ + cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ + cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ + mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ + make -j2 && make install && \ + rm -rf /var/cache/apt/* && \ + rm -rf /var/lib/apt/lists/* # Install vLLM ARG VLLM_REPO=https://github.com/vllm-project/vllm.git @@ -57,4 +67,4 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi RUN python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/bin/bash"] diff --git a/Dockerfile.a3.openEuler b/Dockerfile.a3.openEuler index 2fabb3069a0..1f23a798961 100644 --- a/Dockerfile.a3.openEuler +++ b/Dockerfile.a3.openEuler @@ -19,19 +19,35 @@ FROM quay.io/ascend/cann:8.3.rc1-a3-openeuler24.03-py3.11 ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" ARG COMPILE_CUSTOM_KERNELS=1 +ARG MOONCAKE_TAG="v0.3.7.post2" ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS} -RUN yum update -y && \ - yum install -y python3-pip git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ - rm -rf /var/cache/yum - RUN pip config set global.index-url ${PIP_INDEX_URL} WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ +RUN yum update -y && \ + yum install -y python3-pip git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ + yum clean all && \ + rm -rf /var/cache/yum/* + +# Build Mooncake +RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ + cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ + source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ + source /usr/local/Ascend/nnal/atb/set_env.sh && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ + export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ + cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ + mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ + make -j2 && make install && \ + rm -fr /vllm-workspace/Mooncake/build && \ + yum clean all && \ + rm -rf /var/cache/yum/* + # Install vLLM ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.11.0 @@ -55,4 +71,4 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi RUN python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/bin/bash"] diff --git a/Dockerfile.openEuler b/Dockerfile.openEuler index e665518d97d..b8f664ddc71 100644 --- a/Dockerfile.openEuler +++ b/Dockerfile.openEuler @@ -19,19 +19,35 @@ FROM quay.io/ascend/cann:8.3.rc1-910b-openeuler24.03-py3.11 ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" ARG COMPILE_CUSTOM_KERNELS=1 +ARG MOONCAKE_TAG="v0.3.7.post2" ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS} -RUN yum update -y && \ - yum install -y python3-pip git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ - rm -rf /var/cache/yum - RUN pip config set global.index-url ${PIP_INDEX_URL} WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ +RUN yum update -y && \ + yum install -y python3-pip git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ + yum clean all && \ + rm -rf /var/cache/yum/* + +# Build Mooncake +RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ + cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ + source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ + source /usr/local/Ascend/nnal/atb/set_env.sh && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ + export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ + cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ + mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ + make -j2 && make install && \ + rm -fr /vllm-workspace/Mooncake/build && \ + yum clean all && \ + rm -rf /var/cache/yum/* + # Install vLLM ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.11.0 From 29fb856c21e5d7c2656fa859f898d99b09cc110b Mon Sep 17 00:00:00 2001 From: wangli Date: Fri, 7 Nov 2025 17:17:20 +0800 Subject: [PATCH 2/8] add mooncake installer script Signed-off-by: wangli --- tools/mooncake_installer.sh | 322 ++++++++++++++++++++++++++++++++++++ 1 file changed, 322 insertions(+) create mode 100644 tools/mooncake_installer.sh diff --git a/tools/mooncake_installer.sh b/tools/mooncake_installer.sh new file mode 100644 index 00000000000..ca74bb6d968 --- /dev/null +++ b/tools/mooncake_installer.sh @@ -0,0 +1,322 @@ +#!/bin/bash +# Copyright 2024 KVCache.AI +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Color definitions +GREEN="\033[0;32m" +BLUE="\033[0;34m" +YELLOW="\033[0;33m" +RED="\033[0;31m" +NC="\033[0m" # No Color + +# Configuration +REPO_ROOT=`pwd` +GITHUB_PROXY=${GITHUB_PROXY:-"https://github.com"} +GOVER=1.23.8 +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +TARGET_DIR="$SCRIPT_DIR/../../.." + +# Define a function to handle the git clone operation +clone_repo_if_not_exists() { + local repo_dir=$1 + local repo_url=$2 + + if [ ! -d "$repo_dir" ]; then + git clone "$repo_url" + else + echo "Directory $repo_dir already exists, skipping clone." + fi +} + +# Function to print section headers +print_section() { + echo -e "\n${BLUE}=== $1 ===${NC}" +} + +# Function to print success messages +print_success() { + echo -e "${GREEN}✓ $1${NC}" +} + +# Function to print error messages and exit +print_error() { + echo -e "${RED}✗ ERROR: $1${NC}" + exit 1 +} + +# Function to check command success +check_success() { + if [ $? -ne 0 ]; then + print_error "$1" + fi +} + +if [ $(id -u) -ne 0 ]; then + print_error "Require root permission, try sudo ./dependencies.sh" +fi + +# Parse command line arguments +SKIP_CONFIRM=false +for arg in "$@"; do + case $arg in + -y|--yes) + SKIP_CONFIRM=true + ;; + -h|--help) + echo -e "${YELLOW}Mooncake Dependencies Installer${NC}" + echo -e "Usage: ./dependencies.sh [OPTIONS]" + echo -e "\nOptions:" + echo -e " -y, --yes Skip confirmation and install all dependencies" + echo -e " -h, --help Show this help message and exit" + exit 0 + ;; + esac +done + +# Print welcome message +echo -e "${YELLOW}Mooncake Dependencies Installer${NC}" +echo -e "This script will install all required dependencies for Mooncake." +echo -e "The following components will be installed:" +echo -e " - System packages (build tools, libraries)" +echo -e " - yalantinglibs" +echo -e " - Git submodules" +echo -e " - Go $GOVER" +echo + +# Ask for confirmation unless -y flag is used +if [ "$SKIP_CONFIRM" = false ]; then + read -p "Do you want to continue? [Y/n] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]] && [[ ! $REPLY = "" ]]; then + echo -e "${YELLOW}Installation cancelled.${NC}" + exit 0 + fi +fi + + +# Update package lists +print_section "Updating package lists" +check_success "Failed to update package lists" + +# Install system packages +print_section "Installing system packages" +echo -e "${YELLOW}This may take a few minutes...${NC}" + +# System detection and dependency installation +if command -v apt-get &> /dev/null; then + echo "Detected apt-get. Using Debian-based package manager." + apt-get update + apt-get install -y build-essential \ + cmake \ + git \ + wget \ + libibverbs-dev \ + libgoogle-glog-dev \ + libgtest-dev \ + libjsoncpp-dev \ + libunwind-dev \ + libnuma-dev \ + libpython3-dev \ + libboost-all-dev \ + libssl-dev \ + libgrpc-dev \ + libgrpc++-dev \ + libprotobuf-dev \ + libyaml-cpp-dev \ + protobuf-compiler-grpc \ + libcurl4-openssl-dev \ + libhiredis-dev \ + pkg-config \ + patchelf \ + mpich \ + libmpich-dev + apt purge -y openmpi-bin libopenmpi-dev || true +elif command -v yum &> /dev/null; then + echo "Detected yum. Using Red Hat-based package manager." + yum makecache + yum install -y cmake \ + gflags-devel \ + glog-devel \ + libibverbs-devel \ + numactl-devel \ + gtest \ + gtest-devel \ + boost-devel \ + openssl-devel \ + hiredis-devel \ + libcurl-devel \ + jsoncpp-devel \ + mpich \ + mpich-devel + # Install yaml-cpp + cd "$TARGET_DIR" + clone_repo_if_not_exists "yaml-cpp" https://github.com/jbeder/yaml-cpp.git + cd yaml-cpp || exit + rm -rf build + mkdir -p build && cd build + cmake .. + make -j$(nproc) + make install + cd ../.. +else + echo "Unsupported package manager. Please install the dependencies manually." + exit 1 +fi + +check_success "Failed to install system packages" +print_success "System packages installed successfully" + +# Install yalantinglibs +print_section "Installing yalantinglibs" + +# Check if thirdparties directory exists +if [ ! -d "${REPO_ROOT}/thirdparties" ]; then + mkdir -p "${REPO_ROOT}/thirdparties" + check_success "Failed to create thirdparties directory" +fi + +# Change to thirdparties directory +cd "${REPO_ROOT}/thirdparties" +check_success "Failed to change to thirdparties directory" + +# Check if yalantinglibs is already installed +if [ -d "yalantinglibs" ]; then + echo -e "${YELLOW}yalantinglibs directory already exists. Removing for fresh install...${NC}" + rm -rf yalantinglibs + check_success "Failed to remove existing yalantinglibs directory" +fi + +# Clone yalantinglibs +echo "Cloning yalantinglibs from ${GITHUB_PROXY}/alibaba/yalantinglibs.git" +git clone ${GITHUB_PROXY}/alibaba/yalantinglibs.git +check_success "Failed to clone yalantinglibs" + +# Build and install yalantinglibs +cd yalantinglibs +check_success "Failed to change to yalantinglibs directory" + +# Checkout version 0.5.5 +echo "Checking out yalantinglibs version 0.5.5..." +git checkout 0.5.5 +check_success "Failed to checkout yalantinglibs version 0.5.5" + +mkdir -p build +check_success "Failed to create build directory" + +cd build +check_success "Failed to change to build directory" + +echo "Configuring yalantinglibs..." +cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_BENCHMARK=OFF -DBUILD_UNIT_TESTS=OFF +check_success "Failed to configure yalantinglibs" + +echo "Building yalantinglibs (using $(nproc) cores)..." +cmake --build . -j$(nproc) +check_success "Failed to build yalantinglibs" + +echo "Installing yalantinglibs..." +cmake --install . +check_success "Failed to install yalantinglibs" + +print_success "yalantinglibs installed successfully" + +# Initialize and update git submodules +print_section "Initializing Git Submodules" + +# Check if .gitmodules exists +if [ -f "${REPO_ROOT}/.gitmodules" ]; then + # Check if submodules are already initialized by looking for the .git directory in the first submodule + FIRST_SUBMODULE=$(grep "path" ${REPO_ROOT}/.gitmodules | head -1 | awk '{print $3}') + + echo "Enter repository root: ${REPO_ROOT}" + cd "${REPO_ROOT}" + check_success "Failed to change to repository root directory" + + if [ -d "${REPO_ROOT}/${FIRST_SUBMODULE}/.git" ] || [ -f "${REPO_ROOT}/${FIRST_SUBMODULE}/.git" ]; then + echo -e "${YELLOW}Git submodules already initialized. Skipping...${NC}" + else + echo "Initializing git submodules..." + git submodule update --init + check_success "Failed to initialize git submodules" + + print_success "Git submodules initialized and updated successfully" + fi +else + echo -e "${YELLOW}No .gitmodules file found. Skipping...${NC}" + exit 1 +fi + +print_section "Installing Go $GOVER" + +install_go() { + ARCH=$(uname -m) + if [ "$ARCH" = "aarch64" ]; then + ARCH="arm64" + elif [ "$ARCH" = "x86_64" ]; then + ARCH="amd64" + else + echo "Unsupported architecture: $ARCH" + exit 1 + fi + # Download Go + echo "Downloading Go $GOVER..." + wget -q --show-progress https://golang.google.cn/dl/go$GOVER.linux-$ARCH.tar.gz + check_success "Failed to download Go $GOVER" + + # Install Go + echo "Installing Go $GOVER..." + tar -C /usr/local -xzf go$GOVER.linux-$ARCH.tar.gz + check_success "Failed to install Go $GOVER" + + # Clean up downloaded file + rm -f go$GOVER.linux-$ARCH.tar.gz + check_success "Failed to clean up Go installation file" + + print_success "Go $GOVER installed successfully" +} + +# Check if Go is already installed +if command -v go &> /dev/null; then + GO_VERSION=$(go version | awk '{print $3}') + if [[ "$GO_VERSION" == "go$GOVER" ]]; then + echo -e "${YELLOW}Go $GOVER is already installed. Skipping...${NC}" + else + echo -e "${YELLOW}Found Go $GO_VERSION. Will install Go $GOVER...${NC}" + install_go + fi +else + install_go +fi + +# Add Go to PATH if not already there +if ! grep -q "export PATH=\$PATH:/usr/local/go/bin" ~/.bashrc; then + echo -e "${YELLOW}Adding Go to your PATH in ~/.bashrc${NC}" + echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc + echo -e "${YELLOW}Please run 'source ~/.bashrc' or start a new terminal to use Go${NC}" +fi + +# Return to the repository root +cd "${REPO_ROOT}" + +# Print summary +print_section "Installation Complete" +echo -e "${GREEN}All dependencies have been successfully installed!${NC}" +echo -e "The following components were installed:" +echo -e " ${GREEN}✓${NC} System packages" +echo -e " ${GREEN}✓${NC} yalantinglibs" +echo -e " ${GREEN}✓${NC} Git submodules" +echo -e " ${GREEN}✓${NC} Go $GOVER" +echo +echo -e "You can now build and run Mooncake." +echo -e "${YELLOW}Note: You may need to restart your terminal or run 'source ~/.bashrc' to use Go.${NC}" From bb7eaf58910b8cea3885ef711924d7f21e91b6f4 Mon Sep 17 00:00:00 2001 From: wangli Date: Fri, 7 Nov 2025 17:22:19 +0800 Subject: [PATCH 3/8] add header Signed-off-by: wangli --- tools/mooncake_installer.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/mooncake_installer.sh b/tools/mooncake_installer.sh index ca74bb6d968..b5e689b3b62 100644 --- a/tools/mooncake_installer.sh +++ b/tools/mooncake_installer.sh @@ -1,5 +1,8 @@ #!/bin/bash -# Copyright 2024 KVCache.AI + +# +# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. +# Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,6 +15,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# This is script is inspired from https://github.com/kvcache-ai/Mooncake/blob/main/dependencies.sh +# # Color definitions GREEN="\033[0;32m" From c0581072bc3ead0d3dd78b7f5f92c073a22d54bc Mon Sep 17 00:00:00 2001 From: wangli Date: Fri, 7 Nov 2025 17:29:04 +0800 Subject: [PATCH 4/8] remove build folder after build Signed-off-by: wangli --- Dockerfile | 1 + Dockerfile.a3 | 1 + 2 files changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index a28f85867f9..c48b3dd0bee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,7 @@ RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/M export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ make -j2 && make install && \ + rm -fr /vllm-workspace/Mooncake/build && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* diff --git a/Dockerfile.a3 b/Dockerfile.a3 index 10605892711..7c403452128 100644 --- a/Dockerfile.a3 +++ b/Dockerfile.a3 @@ -42,6 +42,7 @@ RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/M export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ make -j2 && make install && \ + rm -fr /vllm-workspace/Mooncake/build && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* From fac99b1eca8ae92ee225a0e5ce1262ec321b9c96 Mon Sep 17 00:00:00 2001 From: wangli Date: Mon, 10 Nov 2025 16:27:48 +0800 Subject: [PATCH 5/8] make -j$(npr oc) Signed-off-by: wangli --- Dockerfile | 14 ++++++-------- Dockerfile.a3 | 2 +- Dockerfile.a3.openEuler | 4 ++-- Dockerfile.openEuler | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index c48b3dd0bee..46ed07b4a79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,24 +29,22 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ +RUN apt-get update -y && \ + apt-get install -y git vim wget net-tools gcc g++ cmake libnuma-dev && \ + rm -rf /var/cache/apt/* && \ + rm -rf /var/lib/apt/lists/* + # Install Mooncake dependencies RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ - make -j2 && make install && \ + make -j$(nproc) && make install && \ rm -fr /vllm-workspace/Mooncake/build && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* -RUN apt-get update -y && \ - apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev && \ - rm -rf /var/cache/apt/* && \ - rm -rf /var/lib/apt/lists/* - - - RUN pip config set global.index-url ${PIP_INDEX_URL} # Install vLLM diff --git a/Dockerfile.a3 b/Dockerfile.a3 index 7c403452128..37e420dd77a 100644 --- a/Dockerfile.a3 +++ b/Dockerfile.a3 @@ -41,7 +41,7 @@ RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/M cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ - make -j2 && make install && \ + make -j$(nproc) && make install && \ rm -fr /vllm-workspace/Mooncake/build && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* diff --git a/Dockerfile.a3.openEuler b/Dockerfile.a3.openEuler index 1f23a798961..8123d948b3e 100644 --- a/Dockerfile.a3.openEuler +++ b/Dockerfile.a3.openEuler @@ -30,7 +30,7 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ RUN yum update -y && \ - yum install -y python3-pip git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ + yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ yum clean all && \ rm -rf /var/cache/yum/* @@ -43,7 +43,7 @@ RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/M export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ - make -j2 && make install && \ + make -j$(nproc) && make install && \ rm -fr /vllm-workspace/Mooncake/build && \ yum clean all && \ rm -rf /var/cache/yum/* diff --git a/Dockerfile.openEuler b/Dockerfile.openEuler index b8f664ddc71..9f87f945524 100644 --- a/Dockerfile.openEuler +++ b/Dockerfile.openEuler @@ -30,7 +30,7 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ RUN yum update -y && \ - yum install -y python3-pip git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ + yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ yum clean all && \ rm -rf /var/cache/yum/* @@ -43,7 +43,7 @@ RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/M export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ - make -j2 && make install && \ + make -j$(nproc) && make install && \ rm -fr /vllm-workspace/Mooncake/build && \ yum clean all && \ rm -rf /var/cache/yum/* From 0ec04a5ed3557a5514cb592c7174d3d34c836e08 Mon Sep 17 00:00:00 2001 From: wangli Date: Mon, 10 Nov 2025 19:30:12 +0800 Subject: [PATCH 6/8] fix euler Signed-off-by: wangli --- Dockerfile | 7 ++--- Dockerfile.a3 | 7 ++--- Dockerfile.a3.openEuler | 10 +++---- Dockerfile.openEuler | 10 +++---- tools/mooncake_installer.sh | 54 ++++++++++++++++++++----------------- 5 files changed, 41 insertions(+), 47 deletions(-) diff --git a/Dockerfile b/Dockerfile index 46ed07b4a79..9f128c3ec97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,13 +29,10 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ +# Install Mooncake dependencies RUN apt-get update -y && \ apt-get install -y git vim wget net-tools gcc g++ cmake libnuma-dev && \ - rm -rf /var/cache/apt/* && \ - rm -rf /var/lib/apt/lists/* - -# Install Mooncake dependencies -RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ + git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ diff --git a/Dockerfile.a3 b/Dockerfile.a3 index 37e420dd77a..9b073b9c01c 100644 --- a/Dockerfile.a3 +++ b/Dockerfile.a3 @@ -30,13 +30,10 @@ RUN pip config set global.index-url ${PIP_INDEX_URL} WORKDIR /workspace +# Install Mooncake dependencies RUN apt-get update -y && \ apt-get install -y git vim wget net-tools gcc g++ cmake libnuma-dev && \ - rm -rf /var/cache/apt/* && \ - rm -rf /var/lib/apt/lists/* - -# Install Mooncake dependencies -RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ + git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ diff --git a/Dockerfile.a3.openEuler b/Dockerfile.a3.openEuler index 8123d948b3e..b579a5b0d84 100644 --- a/Dockerfile.a3.openEuler +++ b/Dockerfile.a3.openEuler @@ -29,17 +29,12 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ -RUN yum update -y && \ - yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ - yum clean all && \ - rm -rf /var/cache/yum/* - # Build Mooncake RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ @@ -52,6 +47,9 @@ RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/M ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.11.0 +RUN yum update -y && \ + yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel + RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/ --extra-index https://download.pytorch.org/whl/cpu/ && \ diff --git a/Dockerfile.openEuler b/Dockerfile.openEuler index 9f87f945524..a7e25553db1 100644 --- a/Dockerfile.openEuler +++ b/Dockerfile.openEuler @@ -29,17 +29,12 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ -RUN yum update -y && \ - yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ - yum clean all && \ - rm -rf /var/cache/yum/* - # Build Mooncake RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/lib64 && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ @@ -52,6 +47,9 @@ RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/M ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.11.0 +RUN yum update -y && \ + yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel + RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/ --extra-index https://download.pytorch.org/whl/cpu/ && \ diff --git a/tools/mooncake_installer.sh b/tools/mooncake_installer.sh index b5e689b3b62..3335c122f57 100644 --- a/tools/mooncake_installer.sh +++ b/tools/mooncake_installer.sh @@ -39,7 +39,7 @@ clone_repo_if_not_exists() { local repo_url=$2 if [ ! -d "$repo_dir" ]; then - git clone "$repo_url" + git clone --depth 1 "$repo_url" else echo "Directory $repo_dir already exists, skipping clone." fi @@ -69,7 +69,7 @@ check_success() { } if [ $(id -u) -ne 0 ]; then - print_error "Require root permission, try sudo ./dependencies.sh" + print_error "Require root permission, try sudo ./dependencies.sh" fi # Parse command line arguments @@ -151,22 +151,31 @@ if command -v apt-get &> /dev/null; then elif command -v yum &> /dev/null; then echo "Detected yum. Using Red Hat-based package manager." yum makecache - yum install -y cmake \ - gflags-devel \ - glog-devel \ - libibverbs-devel \ - numactl-devel \ - gtest \ - gtest-devel \ - boost-devel \ - openssl-devel \ - hiredis-devel \ - libcurl-devel \ - jsoncpp-devel \ - mpich \ - mpich-devel - # Install yaml-cpp - cd "$TARGET_DIR" + yum install -y \ + gcc \ + gcc-c++ \ + make \ + cmake \ + git \ + wget \ + libibverbs-devel \ + numactl-devel \ + gflags-devel \ + glog-devel \ + gtest \ + gtest-devel \ + jsoncpp-devel \ + mpich \ + mpich-devel \ + boost-devel \ + openssl-devel \ + hiredis-devel \ + python3-devel \ + curl-devel \ + patchelf + + # install yaml-cpp + cd "${REPO_ROOT}/thirdparties" clone_repo_if_not_exists "yaml-cpp" https://github.com/jbeder/yaml-cpp.git cd yaml-cpp || exit rm -rf build @@ -174,7 +183,7 @@ elif command -v yum &> /dev/null; then cmake .. make -j$(nproc) make install - cd ../.. + cd "${REPO_ROOT}" else echo "Unsupported package manager. Please install the dependencies manually." exit 1 @@ -205,18 +214,13 @@ fi # Clone yalantinglibs echo "Cloning yalantinglibs from ${GITHUB_PROXY}/alibaba/yalantinglibs.git" -git clone ${GITHUB_PROXY}/alibaba/yalantinglibs.git +git clone -b 0.5.5 --depth 1 ${GITHUB_PROXY}/alibaba/yalantinglibs.git check_success "Failed to clone yalantinglibs" # Build and install yalantinglibs cd yalantinglibs check_success "Failed to change to yalantinglibs directory" -# Checkout version 0.5.5 -echo "Checking out yalantinglibs version 0.5.5..." -git checkout 0.5.5 -check_success "Failed to checkout yalantinglibs version 0.5.5" - mkdir -p build check_success "Failed to create build directory" From 4725969b02ff5150266b22b74d3dc70c610c55ee Mon Sep 17 00:00:00 2001 From: wangli Date: Mon, 10 Nov 2025 19:56:21 +0800 Subject: [PATCH 7/8] fix Signed-off-by: wangli --- Dockerfile.a3.openEuler | 10 +++++++--- Dockerfile.openEuler | 10 +++++++--- tools/mooncake_installer.sh | 1 - 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile.a3.openEuler b/Dockerfile.a3.openEuler index b579a5b0d84..84351e804a3 100644 --- a/Dockerfile.a3.openEuler +++ b/Dockerfile.a3.openEuler @@ -29,13 +29,15 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ +ARG ARCH=$(uname -i) + # Build Mooncake RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ - export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/lib64 && \ + export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/${ARCH}-openEuler-linux && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ make -j$(nproc) && make install && \ @@ -48,7 +50,9 @@ ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.11.0 RUN yum update -y && \ - yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel + yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ + yum clean all && \ + rm -rf /var/cache/yum/* RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. diff --git a/Dockerfile.openEuler b/Dockerfile.openEuler index a7e25553db1..f0a24255a10 100644 --- a/Dockerfile.openEuler +++ b/Dockerfile.openEuler @@ -29,13 +29,15 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ +ARG ARCH=$(uname -i) + # Build Mooncake RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ - export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/lib64 && \ + export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/${ARCH}-openEuler-linux && \ cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ make -j$(nproc) && make install && \ @@ -48,7 +50,9 @@ ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.11.0 RUN yum update -y && \ - yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel + yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ + yum clean all && \ + rm -rf /var/cache/yum/* RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. diff --git a/tools/mooncake_installer.sh b/tools/mooncake_installer.sh index 3335c122f57..b68362f12eb 100644 --- a/tools/mooncake_installer.sh +++ b/tools/mooncake_installer.sh @@ -31,7 +31,6 @@ REPO_ROOT=`pwd` GITHUB_PROXY=${GITHUB_PROXY:-"https://github.com"} GOVER=1.23.8 SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -TARGET_DIR="$SCRIPT_DIR/../../.." # Define a function to handle the git clone operation clone_repo_if_not_exists() { From eed6bf4516d62a94d12549e1673dca7549cd9f40 Mon Sep 17 00:00:00 2001 From: wangli Date: Tue, 11 Nov 2025 11:46:18 +0800 Subject: [PATCH 8/8] fix euler Signed-off-by: wangli --- Dockerfile.a3.openEuler | 20 ++++++++------------ Dockerfile.openEuler | 20 ++++++++------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Dockerfile.a3.openEuler b/Dockerfile.a3.openEuler index 84351e804a3..2a1d5e816b9 100644 --- a/Dockerfile.a3.openEuler +++ b/Dockerfile.a3.openEuler @@ -29,31 +29,27 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ -ARG ARCH=$(uname -i) +SHELL ["/bin/bash", "-c"] -# Build Mooncake -RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ +RUN yum update -y && \ + yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ + git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ + ARCH=$(uname -m) && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ - source /usr/local/Ascend/nnal/atb/set_env.sh && \ - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/lib64 && \ + 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 && \ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/${ARCH}-openEuler-linux && \ - cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ + cd /vllm-workspace/Mooncake && \ + bash mooncake_installer.sh -y && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ make -j$(nproc) && make install && \ rm -fr /vllm-workspace/Mooncake/build && \ - yum clean all && \ rm -rf /var/cache/yum/* # Install vLLM ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.11.0 -RUN yum update -y && \ - yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ - yum clean all && \ - rm -rf /var/cache/yum/* - RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/ --extra-index https://download.pytorch.org/whl/cpu/ && \ diff --git a/Dockerfile.openEuler b/Dockerfile.openEuler index f0a24255a10..1ed389176aa 100644 --- a/Dockerfile.openEuler +++ b/Dockerfile.openEuler @@ -29,31 +29,27 @@ WORKDIR /workspace COPY . /vllm-workspace/vllm-ascend/ -ARG ARCH=$(uname -i) +SHELL ["/bin/bash", "-c"] -# Build Mooncake -RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ +RUN yum update -y && \ + yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ + git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /vllm-workspace/Mooncake && \ cp /vllm-workspace/vllm-ascend/tools/mooncake_installer.sh /vllm-workspace/Mooncake/ && \ + ARCH=$(uname -m) && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ - source /usr/local/Ascend/nnal/atb/set_env.sh && \ - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/lib64 && \ + 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 && \ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/${ARCH}-openEuler-linux && \ - cd /vllm-workspace/Mooncake && bash mooncake_installer.sh -y && \ + cd /vllm-workspace/Mooncake && \ + bash mooncake_installer.sh -y && \ mkdir -p build && cd build && cmake .. -DUSE_ASCEND_DIRECT=ON && \ make -j$(nproc) && make install && \ rm -fr /vllm-workspace/Mooncake/build && \ - yum clean all && \ rm -rf /var/cache/yum/* # Install vLLM ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.11.0 -RUN yum update -y && \ - yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl-devel && \ - yum clean all && \ - rm -rf /var/cache/yum/* - RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/ --extra-index https://download.pytorch.org/whl/cpu/ && \