Skip to content

Commit 7354955

Browse files
trivialfishcho3
andauthored
Test federated plugin using GitHub action. (dmlc#10336)
Co-authored-by: Philip Hyunsu Cho <[email protected]>
1 parent 7ae5c97 commit 7354955

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,9 @@ jobs:
156156
- name: Build and install XGBoost shared library
157157
run: |
158158
cd build
159-
cmake .. -DBUILD_STATIC_LIB=OFF -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -GNinja
159+
cmake .. -DBUILD_STATIC_LIB=OFF -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -GNinja -DPLUGIN_FEDERATED=ON -DGOOGLE_TEST=ON
160160
ninja -v install
161+
./testxgboost
161162
cd -
162163
- name: Build and run C API demo with shared
163164
run: |

doc/build.rst

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ From the command line on Linux starting from the XGBoost directory:
134134
135135
.. note:: Specifying compute capability
136136

137-
To speed up compilation, the compute version specific to your GPU could be passed to cmake as, e.g., ``-DGPU_COMPUTE_VER=50``. A quick explanation and numbers for some architectures can be found `in this page <https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/>`_.
137+
To speed up compilation, the compute version specific to your GPU could be passed to cmake as, e.g., ``-DCMAKE_CUDA_ARCHITECTURES=75``. A quick explanation and numbers for some architectures can be found `in this page <https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/>`_.
138138

139139
.. note:: Faster distributed GPU training with NCCL
140140

@@ -147,6 +147,8 @@ From the command line on Linux starting from the XGBoost directory:
147147
cmake .. -DUSE_CUDA=ON -DUSE_NCCL=ON -DNCCL_ROOT=/path/to/nccl2
148148
make -j4
149149
150+
Some additional flags are available for NCCL, ``BUILD_WITH_SHARED_NCCL`` enables building XGBoost with NCCL as a shared library, while ``USE_DLOPEN_NCCL`` enables XGBoost to load NCCL at runtime using ``dlopen``.
151+
150152
On Windows, run CMake as follows:
151153

152154
.. code-block:: bash
@@ -165,6 +167,17 @@ The above cmake configuration run will create an ``xgboost.sln`` solution file i
165167
166168
To speed up compilation, run multiple jobs in parallel by appending option ``-- /MP``.
167169

170+
Federated Learning
171+
==================
172+
173+
The federated learning plugin requires ``grpc`` and ``protobuf``. To install grpc, refer
174+
to the `installation guide from the gRPC website
175+
<https://grpc.io/docs/languages/cpp/quickstart/>`_. Alternatively, one can use the
176+
``libgrpc`` and the ``protobuf`` package from conda forge if conda is available. After
177+
obtaining the required dependencies, enable the flag: `-DPLUGIN_FEDERATED=ON` when running
178+
CMake. Please note that only Linux is supported for the federated plugin.
179+
180+
168181
.. _build_python:
169182

170183
***********************************
@@ -228,11 +241,12 @@ There are several ways to build and install the package from source:
228241

229242
3. Editable installation
230243

231-
To further enable rapid development and iteration, we provide an **editable installation**.
232-
In an editable installation, the installed package is simply a symbolic link to your
233-
working copy of the XGBoost source code. So every changes you make to your source
234-
directory will be immediately visible to the Python interpreter. Here is how to
235-
install XGBoost as editable installation:
244+
To further enable rapid development and iteration, we provide an **editable
245+
installation**. In an editable installation, the installed package is simply a symbolic
246+
link to your working copy of the XGBoost source code. So every changes you make to your
247+
source directory will be immediately visible to the Python interpreter. To install
248+
XGBoost as editable installation, first build the shared library as previously
249+
described, then install the Python package:
236250

237251
.. code-block:: bash
238252

plugin/federated/README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
XGBoost Plugin for Federated Learning
22
=====================================
33

4-
This folder contains the plugin for federated learning. Follow these steps to build and test it.
4+
This folder contains the plugin for federated learning.
55

6-
Install gRPC
7-
------------
8-
Refer to the [installation guide from the gRPC website](https://grpc.io/docs/languages/cpp/quickstart/).
6+
See [build instruction](../../doc/build.rst) for how to build the plugin.
97

10-
Build the Plugin
11-
----------------
12-
```shell
13-
# Under xgboost source tree.
14-
mkdir build
15-
cd build
16-
cmake .. -GNinja \
17-
-DPLUGIN_FEDERATED=ON \
18-
-DUSE_CUDA=ON\
19-
-DUSE_NCCL=ON
20-
ninja
21-
cd ../python-package
22-
pip install -e .
23-
```
24-
If CMake fails to locate gRPC, you may need to pass `-DCMAKE_PREFIX_PATH=<grpc path>` to CMake.
258

269
Test Federated XGBoost
2710
----------------------
2811
```shell
2912
# Under xgboost source tree.
30-
cd tests/distributed
13+
cd tests/distributed/test_federated
3114
# This tests both CPU training (`hist`) and GPU training (`gpu_hist`).
3215
./runtests-federated.sh
3316
```

tests/ci_build/conda_env/cpp_test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ dependencies:
88
- c-compiler
99
- cxx-compiler
1010
- gtest
11+
- protobuf
12+
- libgrpc

0 commit comments

Comments
 (0)