@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / e04492449e
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 13, 18:15 UTC

[Hardware][IBM Z] Optimize s390x Dockerfile (#28023)

Signed-off-by: Rehan Khan <Rehan.Khan7@ibm.com>

R3hankhan committed Nov 6, 2025 at 00:55 UTC e04492449eeb1ca945ce08b2740ea75bddd0c8a9
3 files changed +14 -60
docker/Dockerfile.s390x
+11 -57
@@ -14,7 +14,7 @@ ENV LANG=C.UTF-8 \
14
15 # Install development utilities
16 RUN microdnf install -y \
17 - which procps findutils tar vim git gcc gcc-gfortran g++ make patch zlib-devel \
17 + which procps findutils tar vim git gcc-toolset-14 gcc-toolset-14-libatomic-devel patch zlib-devel \
18 libjpeg-turbo-devel libtiff-devel libpng-devel libwebp-devel freetype-devel harfbuzz-devel \
19 openssl-devel openblas openblas-devel autoconf automake libtool cmake numpy libsndfile \
20 clang llvm-devel llvm-static clang-devel && \
@@ -85,40 +85,15 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
85 rustup default stable && \
86 rustup show
87
88 -FROM python-install AS torch
89 -ARG TORCH_VERSION=2.7.0
90 -ENV export _GLIBCXX_USE_CXX11_ABI=1
91 -ENV CARGO_HOME=/root/.cargo
92 -ENV RUSTUP_HOME=/root/.rustup
93 -ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
94 -
95 -WORKDIR /tmp
96 -
97 -RUN --mount=type=cache,target=/root/.cache/uv \
98 - --mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
99 - --mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
100 - git clone https://github.com/pytorch/pytorch.git && \
101 - cd pytorch && \
102 - git checkout v2.7.0 && \
103 - git submodule sync && \
104 - git submodule update --init --recursive && \
105 - uv pip install cmake ninja && \
106 - uv pip install -r requirements.txt && \
107 - python setup.py bdist_wheel
108 -
109 -
88 FROM python-install AS torch-vision
89 # Install torchvision
112 -ARG TORCH_VERSION=2.7.0
113 -ARG TORCH_VISION_VERSION=v0.20.1
90 +ARG TORCH_VISION_VERSION=v0.23.0
91 WORKDIR /tmp
92 RUN --mount=type=cache,target=/root/.cache/uv \
116 - --mount=type=bind,from=torch,source=/tmp/pytorch/dist,target=/tmp/torch-wheels/ \
93 git clone https://github.com/pytorch/vision.git && \
94 cd vision && \
95 git checkout $TORCH_VISION_VERSION && \
120 - TORCH_WHL_FILE=$(ls /tmp/torch-wheels/*.whl | head -n 1) && \
121 - uv pip install -v $TORCH_WHL_FILE && \
96 + uv pip install torch==2.8.0 --index-url https://download.pytorch.org/whl/cpu && \
97 python setup.py bdist_wheel
98
99 FROM python-install AS hf-xet-builder
@@ -199,26 +174,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
174 if ! grep '#include "dynamic_annotations.h"' numba/_dispatcher.cpp; then \
175 sed -i '/#include "internal\/pycore_atomic.h"/i\#include "dynamic_annotations.h"' numba/_dispatcher.cpp; \
176 fi && python setup.py bdist_wheel
202 -
203 -# Edit aws-lc-sys to support s390x
204 -FROM python-install AS aws-lc-sys-editor
205 -WORKDIR /tmp
206 -ENV CARGO_HOME=/root/.cargo
207 -ENV RUSTUP_HOME=/root/.rustup
208 -ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
209 -ARG AWS_LC_VERSION=v0.30.0
210 -RUN --mount=type=cache,target=/root/.cache/uv \
211 - --mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
212 - --mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
213 - git clone --recursive https://github.com/aws/aws-lc-rs.git && \
214 - cd aws-lc-rs && \
215 - git checkout tags/aws-lc-sys/${AWS_LC_VERSION} && \
216 - git submodule sync && \
217 - git submodule update --init --recursive && \
218 - cd aws-lc-sys && \
219 - sed -i '682 s/strncmp(buf, "-----END ", 9)/memcmp(buf, "-----END ", 9)/' aws-lc/crypto/pem/pem_lib.c && \
220 - sed -i '712 s/strncmp(buf, "-----END ", 9)/memcmp(buf, "-----END ", 9)/' aws-lc/crypto/pem/pem_lib.c && \
221 - sed -i '747 s/strncmp(buf, "-----END ", 9)/memcmp(buf, "-----END ", 9)/' aws-lc/crypto/pem/pem_lib.c
177
178 # Build Outlines Core
179 FROM python-install AS outlines-core-builder
@@ -226,17 +181,17 @@ WORKDIR /tmp
181 ENV CARGO_HOME=/root/.cargo
182 ENV RUSTUP_HOME=/root/.rustup
183 ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
229 -ARG OUTLINES_CORE_VERSION=0.2.10
184 +COPY requirements/common.txt /tmp/requirements/common.txt
185 +ARG OUTLINES_CORE_VERSION
186 RUN --mount=type=cache,target=/root/.cache/uv \
187 --mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
188 --mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
233 - --mount=type=bind,from=aws-lc-sys-editor,source=/tmp/aws-lc-rs/aws-lc-sys,target=/tmp/aws-lc-sys,rw \
189 + OUTLINES_CORE_VERSION=${OUTLINES_CORE_VERSION:-$(grep -E '^outlines_core\s*==\s*[0-9.]+' /tmp/requirements/common.txt | grep -Eo '[0-9.]+')} && \
190 + if [ -z "${OUTLINES_CORE_VERSION}" ]; then echo "ERROR: Could not determine outlines_core version"; exit 1; fi && \
191 git clone https://github.com/dottxt-ai/outlines-core.git && \
192 cd outlines-core && \
193 git checkout tags/${OUTLINES_CORE_VERSION} && \
194 sed -i "s/version = \"0.0.0\"/version = \"${OUTLINES_CORE_VERSION}\"/" Cargo.toml && \
238 - echo '[patch.crates-io]' >> Cargo.toml && \
239 - echo 'aws-lc-sys = { path = "/tmp/aws-lc-sys" }' >> Cargo.toml && \
195 uv pip install maturin && \
196 python -m maturin build --release --out dist
197
@@ -245,13 +200,15 @@ FROM python-install AS vllm-cpu
200 ARG PYTHON_VERSION
201
202 # Set correct library path for torch and numactl
248 -ENV LD_LIBRARY_PATH="/opt/vllm/lib64/python${PYTHON_VERSION}/site-packages/torch/lib:/usr/local/lib:$LD_LIBRARY_PATH"
203 +ENV LD_LIBRARY_PATH="/opt/vllm/lib64/python${PYTHON_VERSION}/site-packages/torch/lib:/usr/local/lib:/opt/rh/gcc-toolset-14/root/usr/lib64:$LD_LIBRARY_PATH"
204 ENV C_INCLUDE_PATH="/usr/local/include:$C_INCLUDE_PATH"
205 ENV UV_LINK_MODE=copy
206 ENV CARGO_HOME=/root/.cargo
207 ENV RUSTUP_HOME=/root/.rustup
253 -ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
208 ENV GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
209 +ENV PCP_DIR=/opt/rh/gcc-toolset-14/root
210 +ENV PKG_CONFIG_PATH="/opt/rh/gcc-toolset-14/root/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig/"
211 +ENV PATH="${VIRTUAL_ENV:+${VIRTUAL_ENV}/bin}:/opt/rh/gcc-toolset-14/root/usr/bin:/usr/local/bin:$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
212
213 COPY . /workspace/vllm
214 WORKDIR /workspace/vllm
@@ -266,7 +223,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
223 --mount=type=bind,from=pyarrow,source=/tmp/arrow/python/dist,target=/tmp/arrow-wheels \
224 --mount=type=bind,from=torch-vision,source=/tmp/vision/dist,target=/tmp/vision-wheels/ \
225 --mount=type=bind,from=hf-xet-builder,source=/tmp/hf-xet/dist,target=/tmp/hf-xet-wheels/ \
269 - --mount=type=bind,from=torch,source=/tmp/pytorch/dist,target=/tmp/torch-wheels/ \
226 --mount=type=bind,from=numba-builder,source=/tmp/llvmlite/dist,target=/tmp/llvmlite-wheels/ \
227 --mount=type=bind,from=numba-builder,source=/tmp/numba/dist,target=/tmp/numba-wheels/ \
228 --mount=type=bind,from=outlines-core-builder,source=/tmp/outlines-core/dist,target=/tmp/outlines-core/dist/ \
@@ -274,7 +230,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
230 ARROW_WHL_FILE=$(ls /tmp/arrow-wheels/pyarrow-*.whl) && \
231 VISION_WHL_FILE=$(ls /tmp/vision-wheels/*.whl) && \
232 HF_XET_WHL_FILE=$(ls /tmp/hf-xet-wheels/*.whl) && \
277 - TORCH_WHL_FILE=$(ls /tmp/torch-wheels/*.whl) && \
233 LLVM_WHL_FILE=$(ls /tmp/llvmlite-wheels/*.whl) && \
234 NUMBA_WHL_FILE=$(ls /tmp/numba-wheels/*.whl) && \
235 OUTLINES_CORE_WHL_FILE=$(ls /tmp/outlines-core/dist/*.whl) && \
@@ -282,7 +237,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
237 $ARROW_WHL_FILE \
238 $VISION_WHL_FILE \
239 $HF_XET_WHL_FILE \
285 - $TORCH_WHL_FILE \
240 $LLVM_WHL_FILE \
241 $NUMBA_WHL_FILE \
242 $OUTLINES_CORE_WHL_FILE \
requirements/common.txt
+2 -2
@@ -19,12 +19,12 @@ pillow # Required for image processing
19 prometheus-fastapi-instrumentator >= 7.0.0
20 tiktoken >= 0.6.0 # Required for DBRX tokenizer
21 lm-format-enforcer == 0.11.3
22 -llguidance >= 0.7.11, < 0.8.0; platform_machine == "x86_64" or platform_machine == "arm64" or platform_machine == "aarch64"
22 +llguidance >= 0.7.11, < 0.8.0; platform_machine == "x86_64" or platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "s390x"
23 outlines_core == 0.2.11
24 # required for outlines backend disk cache
25 diskcache == 5.6.3
26 lark == 1.2.2
27 -xgrammar == 0.1.25; platform_machine == "x86_64" or platform_machine == "aarch64" or platform_machine == "arm64"
27 +xgrammar == 0.1.25; platform_machine == "x86_64" or platform_machine == "aarch64" or platform_machine == "arm64" or platform_machine == "s390x"
28 typing_extensions >= 4.10
29 filelock >= 3.16.1 # need to contain https://github.com/tox-dev/filelock/pull/317
30 partial-json-parser # used for parsing partial JSON outputs
requirements/cpu.txt
+1 -1
@@ -7,7 +7,7 @@ numba == 0.61.2; platform_machine != "s390x" # Required for N-gram speculative d
7 packaging>=24.2
8 setuptools>=77.0.3,<80.0.0
9 --extra-index-url https://download.pytorch.org/whl/cpu
10 -torch==2.8.0+cpu; platform_machine == "x86_64"
10 +torch==2.8.0+cpu; platform_machine == "x86_64" or platform_machine == "s390x"
11 torch==2.8.0; platform_system == "Darwin"
12 torch==2.8.0; platform_machine == "ppc64le" or platform_machine == "aarch64"
13