diff --git a/integration/xgboost/encryption_plugins/README.md b/integration/xgboost/encryption_plugins/README.md index be92cf4b40..4e7b991046 100644 --- a/integration/xgboost/encryption_plugins/README.md +++ b/integration/xgboost/encryption_plugins/README.md @@ -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. diff --git a/integration/xgboost/encryption_plugins/cuda_plugin/src/cuda_plugin.h b/integration/xgboost/encryption_plugins/cuda_plugin/src/cuda_plugin.h index 539e513f47..1df38c7da1 100755 --- a/integration/xgboost/encryption_plugins/cuda_plugin/src/cuda_plugin.h +++ b/integration/xgboost/encryption_plugins/cuda_plugin/src/cuda_plugin.h @@ -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; }