Skip to content

Commit 231e4dd

Browse files
authored
[CI] [WheelNext] Build variant wheels (#11531)
* [CI] [WheelNext] Build variant wheels * Fix script * Create impl script
1 parent 45def5c commit 231e4dd

File tree

5 files changed

+124
-0
lines changed

5 files changed

+124
-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
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
## Build Python wheels using Wheel Variant prototype (WheelNext)
3+
## Companion script for ops/pipeline/build-variant-wheels.sh
4+
5+
set -eo pipefail
6+
7+
set -x
8+
gosu root chown -R $(id -u):$(id -g) /opt/miniforge/envs /opt/miniforge/pkgs/cache
9+
gosu root chown $(id -u):$(id -g) /opt/miniforge/pkgs
10+
set +x
11+
12+
mamba create -y -n wheelnext python=3.13 python-build
13+
14+
source activate wheelnext
15+
16+
# Cannot set -u before Conda env activation
17+
set -xu
18+
19+
python -m pip install -v \
20+
git+https://github.com/wheelnext/pep_xxx_wheel_variants.git@f3b287090f8a6f510b0e1723896e1c7e638f6bff#subdirectory=pep_xxx_wheel_variants
21+
pip config set --site global.index-url https://variants-index.wheelnext.dev/
22+
variantlib make-variant -f python-package/dist/xgboost-*.whl \
23+
-p "nvidia :: cuda :: 12" -o . --pyproject-toml python-package/pyproject.toml

ops/pipeline/build-variant-wheels.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
image_repo='xgb-ci.gpu_build_rockylinux8'
13+
14+
source ops/pipeline/classify-git-branch.sh
15+
source ops/pipeline/get-docker-registry-details.sh
16+
source ops/pipeline/get-image-tag.sh
17+
18+
WHEEL_TAG=manylinux_2_28_x86_64
19+
BUILD_IMAGE_URI="${DOCKER_REGISTRY_URL}/${image_repo}:${IMAGE_TAG}"
20+
MANYLINUX_IMAGE_URI="${DOCKER_REGISTRY_URL}/xgb-ci.${WHEEL_TAG}:${IMAGE_TAG}"
21+
22+
echo "--- Build with CUDA"
23+
24+
if [[ ($is_pull_request == 1) || ($is_release_branch == 0) ]]
25+
then
26+
export BUILD_ONLY_SM75=1
27+
else
28+
export BUILD_ONLY_SM75=0
29+
fi
30+
export USE_RMM=0
31+
32+
set -x
33+
34+
python3 ops/docker_run.py \
35+
--image-uri ${BUILD_IMAGE_URI} \
36+
--run-args='-e BUILD_ONLY_SM75 -e USE_RMM' \
37+
-- ops/pipeline/build-cuda-impl.sh
38+
39+
echo "--- Audit binary wheel to ensure it's compliant with ${WHEEL_TAG} standard"
40+
python3 ops/docker_run.py \
41+
--image-uri ${MANYLINUX_IMAGE_URI} \
42+
-- auditwheel repair --only-plat \
43+
--plat ${WHEEL_TAG} python-package/dist/*.whl
44+
python3 -m wheel tags --python-tag py3 --abi-tag none --platform ${WHEEL_TAG} --remove \
45+
wheelhouse/*.whl
46+
mv -v wheelhouse/*.whl python-package/dist/
47+
48+
echo "--- Convert Python wheel to variant wheel"
49+
python3 ops/docker_run.py \
50+
--image-uri ${BUILD_IMAGE_URI} \
51+
-- ops/pipeline/build-variant-wheels-impl.sh

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)