Skip to content

Commit e36d361

Browse files
authored
[CI] Create xgboost-cpu on Windows (dmlc#10653)
1 parent 9c9db12 commit e36d361

File tree

5 files changed

+75
-14
lines changed

5 files changed

+75
-14
lines changed

doc/install.rst

Lines changed: 2 additions & 0 deletions
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

tests/buildkite/build-win64-cpu.ps1

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Build Python package xgboost-cpu (minimal install)
2+
3+
$ErrorActionPreference = "Stop"
4+
5+
. tests/buildkite/conftest.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+
Get-Content tests/buildkite/remove_nccl_dep.patch | patch -p0
21+
Get-Content tests/buildkite/cpu_only_pypkg.patch | patch -p0
22+
23+
cd python-package
24+
conda activate
25+
& pip install --user -v "pip>=23"
26+
& pip --version
27+
& pip wheel --no-deps -v . --wheel-dir dist/
28+
Get-ChildItem . -Filter dist/*.whl |
29+
Foreach-Object {
30+
& python ../tests/ci_build/rename_whl.py `
31+
--wheel-path $_.FullName `
32+
--commit-hash $Env:BUILDKITE_COMMIT `
33+
--platform-tag win_amd64
34+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
35+
}
36+
37+
Write-Host "--- Upload Python wheel"
38+
cd ..
39+
Get-ChildItem . -Filter python-package/dist/*.whl |
40+
Foreach-Object {
41+
& buildkite-agent artifact upload python-package/dist/$_
42+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
43+
}
44+
if ( $is_release_branch -eq 1 ) {
45+
Get-ChildItem . -Filter python-package/dist/*.whl |
46+
Foreach-Object {
47+
& aws s3 cp python-package/dist/$_ s3://xgboost-nightly-builds/$Env:BUILDKITE_BRANCH/ `
48+
--acl public-read --no-progress
49+
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
50+
}
51+
}

tests/buildkite/build-win64-gpu.ps1

Lines changed: 2 additions & 0 deletions
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
. tests/buildkite/conftest.ps1

tests/buildkite/cpu_only_pypkg.patch

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git python-package/README.rst python-package/README.rst
2-
index 1fc0bb5a0..f1c68470b 100644
2+
index 1fc0bb5a0..4475dbb26 100644
33
--- python-package/README.rst
44
+++ python-package/README.rst
5-
@@ -1,20 +1,15 @@
5+
@@ -1,20 +1,18 @@
66
-======================
77
-XGBoost Python Package
88
-======================
@@ -14,27 +14,28 @@ index 1fc0bb5a0..f1c68470b 100644
1414

1515
-Installation
1616
-============
17-
+The ``xgboost-cpu`` package provides for a minimal installation, with no support for the GPU algorithms
18-
+or federated learning. It is provided to allow XGBoost to be installed in a space-constrained
19-
+environments.
20-
17+
-
2118
-From `PyPI <https://pypi.python.org/pypi/xgboost>`_
2219
----------------------------------------------------
23-
+Note. ``xgboost-cpu`` package is only provided for x86_64 (amd64) Linux and Windows platforms.
24-
+For other platforms, please install ``xgboost`` from https://pypi.org/project/xgboost/.
25-
20+
-
2621
-For a stable version, install using ``pip``::
2722
-
2823
- pip install xgboost
29-
-
30-
-.. |PyPI version| image:: https://badge.fury.io/py/xgboost.svg
31-
- :target: http://badge.fury.io/py/xgboost
32-
-
24+
+The ``xgboost-cpu`` package provides for a minimal installation, with no support for the GPU algorithms
25+
+or federated learning. It is provided to allow XGBoost to be installed in a space-constrained
26+
+environments.
27+
28+
.. |PyPI version| image:: https://badge.fury.io/py/xgboost.svg
29+
:target: http://badge.fury.io/py/xgboost
30+
3331
-For building from source, see `build <https://xgboost.readthedocs.io/en/latest/build.html>`_.
32+
+Note. ``xgboost-cpu`` package is only provided for x86_64 (amd64) Linux and Windows platforms.
33+
+For other platforms, please install ``xgboost`` from https://pypi.org/project/xgboost/.
34+
+
3435
+Note. ``xgboost-cpu`` does not provide an sdist (source distribution). You may install sdist
3536
+from https://pypi.org/project/xgboost/.
3637
diff --git python-package/pyproject.toml python-package/pyproject.toml
37-
index 46c1451c2..c5dc908d9 100644
38+
index 05bbe998c..50e10bf26 100644
3839
--- python-package/pyproject.toml
3940
+++ python-package/pyproject.toml
4041
@@ -6,7 +6,7 @@ backend-path = ["."]

tests/buildkite/pipeline-win64.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ steps:
1313
key: build-win64-gpu
1414
agents:
1515
queue: windows-cpu
16+
- label: ":windows: Build XGBoost for Windows (minimal)"
17+
command: "tests/buildkite/build-win64-cpu.ps1"
18+
key: build-win64-cpu
19+
agents:
20+
queue: windows-cpu
1621

1722
- wait
1823

0 commit comments

Comments
 (0)