Skip to content

Commit

Permalink
[CI] Create xgboost-cpu on Windows (dmlc#10653)
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 authored Jul 31, 2024
1 parent 9c9db12 commit e36d361
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 14 deletions.
2 changes: 2 additions & 0 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ You may choose to reduce the size of the installed package and save the disk spa
The ``xgboost-cpu`` variant will have drastically smaller disk footprint, but does not provide some features, such as the GPU algorithms and
federated learning.

Currently, ``xgboost-cpu`` package is provided for x86_64 (amd64) Linux and Windows platforms.

Conda
*****

Expand Down
51 changes: 51 additions & 0 deletions tests/buildkite/build-win64-cpu.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Build Python package xgboost-cpu (minimal install)

$ErrorActionPreference = "Stop"

. tests/buildkite/conftest.ps1

Write-Host "--- Build libxgboost on Windows (minimal)"

mkdir build
cd build
cmake .. -G"Visual Studio 17 2022" -A x64
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
cmake --build . --config Release -- /m /nodeReuse:false `
"/consoleloggerparameters:ShowCommandLine;Verbosity=minimal"
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }

Write-Host "--- Build binary wheel"
cd ..
# Patch to rename pkg to xgboost-cpu
Get-Content tests/buildkite/remove_nccl_dep.patch | patch -p0
Get-Content tests/buildkite/cpu_only_pypkg.patch | patch -p0

cd python-package
conda activate
& pip install --user -v "pip>=23"
& pip --version
& pip wheel --no-deps -v . --wheel-dir dist/
Get-ChildItem . -Filter dist/*.whl |
Foreach-Object {
& python ../tests/ci_build/rename_whl.py `
--wheel-path $_.FullName `
--commit-hash $Env:BUILDKITE_COMMIT `
--platform-tag win_amd64
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
}

Write-Host "--- Upload Python wheel"
cd ..
Get-ChildItem . -Filter python-package/dist/*.whl |
Foreach-Object {
& buildkite-agent artifact upload python-package/dist/$_
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
}
if ( $is_release_branch -eq 1 ) {
Get-ChildItem . -Filter python-package/dist/*.whl |
Foreach-Object {
& aws s3 cp python-package/dist/$_ s3://xgboost-nightly-builds/$Env:BUILDKITE_BRANCH/ `
--acl public-read --no-progress
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
}
}
2 changes: 2 additions & 0 deletions tests/buildkite/build-win64-gpu.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## Build Python package and gtest with GPU enabled

$ErrorActionPreference = "Stop"

. tests/buildkite/conftest.ps1
Expand Down
29 changes: 15 additions & 14 deletions tests/buildkite/cpu_only_pypkg.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git python-package/README.rst python-package/README.rst
index 1fc0bb5a0..f1c68470b 100644
index 1fc0bb5a0..4475dbb26 100644
--- python-package/README.rst
+++ python-package/README.rst
@@ -1,20 +1,15 @@
@@ -1,20 +1,18 @@
-======================
-XGBoost Python Package
-======================
Expand All @@ -14,27 +14,28 @@ index 1fc0bb5a0..f1c68470b 100644

-Installation
-============
+The ``xgboost-cpu`` package provides for a minimal installation, with no support for the GPU algorithms
+or federated learning. It is provided to allow XGBoost to be installed in a space-constrained
+environments.

-
-From `PyPI <https://pypi.python.org/pypi/xgboost>`_
----------------------------------------------------
+Note. ``xgboost-cpu`` package is only provided for x86_64 (amd64) Linux and Windows platforms.
+For other platforms, please install ``xgboost`` from https://pypi.org/project/xgboost/.

-
-For a stable version, install using ``pip``::
-
- pip install xgboost
-
-.. |PyPI version| image:: https://badge.fury.io/py/xgboost.svg
- :target: http://badge.fury.io/py/xgboost
-
+The ``xgboost-cpu`` package provides for a minimal installation, with no support for the GPU algorithms
+or federated learning. It is provided to allow XGBoost to be installed in a space-constrained
+environments.

.. |PyPI version| image:: https://badge.fury.io/py/xgboost.svg
:target: http://badge.fury.io/py/xgboost

-For building from source, see `build <https://xgboost.readthedocs.io/en/latest/build.html>`_.
+Note. ``xgboost-cpu`` package is only provided for x86_64 (amd64) Linux and Windows platforms.
+For other platforms, please install ``xgboost`` from https://pypi.org/project/xgboost/.
+
+Note. ``xgboost-cpu`` does not provide an sdist (source distribution). You may install sdist
+from https://pypi.org/project/xgboost/.
diff --git python-package/pyproject.toml python-package/pyproject.toml
index 46c1451c2..c5dc908d9 100644
index 05bbe998c..50e10bf26 100644
--- python-package/pyproject.toml
+++ python-package/pyproject.toml
@@ -6,7 +6,7 @@ backend-path = ["."]
Expand Down
5 changes: 5 additions & 0 deletions tests/buildkite/pipeline-win64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ steps:
key: build-win64-gpu
agents:
queue: windows-cpu
- label: ":windows: Build XGBoost for Windows (minimal)"
command: "tests/buildkite/build-win64-cpu.ps1"
key: build-win64-cpu
agents:
queue: windows-cpu

- wait

Expand Down

0 comments on commit e36d361

Please sign in to comment.