From 6052fc0de7ec69aec1c96ad74ae8df0a686f3c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yuan-Ting=20Hsieh=20=28=E8=AC=9D=E6=B2=85=E5=BB=B7=29?= Date: Fri, 23 Aug 2024 09:51:28 -0700 Subject: [PATCH] Remove unused code and update README (#2828) --- .../xgboost/encryption_plugins/README.md | 45 ++++++++++++------- .../cuda_plugin/src/cuda_plugin.h | 4 -- 2 files changed, 30 insertions(+), 19 deletions(-) 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; }