Dockerfile.cpu 1.66 KB
Newer Older
1
2
# This vLLM Dockerfile is used to construct image that can build and run vLLM on x86 CPU platform.

3
FROM ubuntu:22.04 AS cpu-test-1
4
5

RUN apt-get update  -y \
6
    && apt-get install -y git wget vim numactl gcc-12 g++-12 python3 python3-pip libtcmalloc-minimal4 \
7
8
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12

9
10
11
12
13
14
15
# https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/performance_tuning/tuning_guide.html
# intel-openmp provides additional performance improvement vs. openmp
# tcmalloc provides better memory allocation efficiency, e.g, holding memory in caches to speed up access of commonly-used objects.
RUN pip install intel-openmp

ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:/usr/local/lib/libiomp5.so:$LD_PRELOAD"

16
17
18

RUN pip install https://intel-extension-for-pytorch.s3.amazonaws.com/ipex_dev/cpu/intel_extension_for_pytorch-2.3.100%2Bgit0eb3473-cp310-cp310-linux_x86_64.whl

19
RUN pip install --upgrade pip \
20
    && pip install wheel packaging ninja "setuptools>=49.4.0" numpy
21

22
23
FROM cpu-test-1 AS build

24
25
26
27
28
29
COPY ./ /workspace/vllm

WORKDIR /workspace/vllm

RUN pip install -v -r requirements-cpu.txt --extra-index-url https://download.pytorch.org/whl/cpu

30
31
32
33
# Support for building with non-AVX512 vLLM: docker build --build-arg VLLM_CPU_DISABLE_AVX512="true" ...
ARG VLLM_CPU_DISABLE_AVX512
ENV VLLM_CPU_DISABLE_AVX512=${VLLM_CPU_DISABLE_AVX512}

34
35
RUN VLLM_TARGET_DEVICE=cpu python3 setup.py install

36
37
WORKDIR /workspace/

38
RUN ln -s /workspace/vllm/tests && ln -s /workspace/vllm/examples && ln -s /workspace/vllm/benchmarks
39

40
ENTRYPOINT ["python3", "-m", "vllm.entrypoints.openai.api_server"]