[CI] Test federated learning plugin in the CI (#8325)
This commit is contained in:
committed by
GitHub
parent
97a5b088a5
commit
2faa744aba
@@ -1,7 +1,9 @@
|
||||
# gRPC needs to be installed first. See README.md.
|
||||
set(protobuf_MODULE_COMPATIBLE TRUE)
|
||||
set(protobuf_BUILD_SHARED_LIBS TRUE)
|
||||
find_package(Protobuf CONFIG REQUIRED)
|
||||
find_package(gRPC CONFIG REQUIRED)
|
||||
find_package(Threads)
|
||||
message(STATUS "Found gRPC: ${gRPC_CONFIG}")
|
||||
|
||||
# Generated code from the protobuf definition.
|
||||
add_library(federated_proto federated.proto)
|
||||
@@ -9,13 +11,16 @@ target_link_libraries(federated_proto PUBLIC protobuf::libprotobuf gRPC::grpc gR
|
||||
target_include_directories(federated_proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||
xgboost_target_properties(federated_proto)
|
||||
|
||||
get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION)
|
||||
protobuf_generate(TARGET federated_proto LANGUAGE cpp)
|
||||
protobuf_generate(
|
||||
TARGET federated_proto
|
||||
LANGUAGE cpp
|
||||
PROTOC_OUT_DIR "${PROTO_BINARY_DIR}")
|
||||
protobuf_generate(
|
||||
TARGET federated_proto
|
||||
LANGUAGE grpc
|
||||
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
|
||||
PLUGIN "protoc-gen-grpc=${grpc_cpp_plugin_location}")
|
||||
PLUGIN "protoc-gen-grpc=\$<TARGET_FILE:gRPC::grpc_cpp_plugin>"
|
||||
PROTOC_OUT_DIR "${PROTO_BINARY_DIR}")
|
||||
|
||||
# Wrapper for the gRPC client.
|
||||
add_library(federated_client INTERFACE)
|
||||
|
||||
@@ -5,14 +5,7 @@ This folder contains the plugin for federated learning. Follow these steps to bu
|
||||
|
||||
Install gRPC
|
||||
------------
|
||||
```shell
|
||||
sudo apt-get install build-essential autoconf libtool pkg-config cmake ninja-build
|
||||
git clone -b v1.47.0 https://github.com/grpc/grpc
|
||||
cd grpc
|
||||
git submodule update --init
|
||||
cmake -S . -B build -GNinja -DABSL_PROPAGATE_CXX_STD=ON
|
||||
cmake --build build --target install
|
||||
```
|
||||
Refer to the [installation guide from the gRPC website](https://grpc.io/docs/languages/cpp/quickstart/).
|
||||
|
||||
Build the Plugin
|
||||
----------------
|
||||
@@ -20,16 +13,16 @@ Build the Plugin
|
||||
# Under xgboost source tree.
|
||||
mkdir build
|
||||
cd build
|
||||
# For now NCCL needs to be turned off.
|
||||
cmake .. -GNinja\
|
||||
-DPLUGIN_FEDERATED=ON\
|
||||
cmake .. -GNinja \
|
||||
-DPLUGIN_FEDERATED=ON \
|
||||
-DBUILD_WITH_CUDA_CUB=ON \
|
||||
-DUSE_CUDA=ON\
|
||||
-DBUILD_WITH_CUDA_CUB=ON\
|
||||
-DUSE_NCCL=OFF
|
||||
-DUSE_NCCL=ON
|
||||
ninja
|
||||
cd ../python-package
|
||||
pip install -e . # or equivalently python setup.py develop
|
||||
```
|
||||
If CMake fails to locate gRPC, you may need to pass `-DCMAKE_PREFIX_PATH=<grpc path>` to CMake.
|
||||
|
||||
Test Federated XGBoost
|
||||
----------------------
|
||||
|
||||
Reference in New Issue
Block a user