Dockerfile.xpu 3.8 KB
Newer Older
1
FROM intel/deep-learning-essentials:2025.3.2-0-devel-ubuntu24.04 AS vllm-base
2

3
4
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \
    echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \
5
    add-apt-repository -y ppa:kobuk-team/intel-graphics
6

7
RUN apt clean && apt-get update -y && \
8
9
10
11
12
13
14
15
16
    apt-get install -y --no-install-recommends --fix-missing \
    curl \
    ffmpeg \
    git \
    libsndfile1 \
    libsm6 \
    libxext6 \
    libgl1 \
    lsb-release \
17
    libaio-dev \
18
    numactl \
19
20
21
22
23
    wget \
    vim \
    python3.12 \
    python3.12-dev \
    python3-pip
24

25
26
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
27

28
29
30
31
RUN apt update && apt upgrade -y && \
    apt install -y libze1 libze-dev libze-intel-gpu1 intel-opencl-icd libze-intel-gpu-raytracing intel-ocloc && \
    apt install -y intel-oneapi-compiler-dpcpp-cpp-2025.3

32
33

# This oneccl contains the BMG support which is not the case for default version of oneapi 2025.2.
34
ARG ONECCL_INSTALLER="intel-oneccl-2021.15.7.8_offline.sh"
35
36
37
RUN wget "https://github.com/uxlfoundation/oneCCL/releases/download/2021.15.7/${ONECCL_INSTALLER}" && \
    bash "${ONECCL_INSTALLER}" -a --silent --eula accept && \
    rm "${ONECCL_INSTALLER}" && \
38
39
    echo "source /opt/intel/oneapi/setvars.sh --force" >> /root/.bashrc && \
    echo "source /opt/intel/oneapi/ccl/2021.15/env/vars.sh --force" >> /root/.bashrc
40
41
RUN rm -f /opt/intel/oneapi/ccl/latest && \
    ln -s /opt/intel/oneapi/ccl/2021.15 /opt/intel/oneapi/ccl/latest
42
43
44

SHELL ["bash", "-c"]
CMD ["bash", "-c", "source /root/.bashrc && exec bash"]
45

46
WORKDIR /workspace/vllm
47
48
COPY requirements/xpu.txt /workspace/vllm/requirements/xpu.txt
COPY requirements/common.txt /workspace/vllm/requirements/common.txt
49

50
51
52
# suppress the python externally managed environment error
RUN python3 -m pip config set global.break-system-packages true

53
RUN --mount=type=cache,target=/root/.cache/pip \
54
    pip install --no-cache-dir \
55
    -r requirements/xpu.txt
56

57
58
59
60
61
# arctic-inference is built from source which needs torch-xpu properly installed
# used for suffix method speculative decoding
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install --no-cache-dir arctic-inference==0.1.1

62
63
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"

64
COPY . .
65
ARG GIT_REPO_CHECK=0
66
67
RUN --mount=type=bind,source=.git,target=.git \
    if [ "$GIT_REPO_CHECK" != 0 ]; then bash tools/check_repo.sh; fi
68
69

ENV VLLM_TARGET_DEVICE=xpu
70
ENV VLLM_WORKER_MULTIPROC_METHOD=spawn
71

72
73
RUN --mount=type=cache,target=/root/.cache/pip \
    --mount=type=bind,source=.git,target=.git \
74
    pip install --no-build-isolation .
75
76

CMD ["/bin/bash"]
77
78
79
80
81

FROM vllm-base AS vllm-openai

# install additional dependencies for openai api server
RUN --mount=type=cache,target=/root/.cache/pip \
82
    pip install accelerate hf_transfer pytest pytest_asyncio lm_eval[api] modelscope
83

youkaichao's avatar
youkaichao committed
84
85
# install development dependencies (for testing)
RUN python3 -m pip install -e tests/vllm_test_utils
86
87

# install nixl from source code
88
ENV NIXL_VERSION=0.7.0
89
90
RUN python3 /workspace/vllm/tools/install_nixl_from_source_ubuntu.py

91
92
93
# FIX triton
RUN --mount=type=cache,target=/root/.cache/pip pip uninstall triton triton-xpu -y && pip install triton-xpu==3.6.0 --extra-index-url=https://download.pytorch.org/whl/xpu

94
95
96
# PyJWT-2.7.0 will influence some wheel behaviors, remove its dist-info to avoid conflicts
RUN rm /usr/lib/python3/dist-packages/PyJWT-2.7.0.dist-info/ -rf

97
# remove torch bundled oneccl to avoid conflicts
98
99
100
RUN --mount=type=cache,target=/root/.cache/pip \
    pip uninstall oneccl oneccl-devel -y

101
ENTRYPOINT ["vllm", "serve"]