Skip to content

Commit 8bd70dd

Browse files
trivialfishcho3
andauthored
Update release scripts (dmlc#11289)
- Generate the variants instead of using patches. - Update links to s3 buckets. - Build the glibc warning into XGBoost instead of using a patch - Build xgboost-cpu on Windows --------- Co-authored-by: Hyunsu Cho <[email protected]>
1 parent e8baf03 commit 8bd70dd

20 files changed

+340
-122
lines changed

Diff for: .github/workflows/python_wheels_macos.yml

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
environment-file: ops/conda_env/minimal.yml
4444
- name: Build wheels
4545
run: bash ops/pipeline/build-python-wheels-macos.sh ${{ matrix.platform_id }} ${{ github.sha }}
46+
- name: Try installing XGBoost
47+
run: |
48+
python -m pip install -vvv wheelhouse/*.whl
4649
- name: Upload Python wheel
4750
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')
4851
run: |

Diff for: .github/workflows/windows.yml

+12
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ jobs:
3939
build/testxgboost.exe xgboost.exe `
4040
(Get-ChildItem python-package/dist/*.whl | Select-Object -Expand FullName)
4141
42+
build-win64-cpu:
43+
name: Build XGBoost for Windows (minimal)
44+
runs-on:
45+
- runs-on=${{ github.run_id }}
46+
- runner=windows-cpu
47+
- tag=windows-build-win64-cpu
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
submodules: "true"
52+
- run: powershell ops/pipeline/build-win64-cpu.ps1
53+
4254
test-win64-gpu:
4355
name: Test XGBoost on Windows
4456
needs: build-win64-gpu

Diff for: dev/release-artifacts.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Simple script for managing Python, R, and source release packages.
33
4-
tqdm, sh are required to run this script.
4+
tqdm, sh, and build are required to run this script.
55
"""
66

77
import argparse
@@ -154,7 +154,7 @@ def download_python_wheels(branch: str, commit_hash: str, outdir: Path) -> None:
154154
"manylinux2014_aarch64",
155155
"manylinux_2_28_x86_64",
156156
"manylinux_2_28_aarch64",
157-
"macosx_10_15_x86_64.macosx_11_0_x86_64.macosx_12_0_x86_64",
157+
"macosx_10_15_x86_64",
158158
"macosx_12_0_arm64",
159159
]
160160
minimal_platforms = [
@@ -163,14 +163,14 @@ def download_python_wheels(branch: str, commit_hash: str, outdir: Path) -> None:
163163
"manylinux2014_aarch64",
164164
]
165165

166-
dir_url = f"{S3_BUCKET_URL}/{branch}/"
166+
# https://s3-us-west-2.amazonaws.com/xgboost-nightly-builds/release_3.0.0/4bfd4bf60d32e2d62426cc4070ccb5a5ba1ed078/xgboost-3.0.0rc1-py3-none-manylinux_2_28_x86_64.whl
167+
dir_url = f"{S3_BUCKET_URL}/{branch}/{commit_hash}/"
167168
wheels = []
168-
169169
for pkg_name, platforms in [
170170
("xgboost", full_platforms),
171171
("xgboost_cpu", minimal_platforms),
172172
]:
173-
src_filename_prefix = f"{pkg_name}-{args.release}%2B{commit_hash}-py3-none-"
173+
src_filename_prefix = f"{pkg_name}-{args.release}-py3-none-"
174174
target_filename_prefix = f"{pkg_name}-{args.release}-py3-none-"
175175
wheels.extend(
176176
_download_python_wheels(
@@ -188,24 +188,20 @@ def download_python_wheels(branch: str, commit_hash: str, outdir: Path) -> None:
188188

189189

190190
def download_r_artifacts(
191-
release: str, branch: str, rc: str, commit: str, outdir: Path
191+
release: str, branch: str, commit: str, outdir: Path
192192
) -> Tuple[Dict[str, str], List[str]]:
193193
"""Download R package artifacts for the specified release and branch."""
194194
platforms = ["linux"]
195195
rpkg_dir = outdir / "r-packages"
196196
rpkg_dir.mkdir(exist_ok=True)
197197

198198
artifacts = []
199-
branch = branch.split("_")[1] # release_x.y.z
200199
urls = {}
201200

201+
# https://s3-us-west-2.amazonaws.com/xgboost-nightly-builds/release_3.0.0/4bfd4bf60d32e2d62426cc4070ccb5a5ba1ed078/xgboost_r_gpu_linux.tar.gz
202202
for plat in platforms:
203-
url = f"{S3_BUCKET_URL}/{branch}/xgboost_r_gpu_{plat}_{commit}.tar.gz"
204-
artifact_name = (
205-
f"xgboost_r_gpu_{plat}_{release}-{rc}.tar.gz"
206-
if rc
207-
else f"xgboost_r_gpu_{plat}_{release}.tar.gz"
208-
)
203+
url = f"{S3_BUCKET_URL}/{branch}/{commit}/xgboost_r_gpu_{plat}.tar.gz"
204+
artifact_name = f"xgboost_r_gpu_{plat}.tar.gz"
209205
artifact_path = rpkg_dir / artifact_name
210206
retrieve(url=url, filename=artifact_path)
211207
artifacts.append(artifact_path)
@@ -356,7 +352,6 @@ def main(args: argparse.Namespace) -> None:
356352
urls, hashes = download_r_artifacts(
357353
release,
358354
branch,
359-
"" if rc is None else f"rc{rc_ver}",
360355
commit_hash,
361356
outdir,
362357
)

Diff for: doc/install.rst

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ You may choose to reduce the size of the installed package and save the disk spa
8989
The ``xgboost-cpu`` variant will have drastically smaller disk footprint, but does not provide some features, such as the GPU algorithms and
9090
federated learning.
9191

92+
Currently, ``xgboost-cpu`` package is provided for x86_64 (amd64) Linux and Windows platforms.
93+
9294
Conda
9395
*****
9496

Diff for: ops/patch/cpu_only_pypkg.patch

-58
This file was deleted.

Diff for: ops/patch/manylinux2014_warning.patch

-23
This file was deleted.

Diff for: ops/patch/remove_nccl_dep.patch

-12
This file was deleted.

Diff for: ops/pipeline/build-manylinux2014.sh

+7-8
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ PYTHON_BIN="/opt/python/cp310-cp310/bin/python"
2727

2828
echo "--- Build binary wheel for ${WHEEL_TAG}"
2929
set -x
30-
# Patch to add warning about manylinux2014 variant
31-
patch -p0 < ops/patch/remove_nccl_dep.patch
32-
patch -p0 < ops/patch/manylinux2014_warning.patch
30+
31+
python3 ops/script/pypi_variants.py --variant=manylinux2014
3332
python3 ops/docker_run.py \
3433
--image-uri "${IMAGE_URI}" \
3534
-- bash -c \
3635
"cd python-package && ${PYTHON_BIN} -m pip wheel --no-deps -v . --wheel-dir dist/"
37-
git checkout python-package/pyproject.toml python-package/xgboost/core.py
38-
# discard the patch
36+
# discard the patch
37+
python3 ops/script/pypi_variants.py --variant=default
3938

4039
python3 ops/docker_run.py \
4140
--image-uri "${IMAGE_URI}" \
@@ -49,13 +48,13 @@ mv -v wheelhouse/*.whl python-package/dist/
4948

5049
echo "--- Build binary wheel for ${WHEEL_TAG} (CPU only)"
5150
# Patch to rename pkg to xgboost-cpu
52-
patch -p0 < ops/patch/remove_nccl_dep.patch
53-
patch -p0 < ops/patch/cpu_only_pypkg.patch
51+
python3 ops/script/pypi_variants.py --variant=cpu
5452
python3 ops/docker_run.py \
5553
--image-uri "${IMAGE_URI}" \
5654
-- bash -c \
5755
"cd python-package && ${PYTHON_BIN} -m pip wheel --no-deps -v . --wheel-dir dist/"
58-
git checkout python-package/pyproject.toml # discard the patch
56+
# discard the patch
57+
python3 ops/script/pypi_variants.py --variant=default
5958

6059
python3 ops/docker_run.py \
6160
--image-uri "${IMAGE_URI}" \

Diff for: ops/pipeline/build-python-wheels-macos.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ commit_id=$2
1313
if [[ "$platform_id" == macosx_* ]]; then
1414
if [[ "$platform_id" == macosx_arm64 ]]; then
1515
# MacOS, Apple Silicon
16-
WHEEL_TAG=macosx_12_0_arm64
1716
cpython_ver=310
1817
cibw_archs=arm64
1918
export MACOSX_DEPLOYMENT_TARGET=12.0
2019
elif [[ "$platform_id" == macosx_x86_64 ]]; then
2120
# MacOS, Intel
22-
WHEEL_TAG=macosx_10_15_x86_64.macosx_11_0_x86_64.macosx_12_0_x86_64
2321
cpython_ver=310
2422
cibw_archs=x86_64
2523
export MACOSX_DEPLOYMENT_TARGET=10.15
@@ -37,7 +35,7 @@ else
3735
exit 2
3836
fi
3937

40-
# Tell delocate-wheel to not vendor libomp.dylib into the wheel"
38+
# Tell delocate-wheel to not vendor libomp.dylib into the wheel
4139
export CIBW_REPAIR_WHEEL_COMMAND_MACOS="delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} --exclude libomp.dylib"
4240

4341
python -m pip install cibuildwheel

Diff for: ops/pipeline/build-win64-cpu.ps1

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Build Python package xgboost-cpu (minimal install)
2+
3+
$ErrorActionPreference = "Stop"
4+
5+
. ops/pipeline/enforce-ci.ps1
6+
7+
Write-Host "--- Build libxgboost on Windows (minimal)"
8+
9+
mkdir build
10+
cd build
11+
cmake .. -G"Visual Studio 17 2022" -A x64
12+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
13+
cmake --build . --config Release -- /m /nodeReuse:false `
14+
"/consoleloggerparameters:ShowCommandLine;Verbosity=minimal"
15+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
16+
17+
Write-Host "--- Build binary wheel"
18+
cd ..
19+
# Patch to rename pkg to xgboost-cpu
20+
conda activate
21+
python ops/script/pypi_variants.py --variant=cpu
22+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
23+
24+
cd python-package
25+
& pip wheel --no-deps -v . --wheel-dir dist/
26+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
27+
python -m wheel tags --python-tag py3 --abi-tag none `
28+
--platform win_amd64 --remove `
29+
(Get-ChildItem dist/*.whl | Select-Object -Expand FullName)
30+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
31+
32+
Write-Host "--- Upload Python wheel"
33+
cd ..
34+
if ( $is_release_branch -eq 1 ) {
35+
python ops/pipeline/manage-artifacts.py upload `
36+
--s3-bucket 'xgboost-nightly-builds' `
37+
--prefix "$Env:BRANCH_NAME/$Env:GITHUB_SHA" --make-public `
38+
(Get-ChildItem python-package/dist/*.whl | Select-Object -Expand FullName)
39+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
40+
}

Diff for: ops/pipeline/build-win64-gpu.ps1

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## Build Python package and gtest with GPU enabled
2+
13
$ErrorActionPreference = "Stop"
24

35
. ops/pipeline/enforce-ci.ps1

Diff for: ops/script/change_version.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
import tempfile
1818

19+
from pypi_variants import make_pyproject
1920
from test_utils import JVM_PACKAGES, PY_PACKAGE, R_PACKAGE, ROOT, cd
2021

2122

@@ -51,7 +52,7 @@ def pypkg(
5152
with open(pyver_path, "w") as fd:
5253
fd.write(pyver + "\n")
5354

54-
pyprj_path = os.path.join("pyproject.toml")
55+
pyprj_path = os.path.join("pyproject.toml.in")
5556
with open(pyprj_path, "r") as fd:
5657
pyprj = fd.read()
5758
matched = re.search('version = "' + r"([0-9]+\.[0-9]+\.[0-9]+.*)" + '"', pyprj)
@@ -60,6 +61,8 @@ def pypkg(
6061
with open(pyprj_path, "w") as fd:
6162
fd.write(pyprj)
6263

64+
make_pyproject("default")
65+
6366

6467
@cd(R_PACKAGE)
6568
def rpkg(major: int, minor: int, patch: int, is_dev: bool) -> None:

0 commit comments

Comments
 (0)