@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / e904576743
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 16, 19:30 UTC

[CI/Build] Dockerfile.cpu improvements (#7298)

Daniele committed Aug 8, 2024 at 21:24 UTC e90457674380f931bb95c0350af4ad83af568d72
2 files changed +24 -9
.dockerignore
+3
@@ -1 +1,4 @@
1 vllm/*.so
2 +/.venv
3 +/build
4 +dist
Dockerfile.cpu
+21 -9
@@ -2,14 +2,16 @@
2
3 FROM ubuntu:22.04 AS cpu-test-1
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 \
8 && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12
9
10 # https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/performance_tuning/tuning_guide.html
11 # intel-openmp provides additional performance improvement vs. openmp
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
15
16 ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:/usr/local/lib/libiomp5.so:$LD_PRELOAD"
17
@@ -17,22 +19,32 @@ RUN echo 'ulimit -c 0' >> ~/.bashrc
19
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
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
27
28 FROM cpu-test-1 AS build
29
25 -COPY ./ /workspace/vllm
26 -
30 WORKDIR /workspace/vllm
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 ./ ./
38
39 # Support for building with non-AVX512 vLLM: docker build --build-arg VLLM_CPU_DISABLE_AVX512="true" ...
40 ARG VLLM_CPU_DISABLE_AVX512
41 ENV VLLM_CPU_DISABLE_AVX512=${VLLM_CPU_DISABLE_AVX512}
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
48
49 WORKDIR /workspace/
50