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

Fixed ppc build when it runs on non-RHEL based linux distros (#18422)

Signed-off-by: Nishidha Panpaliya <nishidha.panpaliya@partner.ibm.com> Signed-off-by: Md. Shafi Hussain <Md.Shafi.Hussain@ibm.com> Signed-off-by: npanpaliya <nishidha.panpaliya@partner.ibm.com> Co-authored-by: Md. Shafi Hussain <Md.Shafi.Hussain@ibm.com>

Nishidha committed Jun 7, 2025 at 00:24 UTC 94ecee628258a2a62af06e92530128582e8f165e
2 files changed +71 -26
.buildkite/scripts/hardware_ci/run-cpu-test-ppc64le.sh
+1
@@ -7,6 +7,7 @@ set -ex
7 # Setup cleanup
8 remove_docker_container() {
9 if [[ -n "$container_id" ]]; then
10 + podman stop --all -t0
11 podman rm -f "$container_id" || true
12 fi
13 podman system prune -f
docker/Dockerfile.ppc64le
+70 -26
@@ -1,10 +1,41 @@
1 ARG BASE_UBI_IMAGE_TAG=9.5-1741850109
2
3 +###############################################################
4 +# Stage to build openblas
5 +###############################################################
6 +
7 +FROM registry.access.redhat.com/ubi9/ubi-minimal:${BASE_UBI_IMAGE_TAG} AS openblas-builder
8 +
9 +ARG MAX_JOBS
10 +ARG OPENBLAS_VERSION=0.3.29
11 +RUN microdnf install -y dnf && dnf install -y gcc-toolset-13 make wget unzip \
12 + && source /opt/rh/gcc-toolset-13/enable \
13 + && wget https://github.com/OpenMathLib/OpenBLAS/releases/download/v$OPENBLAS_VERSION/OpenBLAS-$OPENBLAS_VERSION.zip \
14 + && unzip OpenBLAS-$OPENBLAS_VERSION.zip \
15 + && cd OpenBLAS-$OPENBLAS_VERSION \
16 + && make -j${MAX_JOBS} TARGET=POWER9 BINARY=64 USE_OPENMP=1 USE_THREAD=1 NUM_THREADS=120 DYNAMIC_ARCH=1 INTERFACE64=0 \
17 + && cd /tmp && touch control
18 +
19 +
20 +###############################################################
21 +# base stage with dependencies coming from centos mirrors
22 +###############################################################
23 +FROM registry.access.redhat.com/ubi9/ubi-minimal:${BASE_UBI_IMAGE_TAG} AS centos-deps-builder
24 +RUN microdnf install -y dnf && \
25 + dnf install -y https://mirror.stream.centos.org/9-stream/BaseOS/`arch`/os/Packages/centos-gpg-keys-9.0-24.el9.noarch.rpm \
26 + https://mirror.stream.centos.org/9-stream/BaseOS/`arch`/os/Packages/centos-stream-repos-9.0-24.el9.noarch.rpm \
27 + https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
28 + dnf config-manager --set-enabled crb
29 +
30 +RUN dnf install -y openjpeg2-devel lcms2-devel tcl-devel tk-devel fribidi-devel && \
31 + dnf remove -y centos-gpg-keys-9.0-24.el9.noarch centos-stream-repos-9.0-24.el9.noarch
32 +
33 +
34 ###############################################################
35 # base stage with basic dependencies
36 ###############################################################
37
7 -FROM registry.access.redhat.com/ubi9/ubi-minimal:${BASE_UBI_IMAGE_TAG} AS base-builder
38 +FROM centos-deps-builder AS base-builder
39
40 ARG PYTHON_VERSION=3.12
41 ARG OPENBLAS_VERSION=0.3.29
@@ -20,25 +51,27 @@ ENV UV_LINK_MODE=copy
51 # Note: A symlink for libatomic.so is created for gcc-13 (linker fails to find libatomic otherwise - reqd. for sentencepiece)
52 # Note: A dummy file 'control' is created in /tmp/ to artificially create dependencies between stages when building stages in parallel
53 # when `--jobs=<N>` is passed with podman build command
23 -RUN microdnf install -y openssl-devel dnf \
24 - && dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
25 - && dnf config-manager --set-enabled codeready-builder-for-rhel-9-ppc64le-rpms \
54 +
55 +COPY --from=openblas-builder /tmp/control /dev/null
56 +
57 +RUN --mount=type=bind,from=openblas-builder,source=/OpenBLAS-$OPENBLAS_VERSION/,target=/openblas/,rw \
58 + dnf install -y openssl-devel \
59 && dnf install -y \
27 - git tar gcc-toolset-13 automake libtool numactl-devel lapack-devel \
60 + git tar gcc-toolset-13 automake libtool \
61 pkgconfig xsimd zeromq-devel kmod findutils protobuf* \
29 - libtiff-devel libjpeg-devel openjpeg2-devel zlib-devel \
30 - freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel \
31 - harfbuzz-devel fribidi-devel libraqm-devel libimagequant-devel libxcb-devel \
62 + libtiff-devel libjpeg-devel zlib-devel freetype-devel libwebp-devel \
63 + harfbuzz-devel libraqm-devel libimagequant-devel libxcb-devel \
64 python${PYTHON_VERSION}-devel python${PYTHON_VERSION}-pip \
65 && dnf clean all \
66 + && PREFIX=/usr/local make -C /openblas install \
67 && ln -sf /usr/lib64/libatomic.so.1 /usr/lib64/libatomic.so \
68 && python${PYTHON_VERSION} -m venv ${VIRTUAL_ENV} \
69 && python -m pip install -U pip uv \
70 && uv pip install wheel build "setuptools<70" setuptools_scm setuptools_rust meson-python 'cmake<4' ninja cython scikit_build_core scikit_build \
38 - && curl -sL https://ftp2.osuosl.org/pub/ppc64el/openblas/latest/Openblas_${OPENBLAS_VERSION}_ppc64le.tar.gz | tar xvf - -C /usr/local \
71 && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
72 && cd /tmp && touch control
73
74 +
75 ###############################################################
76 # Stage to build torch family
77 ###############################################################
@@ -48,6 +81,8 @@ FROM base-builder AS torch-builder
81 ARG MAX_JOBS
82 ARG TORCH_VERSION=2.6.0
83 ARG _GLIBCXX_USE_CXX11_ABI=1
84 +ARG OPENBLAS_VERSION=0.3.29
85 +
86 RUN --mount=type=cache,target=/root/.cache/uv \
87 source /opt/rh/gcc-toolset-13/enable && \
88 git clone --recursive https://github.com/pytorch/pytorch.git -b v${TORCH_VERSION} && \
@@ -109,7 +144,8 @@ RUN --mount=type=cache,target=/root/.cache/uv \
144 .. && \
145 make install -j ${MAX_JOBS:-$(nproc)} && \
146 cd ../../python/ && \
112 - uv pip install -v -r requirements-wheel-build.txt && \
147 + uv pip install -v -r requirements-build.txt && uv pip install numpy==2.1.3 && \
148 + pip show numpy && ls -lrt /opt/vllm/lib/python3.12/site-packages/numpy && \
149 PYARROW_PARALLEL=${PYARROW_PARALLEL:-$(nproc)} \
150 python setup.py build_ext \
151 --build-type=release --bundle-arrow-cpp \
@@ -132,8 +168,25 @@ RUN --mount=type=cache,target=/root/.cache/uv \
168 cd opencv-python && \
169 sed -i -E -e 's/"setuptools.+",/"setuptools",/g' pyproject.toml && \
170 cd opencv && git cherry-pick --no-commit $OPENCV_PATCH && cd .. && \
171 + uv pip install scikit-build && \
172 python -m build --wheel --installer=uv --outdir /opencvwheels/
173
174 +###############################################################
175 +# Stage to build numactl
176 +###############################################################
177 +
178 +FROM base-builder AS numa-builder
179 +
180 +# Note: Building numactl with gcc-11. Compiling with gcc-13 in this builder stage will
181 +# trigger recompilation with gcc-11 (and require libtool) in the final stage where we do not have gcc-13
182 +ARG MAX_JOBS
183 +ARG NUMACTL_VERSION=2.0.19
184 +RUN git clone --recursive https://github.com/numactl/numactl.git -b v${NUMACTL_VERSION} \
185 + && cd numactl \
186 + && autoreconf -i && ./configure \
187 + && make -j ${MAX_JOBS:-$(nproc)}
188 +
189 +
190 ###############################################################
191 # Stage to build vllm - this stage builds and installs
192 # vllm, tensorizer and vllm-tgis-adapter and builds uv cache
@@ -145,6 +198,7 @@ FROM base-builder AS vllmcache-builder
198 COPY --from=torch-builder /tmp/control /dev/null
199 COPY --from=arrow-builder /tmp/control /dev/null
200 COPY --from=cv-builder /tmp/control /dev/null
201 +COPY --from=numa-builder /tmp/control /dev/null
202
203 ARG VLLM_TARGET_DEVICE=cpu
204 ARG GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
@@ -160,11 +214,13 @@ RUN --mount=type=cache,target=/root/.cache/uv \
214 --mount=type=bind,from=torch-builder,source=/torchwheels/,target=/torchwheels/,ro \
215 --mount=type=bind,from=arrow-builder,source=/arrowwheels/,target=/arrowwheels/,ro \
216 --mount=type=bind,from=cv-builder,source=/opencvwheels/,target=/opencvwheels/,ro \
217 + --mount=type=bind,from=numa-builder,source=/numactl/,target=/numactl/,rw \
218 --mount=type=bind,src=.,dst=/src/,rw \
219 source /opt/rh/gcc-toolset-13/enable && \
220 uv pip install /opencvwheels/*.whl /arrowwheels/*.whl /torchwheels/*.whl && \
221 sed -i -e 's/.*torch.*//g' /src/pyproject.toml /src/requirements/*.txt && \
222 uv pip install pandas pythran pybind11 /hf_wheels/*.whl && \
223 + make -C /numactl install && \
224 # sentencepiece.pc is in some pkgconfig inside uv cache
225 export PKG_CONFIG_PATH=$(find / -type d -name "pkgconfig" 2>/dev/null | tr '\n' ':') && \
226 uv pip install -r /src/requirements/common.txt -r /src/requirements/cpu.txt -r /src/requirements/build.txt --no-build-isolation && \
@@ -173,21 +229,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
229 uv pip install /vllmwheel/*.whl
230
231
176 -###############################################################
177 -# Stage to build numactl
178 -###############################################################
179 -
180 -FROM base-builder AS numa-builder
181 -
182 -# Note: Building numactl with gcc-11. Compiling with gcc-13 in this builder stage will
183 -# trigger recompilation with gcc-11 (and require libtool) in the final stage where we do not have gcc-13
184 -ARG MAX_JOBS
185 -ARG NUMACTL_VERSION=2.0.19
186 -RUN git clone --recursive https://github.com/numactl/numactl.git -b v${NUMACTL_VERSION} \
187 - && cd numactl \
188 - && autoreconf -i && ./configure \
189 - && make -j ${MAX_JOBS:-$(nproc)}
190 -
232 ###############################################################
233 # Stage to build lapack
234 ###############################################################
@@ -217,6 +258,7 @@ ENV PATH=${VIRTUAL_ENV}/bin:$PATH
258 ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
259 ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib
260 ENV UV_LINK_MODE=copy
261 +ENV OMP_NUM_THREADS=16
262
263 # create artificial dependencies between stages for independent stages to build in parallel
264 COPY --from=torch-builder /tmp/control /dev/null
@@ -225,11 +267,13 @@ COPY --from=cv-builder /tmp/control /dev/null
267 COPY --from=vllmcache-builder /tmp/control /dev/null
268 COPY --from=numa-builder /tmp/control /dev/null
269 COPY --from=lapack-builder /tmp/control /dev/null
270 +COPY --from=openblas-builder /tmp/control /dev/null
271
272 # install gcc-11, python, openblas, numactl, lapack
273 RUN --mount=type=cache,target=/root/.cache/uv \
274 --mount=type=bind,from=numa-builder,source=/numactl/,target=/numactl/,rw \
275 --mount=type=bind,from=lapack-builder,source=/lapack/,target=/lapack/,rw \
276 + --mount=type=bind,from=openblas-builder,source=/OpenBLAS-$OPENBLAS_VERSION/,target=/openblas/,rw \
277 rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
278 microdnf install --nodocs -y \
279 tar findutils openssl \
@@ -241,8 +285,8 @@ RUN --mount=type=cache,target=/root/.cache/uv \
285 && microdnf clean all \
286 && python${PYTHON_VERSION} -m venv ${VIRTUAL_ENV} \
287 && python -m pip install -U pip uv --no-cache \
244 - && curl -sL https://ftp2.osuosl.org/pub/ppc64el/openblas/latest/Openblas_${OPENBLAS_VERSION}_ppc64le.tar.gz | tar xvf - -C /usr/local \
288 && make -C /numactl install \
289 + && PREFIX=/usr/local make -C /openblas install \
290 && uv pip install 'cmake<4' \
291 && cmake --install /lapack/build \
292 && uv pip uninstall cmake