Skip to content

Commit b3fb4fd

Browse files
committed
[CI] [WheelNext] Build variant wheels
1 parent e4cf319 commit b3fb4fd

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Python wheels using Wheel Variant prototype (WheelNext)
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read # to fetch code (actions/checkout)
7+
8+
defaults:
9+
run:
10+
shell: bash -l {0}
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
BRANCH_NAME: >-
18+
${{ github.event.pull_request.number && 'PR-' }}${{ github.event.pull_request.number || github.ref_name }}
19+
20+
jobs:
21+
python-wheels-variants:
22+
name: Build Python wheels using Wheel Variant prototype (WheelNext)
23+
runs-on:
24+
- runs-on=${{ github.run_id }}
25+
- runner=linux-amd64-cpu
26+
- tag=python-wheels-variants
27+
steps:
28+
# Restart Docker daemon so that it recognizes the ephemeral disks
29+
- run: sudo systemctl restart docker
30+
- uses: actions/checkout@v4
31+
with:
32+
submodules: "true"
33+
- name: Log into Docker registry (AWS ECR)
34+
run: bash ops/pipeline/login-docker-registry.sh
35+
- run: |
36+
bash ops/pipeline/build-variant-wheels.sh

ops/pipeline/build-variant-wheels.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
## Build Python wheels using Wheel Variant prototype (WheelNext)
3+
4+
set -euo pipefail
5+
6+
if [[ -z "${GITHUB_SHA:-}" ]]
7+
then
8+
echo "Make sure to set environment variable GITHUB_SHA"
9+
exit 1
10+
fi
11+
12+
if [[ "$#" -lt 1 ]]
13+
then
14+
echo "Usage: $0 [image_repo]"
15+
exit 2
16+
fi
17+
image_repo="$1"
18+
19+
source ops/pipeline/classify-git-branch.sh
20+
source ops/pipeline/get-docker-registry-details.sh
21+
source ops/pipeline/get-image-tag.sh
22+
23+
WHEEL_TAG=manylinux_2_28_x86_64
24+
BUILD_IMAGE_URI="${DOCKER_REGISTRY_URL}/${image_repo}:${IMAGE_TAG}"
25+
MANYLINUX_IMAGE_URI="${DOCKER_REGISTRY_URL}/xgb-ci.${WHEEL_TAG}:${IMAGE_TAG}"
26+
27+
echo "--- Build with CUDA"
28+
29+
if [[ ($is_pull_request == 1) || ($is_release_branch == 0) ]]
30+
then
31+
export BUILD_ONLY_SM75=1
32+
else
33+
export BUILD_ONLY_SM75=0
34+
fi
35+
export USE_RMM=0
36+
37+
set -x
38+
39+
python3 ops/docker_run.py \
40+
--image-uri ${BUILD_IMAGE_URI} \
41+
--run-args='-e BUILD_ONLY_SM75 -e USE_RMM' \
42+
-- ops/pipeline/build-cuda-impl.sh
43+
44+
echo "--- Audit binary wheel to ensure it's compliant with ${WHEEL_TAG} standard"
45+
python3 ops/docker_run.py \
46+
--image-uri ${MANYLINUX_IMAGE_URI} \
47+
-- auditwheel repair --only-plat \
48+
--plat ${WHEEL_TAG} python-package/dist/*.whl
49+
python3 -m wheel tags --python-tag py3 --abi-tag none --platform ${WHEEL_TAG} --remove \
50+
wheelhouse/*.whl
51+
mv -v wheelhouse/*.whl python-package/dist/
52+
53+
mamba create -n wheelnext python=3.13 python-build
54+
python -m pip install -v git+https://github.com/wheelnext/pep_xxx_wheel_variants.git@f3b287090f8a6f510b0e1723896e1c7e638f6bff#subdirectory=pep_xxx_wheel_variants
55+
56+
pip config set --site global.index-url https://variants-index.wheelnext.dev/
57+
variantlib make-variant -f python-package/dist/xgboost-*.whl -p "nvidia :: cuda :: 12" -o . --pyproject-toml python-package/pyproject.toml

python-package/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,10 @@ inspect = true
9595
ignore = ["compiled-objects-have-debug-symbols"]
9696
max_allowed_size_compressed = '300M'
9797
max_allowed_size_uncompressed = '500M'
98+
99+
[variant.default-priorities]
100+
namespace = ["nvidia"]
101+
102+
[variant.providers.nvidia]
103+
requires = ["nvidia-variant-provider>=0.0.1,<1.0.0"]
104+
plugin-api = "nvidia_variant_provider.plugin:NvidiaVariantPlugin"

python-package/pyproject.toml.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,10 @@ inspect = true
9494
ignore = ["compiled-objects-have-debug-symbols"]
9595
max_allowed_size_compressed = '300M'
9696
max_allowed_size_uncompressed = '500M'
97+
98+
[variant.default-priorities]
99+
namespace = ["nvidia"]
100+
101+
[variant.providers.nvidia]
102+
requires = ["nvidia-variant-provider>=0.0.1,<1.0.0"]
103+
plugin-api = "nvidia_variant_provider.plugin:NvidiaVariantPlugin"

0 commit comments

Comments
 (0)