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

3
4
5
6
7
WORKDIR /workspace/

ARG PYTHON_VERSION=3.12
ARG PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/xpu"

8
9
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 && \
10
    add-apt-repository -y ppa:kobuk-team/intel-graphics
11

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

30
31
32
33
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

34
35
36
37
38
39
ENV PATH="/root/.local/bin:$PATH"
ENV VIRTUAL_ENV="/opt/venv"
ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
40
41

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

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

54
55
WORKDIR /workspace/vllm

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
ENV UV_HTTP_TIMEOUT=500

# Configure package index for XPU
ENV PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL}
ENV UV_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL}
ENV UV_INDEX_STRATEGY="unsafe-best-match"
ENV UV_LINK_MODE="copy"

RUN --mount=type=cache,target=/root/.cache/uv \
    --mount=type=bind,src=requirements/common.txt,target=/workspace/vllm/requirements/common.txt \
    --mount=type=bind,src=requirements/xpu.txt,target=/workspace/vllm/requirements/xpu.txt \
    uv pip install --upgrade pip && \
    uv pip install -r requirements/xpu.txt

 # used for suffix method speculative decoding
 # build deps for proto + nanobind-based extensions to set up the build environment
RUN --mount=type=cache,target=/root/.cache/uv \
    uv pip install grpcio-tools protobuf nanobind
 # arctic-inference is built from source which needs torch-xpu properly installed first
RUN --mount=type=cache,target=/root/.cache/uv \
    source /opt/intel/oneapi/setvars.sh --force && \
    source /opt/intel/oneapi/ccl/2021.15/env/vars.sh --force && \
    export CMAKE_PREFIX_PATH="$(python -c 'import site; print(site.getsitepackages()[0])'):${CMAKE_PREFIX_PATH}" && \
    uv pip install --no-build-isolation arctic-inference==0.1.1
80

81
82
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"

83
COPY . .
84
ARG GIT_REPO_CHECK=0
85
86
RUN --mount=type=bind,source=.git,target=.git \
    if [ "$GIT_REPO_CHECK" != 0 ]; then bash tools/check_repo.sh; fi
87
88

ENV VLLM_TARGET_DEVICE=xpu
89
ENV VLLM_WORKER_MULTIPROC_METHOD=spawn
90

91
RUN --mount=type=cache,target=/root/.cache/uv \
92
    --mount=type=bind,source=.git,target=.git \
93
    uv pip install --no-build-isolation .
94
95

CMD ["/bin/bash"]
96
97
98
99

FROM vllm-base AS vllm-openai

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

youkaichao's avatar
youkaichao committed
103
# install development dependencies (for testing)
104
RUN uv pip install -e tests/vllm_test_utils
105
106

# install nixl from source code
107
ENV NIXL_VERSION=0.7.0
108
RUN python /workspace/vllm/tools/install_nixl_from_source_ubuntu.py
109

110
# FIX triton
111
112
113
RUN --mount=type=cache,target=/root/.cache/uv \
    uv pip uninstall triton triton-xpu && \
    uv pip install triton-xpu==3.6.0
114

115
# remove torch bundled oneccl to avoid conflicts
116
117
RUN --mount=type=cache,target=/root/.cache/uv \
    uv pip uninstall oneccl oneccl-devel
118

119
ENTRYPOINT ["vllm", "serve"]