Skip to content

Commit 9804070

Browse files
kebe7junPradyun Ramadorai
authored andcommitted
[CI] Unifying Dockerfiles for ARM and X86 Builds (vllm-project#21343)
Signed-off-by: Kebe <[email protected]>
1 parent 9b6b89f commit 9804070

File tree

5 files changed

+29
-67
lines changed

5 files changed

+29
-67
lines changed

.github/workflows/lint-and-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ permissions:
77

88
jobs:
99
lint-and-deploy:
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-24.04-arm
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

docker/Dockerfile.arm

Lines changed: 0 additions & 62 deletions
This file was deleted.

docker/Dockerfile.cpu

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# This vLLM Dockerfile is used to construct image that can build and run vLLM on x86 CPU platform.
1+
# This vLLM Dockerfile is used to build images that can run vLLM on both x86_64 and arm64 CPU platforms.
2+
#
3+
# Supported platforms:
4+
# - linux/amd64 (x86_64)
5+
# - linux/arm64 (aarch64)
6+
#
7+
# Use the `--platform` option with `docker buildx build` to specify the target architecture, e.g.:
8+
# docker buildx build --platform=linux/arm64 -f docker/Dockerfile.cpu .
29
#
310
# Build targets:
411
# vllm-openai (default): used for serving deployment
@@ -53,7 +60,20 @@ RUN --mount=type=cache,target=/root/.cache/uv \
5360
uv pip install --upgrade pip && \
5461
uv pip install -r requirements/cpu.txt
5562

56-
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:/opt/venv/lib/libiomp5.so:$LD_PRELOAD"
63+
ARG TARGETARCH
64+
ENV TARGETARCH=${TARGETARCH}
65+
66+
RUN if [ "$TARGETARCH" = "arm64" ]; then \
67+
PRELOAD_PATH="/usr/lib/aarch64-linux-gnu/libtcmalloc_minimal.so.4"; \
68+
else \
69+
PRELOAD_PATH="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:/opt/venv/lib/libiomp5.so"; \
70+
fi && \
71+
echo "export LD_PRELOAD=$PRELOAD_PATH" >> ~/.bashrc
72+
73+
# Ensure that the LD_PRELOAD environment variable for export is in effect.
74+
SHELL ["/bin/bash", "-c"]
75+
76+
ENV LD_PRELOAD=${LD_PRELOAD}
5777

5878
RUN echo 'ulimit -c 0' >> ~/.bashrc
5979

docs/getting_started/installation/cpu/arm.inc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Testing has been conducted on AWS Graviton3 instances for compatibility.
3333
# --8<-- [end:pre-built-images]
3434
# --8<-- [start:build-image-from-source]
3535
```bash
36-
docker build -f docker/Dockerfile.arm \
36+
docker build -f docker/Dockerfile.cpu \
3737
--tag vllm-cpu-env .
3838

3939
# Launching OpenAI server

requirements/cpu.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ setuptools>=77.0.3,<80.0.0
1010
--extra-index-url https://download.pytorch.org/whl/cpu
1111
torch==2.6.0+cpu; platform_machine == "x86_64" # torch>2.6.0+cpu has performance regression on x86 platform, see https://github.com/pytorch/pytorch/pull/151218
1212
torch==2.7.0; platform_system == "Darwin"
13-
torch==2.7.0; platform_machine == "ppc64le" or platform_machine == "aarch64"
13+
torch==2.7.0; platform_machine == "ppc64le"
14+
torch==2.6.0; platform_machine == "aarch64" # for arm64 CPUs, torch 2.7.0 has a issue: https://github.com/vllm-project/vllm/issues/17960
1415

1516
# required for the image processor of minicpm-o-2_6, this must be updated alongside torch
1617
torchaudio; platform_machine != "ppc64le" and platform_machine != "s390x"
@@ -25,3 +26,6 @@ datasets # for benchmark scripts
2526
intel-openmp==2024.2.1; platform_machine == "x86_64"
2627
intel_extension_for_pytorch==2.6.0; platform_machine == "x86_64" # torch>2.6.0+cpu has performance regression on x86 platform, see https://github.com/pytorch/pytorch/pull/151218
2728
triton==3.2.0; platform_machine == "x86_64" # Triton is required for torch 2.6+cpu, as it is imported in torch.compile.
29+
30+
# Use this to gather CPU info and optimize based on ARM Neoverse cores
31+
py-cpuinfo; platform_machine == "aarch64"

0 commit comments

Comments
 (0)