Skip to content

Commit

Permalink
Updated plugin build doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nvidianz committed Aug 31, 2024
1 parent e3f195d commit 0e0dd71
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
6 changes: 6 additions & 0 deletions examples/advanced/xgboost_secure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ To be able to run all the examples, please install the requirements first.
```
pip install -r requirements.txt
```
## Encryption Plugins
The secure XGBoost requires encryption plugins to work. The plugins are distributed with NVFlare package. If you build NVFlare from source, you need
to build the plugins following the instructions in this [README](https://github.com/NVIDIA/NVFlare/blob/main/integration/xgboost/encryption_plugins/README.md)

The build process will generate 2 .so files: libcuda_paillier.so and libnvflare.so. Configure the path accordingly following the instructions in
[XGBoost User Guide](https://nvflare.readthedocs.io/en/main/user_guide/federated_xgboost/secure_xgboost_user_guide.html)

## Data Preparation
### Download and Store Data
Expand Down
3 changes: 1 addition & 2 deletions examples/advanced/xgboost_secure/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
nvflare~=2.5.0rc
ipcl_python @ git+https://github.com/intel/pailliercryptolib_python.git@development
# require xgboost 2.2 version, for now need to install a nightly build
--extra-index-url https://s3-us-west-2.amazonaws.com/xgboost-nightly-builds/list.html?prefix=federated-secure/
xgboost
https://s3-us-west-2.amazonaws.com/xgboost-nightly-builds/federated-secure/xgboost-2.2.0.dev0%2B4601688195708f7c31fcceeb0e0ac735e7311e61-py3-none-manylinux_2_28_x86_64.whl
pandas
scikit-learn
shap
Expand Down
26 changes: 17 additions & 9 deletions integration/xgboost/encryption_plugins/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# XGBoost plugins
# XGBoost Encryption Plugins


## Install required dependencies for building CUDA plugin
Expand All @@ -7,32 +7,40 @@ Require `libgmp3-dev`, CMake>=3.19, CUDA runtime >= 12.1, CUDA driver >= 12.1, N
Compute Compatibility >= 7.0

On the building site:
0. Install GPU Driver >= 535, CUDA runtime >= 12.1, CUDA driver >= 12.1
1. Install `libgmp3-dev`, gcc, CMake
2. Clone the NVFlare main branch and update the submodule
1. Install GPU Driver >= 535, CUDA runtime >= 12.1, CUDA driver >= 12.1
2. Install `libgmp3-dev`, gcc, CMake
3. Clone the NVFlare main branch and update the submodule
```
git clone https://github.com/NVIDIA/NVFlare.git \
&& cd NVFlare/integration/xgboost/encryption_plugins \
&& git submodule update --init --recursive
```
3. Under integration/xgboost/encryption_plugins, run the build commands
## Building Plugins
Under integration/xgboost/encryption_plugins, run the build commands
```
mkdir build
cd build
cmake ..
make
```
The generated plugin files under build folder are,
```
cuda_pluign/libcuda_paillier.so
nvflare_plugin/libnvflare.so
```
> **_NOTE:_** You can pass option to cmake to disable the build of CUDA plugin
> if you don't have the environment: ```cmake -DBUILD_CUDA_PLUGIN=OFF ..```
## How to run with CUDA plugin
## How to run XGBoost with encryption plugins
For each client site:
0. Copy the pre-built ".so" file to each site
1. Make sure you have installed required dependencies: GPU Driver >= 535, CUDA runtime >= 12.1, CUDA driver >= 12.1, `libgmp3-dev`
2. Update the site local resource.json to point to the ".so" file
1. Copy the pre-built ".so" files to each site
2. Make sure you have installed required dependencies: GPU Driver >= 535, CUDA runtime >= 12.1, CUDA driver >= 12.1, `libgmp3-dev`
3. Update the site local resource.json to point to the appropriate ".so" file
For handling these complex environment, we recommend you build a docker image so every
client site can just use it.

0 comments on commit 0e0dd71

Please sign in to comment.