Skip to content

Commit

Permalink
Remove unused code and update README (#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanTingHsieh authored Aug 23, 2024
1 parent da54ac1 commit 6052fc0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
45 changes: 30 additions & 15 deletions integration/xgboost/encryption_plugins/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
# XGBoost plugins


## Install required dependencies for CUDA plugin
If you want to build CUDA plugin, you need to install the following libraries:
Require `libgmp-dev`, CUDA runtime >= 12.1, CUDA driver >= 12.1, NVIDIA GPU Driver >= 535
## Install required dependencies for building CUDA plugin
If you want to build the CUDA plugin on your own, you need to install the following libraries:
Require `libgmp3-dev`, CMake>=3.19, CUDA runtime >= 12.1, CUDA driver >= 12.1, NVIDIA GPU Driver >= 535
Compute Compatibility >= 7.0

## Build instructions
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
```
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
```
mkdir build
cd build
cmake ..
make
```

```
mkdir build
cd build
cmake ..
make
```
> **_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 ..```
## Disable build of CUDA plugin
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
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

For handling these complex environment, we recommend you build a docker image so every
client site can just use it.
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,10 @@ class CUDAPlugin: public LocalPlugin {

Buffer result = createBuffer(true, h_ptr, key_size, rand_seed, rand_seed_size, d_ciphers_ptr, mem_size);

void* buffer = malloc(mem_size);
cudaMemcpy(buffer, d_ciphers_ptr, mem_size, cudaMemcpyDeviceToHost);
cudaFree(d_plains_ptr);
cudaFree(d_ciphers_ptr);
free(h_ptr);

//Buffer result(buffer, mem_size, true);

return result;
}

Expand Down

0 comments on commit 6052fc0

Please sign in to comment.