-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Adding cpu inference with VXE ISA for s390x architecture #12613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7c83d34
s390x vector intrinsics support for vLLM
dilipgb 561eca8
dockerising and requirements-cpu for vllm
rishikakedia 0fc4f37
corrected extension for cpu_types_vxe.cpp to cpu_types_vxe.hpp
dilipgb edd02fa
addressing review comments
dilipgb c22c9da
change base image to ubi-minimal and incorporate review comments
dilipgb 222b54c
incorporate review comments
dilipgb 822a4eb
Merge branch 'vllm-project:main' into s390x/vllm
dilipgb 2b3c023
Merge branch 'vllm-project:main' into s390x/vllm
dilipgb 02554db
correct virtual env path
dilipgb 44250f8
Merge branch 'vllm-project:main' into s390x/vllm
dilipgb c57ceab
incorporating review comments
dilipgb 2dcb4a9
refactor: optimize the Docker layers
dilipgb d8bf9e2
refactor: optimize the Docker layers
dilipgb 40afba6
Merge branch 'vllm-project:main' into s390x/vllm
dilipgb 03c3c09
use only uv cache and remove pip cache dir
dilipgb ebe9541
Merge branch 'vllm-project:main' into s390x/vllm
dilipgb 272cf03
chore: upgrade pytorch
dilipgb 3ce44c7
fix: needs gcc-fortran to install scipy
dilipgb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,151 @@ | ||||||||
# Base UBI image for s390x architecture | ||||||||
ARG BASE_UBI_IMAGE_TAG=9.5-1736404155 | ||||||||
ARG PYTHON_VERSION=3.12 | ||||||||
FROM registry.access.redhat.com/ubi9/ubi-minimal:${BASE_UBI_IMAGE_TAG} as base | ||||||||
|
||||||||
# Install basic dependencies | ||||||||
ARG PYTHON_VERSION | ||||||||
ENV PYTHON_VERSION=${PYTHON_VERSION} | ||||||||
RUN microdnf -y update && microdnf install -y \ | ||||||||
python${PYTHON_VERSION}-pip python${PYTHON_VERSION}-wheel \ | ||||||||
&& microdnf clean all | ||||||||
|
||||||||
WORKDIR /workspace | ||||||||
|
||||||||
ENV LANG=C.UTF-8 \ | ||||||||
LC_ALL=C.UTF-8 | ||||||||
|
||||||||
# Install development utilities | ||||||||
RUN microdnf install -y \ | ||||||||
which procps findutils tar vim git gcc g++ make patch make cython cargo zlib-devel \ | ||||||||
libjpeg-turbo-devel libtiff-devel libpng-devel libwebp-devel freetype-devel harfbuzz-devel \ | ||||||||
openssl-devel openblas openblas-devel wget autoconf automake libtool && \ | ||||||||
microdnf clean all | ||||||||
|
||||||||
# Python Installation | ||||||||
FROM base as python-install | ||||||||
ARG PYTHON_VERSION | ||||||||
|
||||||||
ENV VIRTUAL_ENV=/opt/venv/vllm | ||||||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||||||||
ENV PYTHON_VERSION=${PYTHON_VERSION} | ||||||||
RUN microdnf install -y \ | ||||||||
python${PYTHON_VERSION}-devel && \ | ||||||||
python${PYTHON_VERSION} -m venv $VIRTUAL_ENV && pip install --no-cache -U pip wheel uv && microdnf clean all | ||||||||
|
||||||||
# Upgrade pip and install base tools | ||||||||
RUN python -m pip install -U pip wheel uv cmake setuptools | ||||||||
|
||||||||
# Install Rust | ||||||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \ | ||||||||
. "$HOME/.cargo/env" | ||||||||
dilipgb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
FROM python-install as pyarrow | ||||||||
|
||||||||
# Build Apache Arrow | ||||||||
WORKDIR /tmp | ||||||||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||||||||
--mount=type=cache,target=/root/.cache/uv \ | ||||||||
git clone https://github.com/apache/arrow.git && \ | ||||||||
cd arrow/cpp && \ | ||||||||
mkdir release && cd release && \ | ||||||||
cmake -DCMAKE_BUILD_TYPE=Release \ | ||||||||
-DCMAKE_INSTALL_PREFIX=/usr/local \ | ||||||||
-DARROW_PYTHON=ON \ | ||||||||
-DARROW_PARQUET=ON \ | ||||||||
-DARROW_ORC=ON \ | ||||||||
-DARROW_FILESYSTEM=ON \ | ||||||||
-DARROW_WITH_LZ4=ON \ | ||||||||
-DARROW_WITH_ZSTD=ON \ | ||||||||
-DARROW_WITH_SNAPPY=ON \ | ||||||||
-DARROW_JSON=ON \ | ||||||||
-DARROW_CSV=ON \ | ||||||||
-DARROW_DATASET=ON \ | ||||||||
-DPROTOBUF_PROTOC_EXECUTABLE=/usr/bin/protoc \ | ||||||||
dilipgb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
-DARROW_DEPENDENCY_SOURCE=BUNDLED \ | ||||||||
.. && \ | ||||||||
make -j$(nproc) && \ | ||||||||
make install && \ | ||||||||
cd ../../python && \ | ||||||||
export PYARROW_PARALLEL=4 && \ | ||||||||
export ARROW_BUILD_TYPE=release && \ | ||||||||
python -m pip install -r requirements-build.txt && \ | ||||||||
python setup.py build_ext --build-type=$ARROW_BUILD_TYPE --bundle-arrow-cpp bdist_wheel | ||||||||
|
||||||||
|
||||||||
# Install numactl (needed for numa.h dependency) | ||||||||
WORKDIR /tmp | ||||||||
RUN curl -LO https://github.com/numactl/numactl/archive/refs/tags/v2.0.16.tar.gz && \ | ||||||||
tar -xvzf v2.0.16.tar.gz && \ | ||||||||
cd numactl-2.0.16 && \ | ||||||||
./autogen.sh && \ | ||||||||
./configure && \ | ||||||||
make && \ | ||||||||
make install | ||||||||
|
||||||||
# Set include path | ||||||||
ENV C_INCLUDE_PATH="/usr/local/include:$C_INCLUDE_PATH" | ||||||||
|
||||||||
FROM pyarrow as python-dependecies | ||||||||
# Copy vLLM source | ||||||||
COPY . /workspace/vllm | ||||||||
WORKDIR /workspace/vllm | ||||||||
|
||||||||
# Check git repository integrity if enabled | ||||||||
ARG GIT_REPO_CHECK=0 | ||||||||
RUN --mount=type=bind,source=.git,target=.git \ | ||||||||
if [ "$GIT_REPO_CHECK" != 0 ]; then bash tools/check_repo.sh; fi | ||||||||
|
||||||||
# Install dependencies, including PyTorch and Apache Arrow | ||||||||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||||||||
--mount=type=cache,target=/root/.cache/uv \ | ||||||||
pip install -v \ | ||||||||
dilipgb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
'cmake>=3.26' ninja packaging 'setuptools-scm>=8' wheel jinja2 \ | ||||||||
/tmp/arrow/python/dist/*.whl \ | ||||||||
--extra-index-url https://download.pytorch.org/whl/nightly/cpu \ | ||||||||
-r requirements-cpu.txt | ||||||||
|
||||||||
#Clean up build files for arrow | ||||||||
RUN rm -rf /tmp/arrow | ||||||||
dilipgb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
# Install torchvision | ||||||||
ARG TORCH_VISION_VERSION=v0.20.1 | ||||||||
WORKDIR /tmp | ||||||||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||||||||
--mount=type=cache,target=/root/.cache/uv \ | ||||||||
git clone https://github.com/pytorch/vision.git && \ | ||||||||
cd vision && \ | ||||||||
git checkout $TORCH_VISION_VERSION && \ | ||||||||
python setup.py bdist_wheel && \ | ||||||||
uv pip install dist/*.whl | ||||||||
dilipgb marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We don't need to install the wheel here, just to build it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
|
||||||||
# Final build stage | ||||||||
FROM python-dependecies as vllm-cpu | ||||||||
dilipgb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
ARG PYTHON_VERSION | ||||||||
|
||||||||
# Set correct library path for torch and numactl | ||||||||
ENV LD_LIBRARY_PATH="/opt/vllm/lib64/python${PYTHON_VERSION}/site-packages/torch/lib:/usr/local/lib:$LD_LIBRARY_PATH" | ||||||||
|
||||||||
WORKDIR /workspace/vllm | ||||||||
|
||||||||
# Build and install vllm | ||||||||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||||||||
--mount=type=cache,target=/root/.cache/uv \ | ||||||||
VLLM_TARGET_DEVICE=cpu python setup.py bdist_wheel && \ | ||||||||
uv pip install dist/*.whl && \ | ||||||||
rm -rf dist | ||||||||
|
||||||||
# setup non-root user for vllm | ||||||||
RUN umask 002 && \ | ||||||||
useradd --uid 2000 --gid 0 vllm && \ | ||||||||
mkdir -p /home/vllm && \ | ||||||||
chmod g+rwx /home/vllm /usr/src /workspace | ||||||||
|
||||||||
COPY LICENSE /licenses/vllm.md | ||||||||
COPY examples/*.jinja /app/data/template/ | ||||||||
|
||||||||
USER 2000 | ||||||||
WORKDIR /home/vllm | ||||||||
|
||||||||
# Set the default entrypoint | ||||||||
ENTRYPOINT ["/opt/vllm/bin/python", "-m", "vllm.entrypoints.openai.api_server"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.