[CI/Build] Auto-detect manylinux ABI tag for nightly wheels (#41149)
Signed-off-by: Shengqi Chen <harry-chen@outlook.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -27,7 +27,7 @@ steps:
|
|||||||
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg USE_SCCACHE=1 --build-arg GIT_REPO_CHECK=1 --build-arg CUDA_VERSION=12.9.1 --build-arg torch_cuda_arch_list=\"${CUDA_ARCH_AARCH64_CU129}\" --tag vllm-ci:build-image --target build --progress plain -f docker/Dockerfile ."
|
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg USE_SCCACHE=1 --build-arg GIT_REPO_CHECK=1 --build-arg CUDA_VERSION=12.9.1 --build-arg torch_cuda_arch_list=\"${CUDA_ARCH_AARCH64_CU129}\" --tag vllm-ci:build-image --target build --progress plain -f docker/Dockerfile ."
|
||||||
- "mkdir artifacts"
|
- "mkdir artifacts"
|
||||||
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
||||||
- "bash .buildkite/scripts/upload-nightly-wheels.sh manylinux_2_31"
|
- "bash .buildkite/scripts/upload-nightly-wheels.sh"
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ steps:
|
|||||||
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg USE_SCCACHE=1 --build-arg GIT_REPO_CHECK=1 --build-arg CUDA_VERSION=13.0.2 --build-arg torch_cuda_arch_list=\"${CUDA_ARCH_AARCH64}\" --build-arg BUILD_BASE_IMAGE=nvidia/cuda:13.0.2-devel-ubuntu22.04 --tag vllm-ci:build-image --target build --progress plain -f docker/Dockerfile ."
|
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg USE_SCCACHE=1 --build-arg GIT_REPO_CHECK=1 --build-arg CUDA_VERSION=13.0.2 --build-arg torch_cuda_arch_list=\"${CUDA_ARCH_AARCH64}\" --build-arg BUILD_BASE_IMAGE=nvidia/cuda:13.0.2-devel-ubuntu22.04 --tag vllm-ci:build-image --target build --progress plain -f docker/Dockerfile ."
|
||||||
- "mkdir artifacts"
|
- "mkdir artifacts"
|
||||||
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
||||||
- "bash .buildkite/scripts/upload-nightly-wheels.sh manylinux_2_35"
|
- "bash .buildkite/scripts/upload-nightly-wheels.sh"
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ steps:
|
|||||||
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg GIT_REPO_CHECK=1 --build-arg VLLM_BUILD_ACL=ON --tag vllm-ci:build-image --target vllm-build --progress plain -f docker/Dockerfile.cpu ."
|
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg GIT_REPO_CHECK=1 --build-arg VLLM_BUILD_ACL=ON --tag vllm-ci:build-image --target vllm-build --progress plain -f docker/Dockerfile.cpu ."
|
||||||
- "mkdir artifacts"
|
- "mkdir artifacts"
|
||||||
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
||||||
- "bash .buildkite/scripts/upload-nightly-wheels.sh manylinux_2_35"
|
- "bash .buildkite/scripts/upload-nightly-wheels.sh"
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ steps:
|
|||||||
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg USE_SCCACHE=1 --build-arg GIT_REPO_CHECK=1 --build-arg CUDA_VERSION=12.9.1 --build-arg torch_cuda_arch_list=\"${CUDA_ARCH_X86_CU129}\" --tag vllm-ci:build-image --target build --progress plain -f docker/Dockerfile ."
|
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg USE_SCCACHE=1 --build-arg GIT_REPO_CHECK=1 --build-arg CUDA_VERSION=12.9.1 --build-arg torch_cuda_arch_list=\"${CUDA_ARCH_X86_CU129}\" --tag vllm-ci:build-image --target build --progress plain -f docker/Dockerfile ."
|
||||||
- "mkdir artifacts"
|
- "mkdir artifacts"
|
||||||
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
||||||
- "bash .buildkite/scripts/upload-nightly-wheels.sh manylinux_2_31"
|
- "bash .buildkite/scripts/upload-nightly-wheels.sh"
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ steps:
|
|||||||
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg USE_SCCACHE=1 --build-arg GIT_REPO_CHECK=1 --build-arg CUDA_VERSION=13.0.2 --build-arg torch_cuda_arch_list=\"${CUDA_ARCH_X86}\" --build-arg BUILD_BASE_IMAGE=nvidia/cuda:13.0.2-devel-ubuntu22.04 --tag vllm-ci:build-image --target build --progress plain -f docker/Dockerfile ."
|
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg USE_SCCACHE=1 --build-arg GIT_REPO_CHECK=1 --build-arg CUDA_VERSION=13.0.2 --build-arg torch_cuda_arch_list=\"${CUDA_ARCH_X86}\" --build-arg BUILD_BASE_IMAGE=nvidia/cuda:13.0.2-devel-ubuntu22.04 --tag vllm-ci:build-image --target build --progress plain -f docker/Dockerfile ."
|
||||||
- "mkdir artifacts"
|
- "mkdir artifacts"
|
||||||
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
||||||
- "bash .buildkite/scripts/upload-nightly-wheels.sh manylinux_2_35"
|
- "bash .buildkite/scripts/upload-nightly-wheels.sh"
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ steps:
|
|||||||
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg GIT_REPO_CHECK=1 --build-arg VLLM_CPU_X86=true --tag vllm-ci:build-image --target vllm-build --progress plain -f docker/Dockerfile.cpu ."
|
- "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg GIT_REPO_CHECK=1 --build-arg VLLM_CPU_X86=true --tag vllm-ci:build-image --target vllm-build --progress plain -f docker/Dockerfile.cpu ."
|
||||||
- "mkdir artifacts"
|
- "mkdir artifacts"
|
||||||
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
- "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'"
|
||||||
- "bash .buildkite/scripts/upload-nightly-wheels.sh manylinux_2_35"
|
- "bash .buildkite/scripts/upload-nightly-wheels.sh"
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||||
|
"""Detect the manylinux platform tag for a wheel and rename it in place.
|
||||||
|
|
||||||
|
vLLM's build images produce wheels with the generic ``linux_<arch>`` platform
|
||||||
|
tag, which installers like ``pip`` won't accept off PyPI/our index. We need to
|
||||||
|
rewrite the platform tag to the appropriate ``manylinux_<major>_<minor>_<arch>``
|
||||||
|
before uploading.
|
||||||
|
|
||||||
|
Historically the tag was hard-coded per build (``manylinux_2_31`` for the
|
||||||
|
Ubuntu 20.04-based image, ``manylinux_2_35`` for the Ubuntu 22.04-based
|
||||||
|
images). That is brittle: bumping the base image silently produces wheels
|
||||||
|
labelled with the wrong glibc requirement. This script asks ``auditwheel``
|
||||||
|
to derive the tag from the symbol versions actually referenced by the
|
||||||
|
binaries inside the wheel, so the label tracks reality.
|
||||||
|
|
||||||
|
We can't simply call ``auditwheel repair`` -- it tries to graft external
|
||||||
|
shared libraries into the wheel and fails on vLLM's CUDA/cuBLAS dependencies.
|
||||||
|
Instead we use ``auditwheel.wheel_abi.analyze_wheel_abi`` directly, which is
|
||||||
|
the same call that powers ``auditwheel show``, and read off
|
||||||
|
``winfo.sym_policy.name``.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
detect-manylinux-tag.py <wheel_path>
|
||||||
|
|
||||||
|
The wheel is renamed in place; the new path is printed on stdout. All
|
||||||
|
diagnostics go to stderr so callers can capture stdout safely.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from auditwheel.error import (
|
||||||
|
AuditwheelError,
|
||||||
|
NonPlatformWheelError,
|
||||||
|
WheelToolsError,
|
||||||
|
)
|
||||||
|
from auditwheel.wheel_abi import analyze_wheel_abi
|
||||||
|
from auditwheel.wheeltools import get_wheel_architecture, get_wheel_libc
|
||||||
|
|
||||||
|
|
||||||
|
def detect_platform_tag(wheel_path: Path) -> str:
|
||||||
|
"""Return the most precise platform tag the wheel is consistent with.
|
||||||
|
|
||||||
|
Mirrors ``auditwheel show`` but returns ``sym_policy`` rather than
|
||||||
|
``overall_policy``: we only care about the glibc symbol versions used,
|
||||||
|
not about other policy axes (ISA extensions, blacklist, etc.) that
|
||||||
|
``overall_policy`` folds in.
|
||||||
|
"""
|
||||||
|
fn = wheel_path.name
|
||||||
|
|
||||||
|
try:
|
||||||
|
arch = get_wheel_architecture(fn)
|
||||||
|
except (WheelToolsError, NonPlatformWheelError):
|
||||||
|
# Architecture isn't deducible from the filename; let auditwheel
|
||||||
|
# infer it from the ELF binaries inside the wheel.
|
||||||
|
arch = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
libc = get_wheel_libc(fn)
|
||||||
|
except WheelToolsError:
|
||||||
|
# An unrepaired wheel uses ``linux_<arch>``, which doesn't encode
|
||||||
|
# libc. Let auditwheel infer it from the ELF binaries.
|
||||||
|
libc = None
|
||||||
|
|
||||||
|
winfo = analyze_wheel_abi(
|
||||||
|
libc,
|
||||||
|
arch,
|
||||||
|
wheel_path,
|
||||||
|
frozenset(),
|
||||||
|
disable_isa_ext_check=False,
|
||||||
|
allow_graft=False,
|
||||||
|
)
|
||||||
|
return winfo.sym_policy.name
|
||||||
|
|
||||||
|
|
||||||
|
def rename_wheel(wheel_path: Path, new_platform_tag: str) -> Path:
|
||||||
|
"""Rename the wheel in place, replacing only its platform tag."""
|
||||||
|
# Wheel filename per PEP 427:
|
||||||
|
# {distribution}-{version}(-{build})?-{python}-{abi}-{platform}.whl
|
||||||
|
# The platform tag is always the last ``-``-separated token before
|
||||||
|
# ``.whl``. Compound tags like ``manylinux_2_31_x86_64`` use ``_`` as the
|
||||||
|
# internal separator, so ``-``-splitting is unambiguous.
|
||||||
|
parts = wheel_path.stem.split("-")
|
||||||
|
if len(parts) < 5:
|
||||||
|
raise ValueError(f"Unrecognised wheel filename: {wheel_path.name}")
|
||||||
|
parts[-1] = new_platform_tag
|
||||||
|
new_path = wheel_path.with_name("-".join(parts) + ".whl")
|
||||||
|
if new_path != wheel_path:
|
||||||
|
wheel_path.rename(new_path)
|
||||||
|
return new_path
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Detect a wheel's manylinux platform tag with "
|
||||||
|
"auditwheel and rename the wheel in place."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"wheel",
|
||||||
|
type=Path,
|
||||||
|
help="Path to the wheel to inspect and rename.",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
wheel_path: Path = args.wheel
|
||||||
|
if not wheel_path.is_file():
|
||||||
|
print(f"error: {wheel_path} is not a file", file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
# Catch the things that ``analyze_wheel_abi`` and ``rename_wheel`` can
|
||||||
|
# raise: any subclass of ``AuditwheelError`` (pure-Python wheels,
|
||||||
|
# invalid libc, malformed wheels), filesystem errors, or our own
|
||||||
|
# ``ValueError`` for an unrecognised wheel filename. Print a single
|
||||||
|
# ``ERROR_TYPE: message`` line to stderr instead of a Python
|
||||||
|
# traceback, which is much friendlier in CI logs.
|
||||||
|
try:
|
||||||
|
new_tag = detect_platform_tag(wheel_path)
|
||||||
|
print(f"detected platform tag: {new_tag}", file=sys.stderr)
|
||||||
|
new_path = rename_wheel(wheel_path, new_tag)
|
||||||
|
except (AuditwheelError, ValueError, OSError) as e:
|
||||||
|
print(
|
||||||
|
f"error: failed to retag {wheel_path.name}: {type(e).__name__}: {e}",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
return 2
|
||||||
|
|
||||||
|
if new_path != wheel_path:
|
||||||
|
print(f"renamed {wheel_path.name} -> {new_path.name}", file=sys.stderr)
|
||||||
|
else:
|
||||||
|
print(f"wheel already tagged {new_tag}", file=sys.stderr)
|
||||||
|
|
||||||
|
print(new_path)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -10,20 +10,13 @@ set -ex
|
|||||||
BUCKET="vllm-wheels"
|
BUCKET="vllm-wheels"
|
||||||
INDICES_OUTPUT_DIR="indices"
|
INDICES_OUTPUT_DIR="indices"
|
||||||
DEFAULT_VARIANT_ALIAS="cu130" # align with vLLM_MAIN_CUDA_VERSION in vllm/envs.py
|
DEFAULT_VARIANT_ALIAS="cu130" # align with vLLM_MAIN_CUDA_VERSION in vllm/envs.py
|
||||||
PYTHON="${PYTHON_PROG:-python3}" # try to read from env var, otherwise use python3
|
|
||||||
SUBPATH=$BUILDKITE_COMMIT
|
SUBPATH=$BUILDKITE_COMMIT
|
||||||
S3_COMMIT_PREFIX="s3://$BUCKET/$SUBPATH/"
|
S3_COMMIT_PREFIX="s3://$BUCKET/$SUBPATH/"
|
||||||
|
|
||||||
# detect if python3.12+ is available
|
# Select python3 (>= 3.12) -- local if available, else a docker fallback.
|
||||||
has_new_python=$($PYTHON -c "print(1 if __import__('sys').version_info >= (3,12) else 0)")
|
# shellcheck source=lib/select-python.sh
|
||||||
if [[ "$has_new_python" -eq 0 ]]; then
|
source .buildkite/scripts/lib/select-python.sh
|
||||||
# use new python from docker
|
select_python
|
||||||
docker pull python:3-slim
|
|
||||||
PYTHON="docker run --rm -u $(id -u):$(id -g) -v $(pwd):/app -w /app python:3-slim python3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Using python interpreter: $PYTHON"
|
|
||||||
echo "Python version: $($PYTHON --version)"
|
|
||||||
|
|
||||||
# ======== generate and upload indices ========
|
# ======== generate and upload indices ========
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||||
|
#
|
||||||
|
# Shared helper for rewriting a wheel's platform tag from the generic
|
||||||
|
# ``linux_<arch>`` to the correct ``manylinux_<major>_<minor>_<arch>``.
|
||||||
|
# After sourcing, call ``apply_manylinux_tag <wheel>`` on each wheel
|
||||||
|
# that still carries the generic tag; the renamed path is printed on
|
||||||
|
# stdout (logs go to stderr).
|
||||||
|
#
|
||||||
|
# Why a pinned Docker container instead of using whatever Python
|
||||||
|
# happens to be on the agent:
|
||||||
|
# - vLLM's release agents are heterogeneous -- they don't agree on
|
||||||
|
# a Python minor version, and we can't rely on a particular
|
||||||
|
# ``auditwheel`` being installed.
|
||||||
|
# - ``detect-manylinux-tag.py`` reads ``auditwheel.wheel_abi`` and
|
||||||
|
# ``Policy.sym_policy``, which are *internal* APIs without a
|
||||||
|
# stability promise. Pinning both Python and auditwheel makes the
|
||||||
|
# detected tag a function of the inputs alone, and shifts version
|
||||||
|
# bumps from "implicit drift" to "deliberate, retested change".
|
||||||
|
# - Other release scripts (``generate-and-upload-nightly-index.sh``,
|
||||||
|
# ``upload-rocm-wheels.sh``) already use the python:3-slim image
|
||||||
|
# when the agent's interpreter is too old; this is the same idea
|
||||||
|
# made stricter.
|
||||||
|
#
|
||||||
|
# To keep the per-wheel cost down (the ROCm upload retags ~10 wheels
|
||||||
|
# each run), we install auditwheel into a long-lived helper container
|
||||||
|
# once on source, then ``docker exec`` into it for each call.
|
||||||
|
#
|
||||||
|
# Trap behaviour:
|
||||||
|
# - Sourcing installs an EXIT trap that calls ``manylinux_cleanup`` to
|
||||||
|
# tear down the helper container. Any EXIT trap that was already in
|
||||||
|
# place when this file was sourced is captured and run AFTER our
|
||||||
|
# cleanup, so we don't silently clobber it.
|
||||||
|
# - If a caller sets a new EXIT trap *after* sourcing, that trap will
|
||||||
|
# replace ours; in that case the caller should call
|
||||||
|
# ``manylinux_cleanup`` from their own handler.
|
||||||
|
|
||||||
|
if [[ -n "${_MANYLINUX_LIB_SOURCED:-}" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
_MANYLINUX_LIB_SOURCED=1
|
||||||
|
|
||||||
|
# Pin both sides. Bump these deliberately and re-run a representative
|
||||||
|
# wheel from each build target through the detection.
|
||||||
|
_MANYLINUX_PYTHON_IMAGE="python:3.12-slim"
|
||||||
|
_MANYLINUX_AUDITWHEEL_VERSION="6.6.0"
|
||||||
|
|
||||||
|
# Resolve our own directory (and the sibling detect script) using the
|
||||||
|
# canonical, symlink-resolved path. The container mounts cwd at the
|
||||||
|
# same absolute path on both sides, so all paths we hand to it -- the
|
||||||
|
# script, the wheel -- must canonicalise to a location under cwd.
|
||||||
|
_MANYLINUX_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
|
_MANYLINUX_DETECT_SCRIPT="$(cd "${_MANYLINUX_LIB_DIR}/.." && pwd -P)/detect-manylinux-tag.py"
|
||||||
|
_MANYLINUX_CWD="$(pwd -P)"
|
||||||
|
|
||||||
|
docker pull --quiet "$_MANYLINUX_PYTHON_IMAGE" >/dev/null
|
||||||
|
|
||||||
|
# Spin up a long-lived helper container so we install auditwheel once
|
||||||
|
# and then ``docker exec`` into it for each wheel.
|
||||||
|
#
|
||||||
|
# The container runs as root so ``pip install`` can write into the
|
||||||
|
# system site-packages; individual ``docker exec`` calls below pin
|
||||||
|
# themselves to the host UID so any file rename happens with host
|
||||||
|
# ownership, not root.
|
||||||
|
_MANYLINUX_CONTAINER="$(docker run -d --rm \
|
||||||
|
-v "$_MANYLINUX_CWD:$_MANYLINUX_CWD" \
|
||||||
|
-w "$_MANYLINUX_CWD" \
|
||||||
|
"$_MANYLINUX_PYTHON_IMAGE" \
|
||||||
|
sleep infinity)"
|
||||||
|
docker exec "$_MANYLINUX_CONTAINER" \
|
||||||
|
pip install --quiet --disable-pip-version-check \
|
||||||
|
--root-user-action=ignore \
|
||||||
|
"auditwheel==${_MANYLINUX_AUDITWHEEL_VERSION}"
|
||||||
|
|
||||||
|
# Public cleanup -- safe to call multiple times.
|
||||||
|
manylinux_cleanup() {
|
||||||
|
if [[ -n "${_MANYLINUX_CONTAINER:-}" ]]; then
|
||||||
|
docker rm -f "$_MANYLINUX_CONTAINER" >/dev/null 2>&1 || true
|
||||||
|
_MANYLINUX_CONTAINER=""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Capture any EXIT trap that was already in place so we can chain to
|
||||||
|
# it rather than overwrite it. ``trap -p EXIT`` prints the handler in
|
||||||
|
# eval-able form (``trap -- 'CMD' EXIT``) or nothing if unset; we
|
||||||
|
# strip the wrapper to recover ``CMD``. Handles the common case --
|
||||||
|
# CMDs without embedded single quotes -- and degrades gracefully (we
|
||||||
|
# still run our own cleanup) for the pathological case.
|
||||||
|
_manylinux_prev_exit_trap_cmd=""
|
||||||
|
_manylinux_existing_exit_trap="$(trap -p EXIT)"
|
||||||
|
if [[ -n "$_manylinux_existing_exit_trap" ]]; then
|
||||||
|
_tmp="${_manylinux_existing_exit_trap#trap -- \'}"
|
||||||
|
_manylinux_prev_exit_trap_cmd="${_tmp%\' EXIT}"
|
||||||
|
unset _tmp
|
||||||
|
fi
|
||||||
|
unset _manylinux_existing_exit_trap
|
||||||
|
|
||||||
|
_manylinux_run_exit_chain() {
|
||||||
|
manylinux_cleanup
|
||||||
|
if [[ -n "$_manylinux_prev_exit_trap_cmd" ]]; then
|
||||||
|
eval "$_manylinux_prev_exit_trap_cmd"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap _manylinux_run_exit_chain EXIT
|
||||||
|
|
||||||
|
# Detect the manylinux platform tag for a single wheel and rename it
|
||||||
|
# in place, printing the renamed wheel path on stdout. Returns
|
||||||
|
# non-zero on failure (which under ``set -e`` propagates to caller).
|
||||||
|
#
|
||||||
|
# The wheel must be reachable via a path under the host cwd so it's
|
||||||
|
# visible inside the helper container; in CI the wheels always live
|
||||||
|
# under ``artifacts/`` so this is fine.
|
||||||
|
apply_manylinux_tag() {
|
||||||
|
local wheel="$1"
|
||||||
|
local abs_wheel
|
||||||
|
abs_wheel="$(realpath "$wheel")"
|
||||||
|
local new_wheel
|
||||||
|
new_wheel="$(docker exec -u "$(id -u):$(id -g)" \
|
||||||
|
"$_MANYLINUX_CONTAINER" \
|
||||||
|
python "$_MANYLINUX_DETECT_SCRIPT" "$abs_wheel")"
|
||||||
|
if [[ -z "$new_wheel" || ! -f "$new_wheel" ]]; then
|
||||||
|
echo "apply_manylinux_tag: detect-manylinux-tag.py did not produce a valid wheel path for $wheel" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
printf '%s\n' "$new_wheel"
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||||
|
#
|
||||||
|
# Pick a Python interpreter for buildkite scripts: prefer a local
|
||||||
|
# ``python3`` if it is recent enough (>= 3.12), otherwise fall back to
|
||||||
|
# a one-shot Docker container running ``python:3-slim``. After
|
||||||
|
# ``select_python`` returns, ``$PYTHON`` is set in the caller's shell
|
||||||
|
# and is safe to use as a command (e.g. ``$PYTHON some_script.py``).
|
||||||
|
#
|
||||||
|
# The 3.12 threshold matches what the existing nightly-index work
|
||||||
|
# expects -- typing features used by ``generate-nightly-index.py``.
|
||||||
|
# This helper does not pin the *minor* version; if you need stricter
|
||||||
|
# reproducibility (e.g. relying on auditwheel internals), invoke
|
||||||
|
# Docker yourself with a pinned tag rather than calling this.
|
||||||
|
|
||||||
|
if [[ -n "${_SELECT_PYTHON_LIB_SOURCED:-}" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
_SELECT_PYTHON_LIB_SOURCED=1
|
||||||
|
|
||||||
|
# Sets ``PYTHON`` in the caller's shell and exports it. Idempotent --
|
||||||
|
# calling twice is safe and the second call simply re-runs the probe.
|
||||||
|
select_python() {
|
||||||
|
local py="${PYTHON_PROG:-python3}"
|
||||||
|
local has_new_python
|
||||||
|
has_new_python=$("$py" -c \
|
||||||
|
"print(1 if __import__('sys').version_info >= (3,12) else 0)" \
|
||||||
|
2>/dev/null || echo 0)
|
||||||
|
if [[ "$has_new_python" -eq 0 ]]; then
|
||||||
|
# ``-u $(id -u):$(id -g)`` so files created via the container
|
||||||
|
# end up owned by the host user, not root.
|
||||||
|
docker pull python:3-slim
|
||||||
|
PYTHON="docker run --rm -u $(id -u):$(id -g) -v $(pwd):/app -w /app python:3-slim python3"
|
||||||
|
else
|
||||||
|
PYTHON="$py"
|
||||||
|
fi
|
||||||
|
export PYTHON
|
||||||
|
echo "Using python interpreter: $PYTHON"
|
||||||
|
echo "Python version: $($PYTHON --version)"
|
||||||
|
}
|
||||||
@@ -2,14 +2,18 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Upload a single wheel to S3 (rename linux -> manylinux).
|
# Upload a single wheel to S3, after detecting and applying the appropriate
|
||||||
|
# manylinux platform tag with auditwheel.
|
||||||
# Index generation is handled separately by generate-and-upload-nightly-index.sh.
|
# Index generation is handled separately by generate-and-upload-nightly-index.sh.
|
||||||
|
|
||||||
|
# shellcheck source=lib/manylinux.sh
|
||||||
|
source .buildkite/scripts/lib/manylinux.sh
|
||||||
|
|
||||||
BUCKET="vllm-wheels"
|
BUCKET="vllm-wheels"
|
||||||
SUBPATH=$BUILDKITE_COMMIT
|
SUBPATH=$BUILDKITE_COMMIT
|
||||||
S3_COMMIT_PREFIX="s3://$BUCKET/$SUBPATH/"
|
S3_COMMIT_PREFIX="s3://$BUCKET/$SUBPATH/"
|
||||||
|
|
||||||
# ========= collect, rename & upload the wheel ==========
|
# ========= locate the wheel ==========
|
||||||
|
|
||||||
# Assume wheels are in artifacts/dist/*.whl
|
# Assume wheels are in artifacts/dist/*.whl
|
||||||
wheel_files=(artifacts/dist/*.whl)
|
wheel_files=(artifacts/dist/*.whl)
|
||||||
@@ -21,19 +25,9 @@ if [[ ${#wheel_files[@]} -ne 1 ]]; then
|
|||||||
fi
|
fi
|
||||||
wheel="${wheel_files[0]}"
|
wheel="${wheel_files[0]}"
|
||||||
|
|
||||||
# default build image uses ubuntu 20.04, which corresponds to manylinux_2_31
|
# ========= detect manylinux tag and rename ==========
|
||||||
# we also accept params as manylinux tag
|
|
||||||
# refer to https://github.com/mayeut/pep600_compliance?tab=readme-ov-file#acceptable-distros-to-build-wheels
|
|
||||||
manylinux_version="${1:-manylinux_2_31}"
|
|
||||||
|
|
||||||
# Rename 'linux' to the appropriate manylinux version in the wheel filename
|
wheel="$(apply_manylinux_tag "$wheel")"
|
||||||
if [[ "$wheel" != *"linux"* ]]; then
|
|
||||||
echo "Error: Wheel filename does not contain 'linux': $wheel"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
new_wheel="${wheel/linux/$manylinux_version}"
|
|
||||||
mv -- "$wheel" "$new_wheel"
|
|
||||||
wheel="$new_wheel"
|
|
||||||
echo "Renamed wheel to: $wheel"
|
echo "Renamed wheel to: $wheel"
|
||||||
|
|
||||||
# Extract the version from the wheel
|
# Extract the version from the wheel
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ BUCKET="${S3_BUCKET:-vllm-wheels}"
|
|||||||
ROCM_SUBPATH="rocm/${BUILDKITE_COMMIT}"
|
ROCM_SUBPATH="rocm/${BUILDKITE_COMMIT}"
|
||||||
S3_COMMIT_PREFIX="s3://$BUCKET/$ROCM_SUBPATH/"
|
S3_COMMIT_PREFIX="s3://$BUCKET/$ROCM_SUBPATH/"
|
||||||
INDICES_OUTPUT_DIR="rocm-indices"
|
INDICES_OUTPUT_DIR="rocm-indices"
|
||||||
PYTHON="${PYTHON_PROG:-python3}"
|
|
||||||
|
|
||||||
# ROCm uses manylinux_2_35 (Ubuntu 22.04 based)
|
|
||||||
MANYLINUX_VERSION="manylinux_2_35"
|
|
||||||
|
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
echo "ROCm Wheel Upload Configuration"
|
echo "ROCm Wheel Upload Configuration"
|
||||||
@@ -34,19 +30,21 @@ echo "Commit: $BUILDKITE_COMMIT"
|
|||||||
echo "Branch: $BUILDKITE_BRANCH"
|
echo "Branch: $BUILDKITE_BRANCH"
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
|
|
||||||
# ======== Part 0: Setup Python ========
|
# ======== Part 0: Setup Python and helpers ========
|
||||||
|
|
||||||
# Detect if python3.12+ is available
|
# Pick a Python interpreter for index generation -- local if recent
|
||||||
has_new_python=$($PYTHON -c "print(1 if __import__('sys').version_info >= (3,12) else 0)" 2>/dev/null || echo 0)
|
# enough, else a one-shot docker fallback.
|
||||||
if [[ "$has_new_python" -eq 0 ]]; then
|
# shellcheck source=lib/select-python.sh
|
||||||
# Use new python from docker
|
source .buildkite/scripts/lib/select-python.sh
|
||||||
# Use --user to ensure files are created with correct ownership (not root)
|
select_python
|
||||||
docker pull python:3-slim
|
|
||||||
PYTHON="docker run --rm --user $(id -u):$(id -g) -v $(pwd):/app -w /app python:3-slim python3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Using python interpreter: $PYTHON"
|
# Set up auditwheel-in-a-container for the manylinux retagging step.
|
||||||
echo "Python version: $($PYTHON --version)"
|
# Distinct from select_python: ``manylinux.sh`` deliberately pins both
|
||||||
|
# the Python and auditwheel versions (the script reads auditwheel
|
||||||
|
# internals) and so always runs in a known-good container regardless
|
||||||
|
# of what's on the agent.
|
||||||
|
# shellcheck source=lib/manylinux.sh
|
||||||
|
source .buildkite/scripts/lib/manylinux.sh
|
||||||
|
|
||||||
# ======== Part 1: Collect and prepare wheels ========
|
# ======== Part 1: Collect and prepare wheels ========
|
||||||
|
|
||||||
@@ -63,11 +61,18 @@ if [ "$WHEEL_COUNT" -eq 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Rename linux to manylinux in wheel filenames
|
# Detect the appropriate manylinux platform tag for any wheel that still
|
||||||
|
# carries the generic ``linux_<arch>`` tag, and rename it in place. We use
|
||||||
|
# auditwheel via ``apply_manylinux_tag`` (see lib/manylinux.sh) rather than
|
||||||
|
# a hard-coded ``manylinux_2_35`` string so that the label tracks the actual
|
||||||
|
# glibc symbol versions used by the binaries (and stays correct if the
|
||||||
|
# rocm_base image is rebased).
|
||||||
|
#
|
||||||
|
# The ``linux``/``manylinux`` filter below skips both pre-tagged wheels
|
||||||
|
# (e.g. upstream torch) and pure-Python ``-any.whl`` wheels.
|
||||||
for wheel in all-rocm-wheels/*.whl; do
|
for wheel in all-rocm-wheels/*.whl; do
|
||||||
if [[ "$wheel" == *"linux"* ]] && [[ "$wheel" != *"manylinux"* ]]; then
|
if [[ "$wheel" == *"linux"* ]] && [[ "$wheel" != *"manylinux"* ]]; then
|
||||||
new_wheel="${wheel/linux/$MANYLINUX_VERSION}"
|
new_wheel="$(apply_manylinux_tag "$wheel")"
|
||||||
mv -- "$wheel" "$new_wheel"
|
|
||||||
echo "Renamed: $(basename "$wheel") -> $(basename "$new_wheel")"
|
echo "Renamed: $(basename "$wheel") -> $(basename "$new_wheel")"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ ep_kernels_workspace/
|
|||||||
|
|
||||||
# Allow tracked library source folders under submodules (e.g., benchmarks/lib)
|
# Allow tracked library source folders under submodules (e.g., benchmarks/lib)
|
||||||
!vllm/benchmarks/lib/
|
!vllm/benchmarks/lib/
|
||||||
|
!.buildkite/scripts/lib/
|
||||||
|
|
||||||
# Generated gRPC protobuf files (compiled at build time from vllm_engine.proto)
|
# Generated gRPC protobuf files (compiled at build time from vllm_engine.proto)
|
||||||
vllm/grpc/vllm_engine_pb2.py
|
vllm/grpc/vllm_engine_pb2.py
|
||||||
|
|||||||
Reference in New Issue
Block a user