|
2 | 2 |
|
3 | 3 | FROM ubuntu:22.04 AS cpu-test-1
|
4 | 4 |
|
5 |
| -RUN apt-get update -y \ |
6 |
| - && apt-get install -y curl git wget vim numactl gcc-12 g++-12 python3 python3-pip libtcmalloc-minimal4 libnuma-dev \ |
| 5 | +RUN --mount=type=cache,target=/var/cache/apt \ |
| 6 | + apt-get update -y \ |
| 7 | + && apt-get install -y curl ccache git wget vim numactl gcc-12 g++-12 python3 python3-pip libtcmalloc-minimal4 libnuma-dev \ |
7 | 8 | && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12
|
8 | 9 |
|
9 | 10 | # https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/performance_tuning/tuning_guide.html
|
10 | 11 | # intel-openmp provides additional performance improvement vs. openmp
|
11 | 12 | # tcmalloc provides better memory allocation efficiency, e.g, holding memory in caches to speed up access of commonly-used objects.
|
12 |
| -RUN pip install intel-openmp |
| 13 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 14 | + pip install intel-openmp |
13 | 15 |
|
14 | 16 | ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:/usr/local/lib/libiomp5.so:$LD_PRELOAD"
|
15 | 17 |
|
16 | 18 | RUN echo 'ulimit -c 0' >> ~/.bashrc
|
17 | 19 |
|
18 | 20 | RUN pip install https://intel-extension-for-pytorch.s3.amazonaws.com/ipex_dev/cpu/intel_extension_for_pytorch-2.4.0%2Bgitfbaa4bc-cp310-cp310-linux_x86_64.whl
|
19 | 21 |
|
20 |
| -RUN pip install --upgrade pip \ |
21 |
| - && pip install wheel packaging ninja "setuptools>=49.4.0" numpy |
| 22 | +ENV PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu |
| 23 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 24 | + --mount=type=bind,src=requirements-build.txt,target=requirements-build.txt \ |
| 25 | + pip install --upgrade pip && \ |
| 26 | + pip install -r requirements-build.txt |
22 | 27 |
|
23 | 28 | FROM cpu-test-1 AS build
|
24 | 29 |
|
25 |
| -COPY ./ /workspace/vllm |
26 |
| - |
27 | 30 | WORKDIR /workspace/vllm
|
28 | 31 |
|
29 |
| -RUN pip install -v -r requirements-cpu.txt --extra-index-url https://download.pytorch.org/whl/cpu |
| 32 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 33 | + --mount=type=bind,src=requirements-common.txt,target=requirements-common.txt \ |
| 34 | + --mount=type=bind,src=requirements-cpu.txt,target=requirements-cpu.txt \ |
| 35 | + pip install -v -r requirements-cpu.txt |
| 36 | + |
| 37 | +COPY ./ ./ |
30 | 38 |
|
31 | 39 | # Support for building with non-AVX512 vLLM: docker build --build-arg VLLM_CPU_DISABLE_AVX512="true" ...
|
32 | 40 | ARG VLLM_CPU_DISABLE_AVX512
|
33 | 41 | ENV VLLM_CPU_DISABLE_AVX512=${VLLM_CPU_DISABLE_AVX512}
|
34 | 42 |
|
35 |
| -RUN VLLM_TARGET_DEVICE=cpu python3 setup.py install |
| 43 | +ENV CCACHE_DIR=/root/.cache/ccache |
| 44 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 45 | + --mount=type=cache,target=/root/.cache/ccache \ |
| 46 | + VLLM_TARGET_DEVICE=cpu python3 setup.py bdist_wheel && \ |
| 47 | + pip install dist/*.whl |
36 | 48 |
|
37 | 49 | WORKDIR /workspace/
|
38 | 50 |
|
|
0 commit comments