File tree Expand file tree Collapse file tree 16 files changed +190
-117
lines changed Expand file tree Collapse file tree 16 files changed +190
-117
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ include(cmake/Utils.cmake)
4
4
list (APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR} /cmake/modules" )
5
5
cmake_policy (SET CMP0022 NEW )
6
6
cmake_policy (SET CMP0079 NEW )
7
+ cmake_policy (SET CMP0076 NEW )
7
8
set (CMAKE_POLICY_DEFAULT_CMP0063 NEW )
8
9
cmake_policy (SET CMP0063 NEW )
9
10
@@ -117,6 +118,20 @@ endif (BUILD_STATIC_LIB AND (R_LIB OR JVM_BINDINGS))
117
118
if (PLUGIN_RMM AND (NOT BUILD_WITH_CUDA_CUB ))
118
119
message (SEND_ERROR "Cannot build with RMM using cub submodule." )
119
120
endif (PLUGIN_RMM AND (NOT BUILD_WITH_CUDA_CUB ))
121
+ if (PLUGIN_FEDERATED )
122
+ if (CMAKE_CROSSCOMPILING )
123
+ message (SEND_ERROR "Cannot cross compile with federated learning support" )
124
+ endif ()
125
+ if (BUILD_STATIC_LIB )
126
+ message (SEND_ERROR "Cannot build static lib with federated learning support" )
127
+ endif ()
128
+ if (R_LIB OR JVM_BINDINGS )
129
+ message (SEND_ERROR "Cannot enable federated learning support when R or JVM packages are enabled." )
130
+ endif ()
131
+ if (WIN32 )
132
+ message (SEND_ERROR "Federated learning not supported for Windows platform" )
133
+ endif ()
134
+ endif ()
120
135
121
136
#-- Sanitizer
122
137
if (USE_SANITIZER )
Original file line number Diff line number Diff line change 1
1
# gRPC needs to be installed first. See README.md.
2
+ set (protobuf_MODULE_COMPATIBLE TRUE )
3
+ set (protobuf_BUILD_SHARED_LIBS TRUE )
2
4
find_package (Protobuf CONFIG REQUIRED )
3
5
find_package (gRPC CONFIG REQUIRED )
4
- find_package ( Threads )
6
+ message ( STATUS "Found gRPC: ${gRPC_CONFIG} " )
5
7
6
8
# Generated code from the protobuf definition.
7
9
add_library (federated_proto federated.proto )
8
10
target_link_libraries (federated_proto PUBLIC protobuf::libprotobuf gRPC::grpc gRPC::grpc++ )
9
11
target_include_directories (federated_proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR} )
10
12
xgboost_target_properties (federated_proto )
11
13
12
- get_target_property (grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION )
13
- protobuf_generate (TARGET federated_proto LANGUAGE cpp )
14
+ protobuf_generate (
15
+ TARGET federated_proto
16
+ LANGUAGE cpp
17
+ PROTOC_OUT_DIR "${PROTO_BINARY_DIR} " )
14
18
protobuf_generate (
15
19
TARGET federated_proto
16
20
LANGUAGE grpc
17
21
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
18
- PLUGIN "protoc-gen-grpc=${grpc_cpp_plugin_location} " )
22
+ PLUGIN "protoc-gen-grpc=\$ <TARGET_FILE:gRPC::grpc_cpp_plugin>"
23
+ PROTOC_OUT_DIR "${PROTO_BINARY_DIR} " )
19
24
20
25
# Wrapper for the gRPC client.
21
26
add_library (federated_client INTERFACE )
Original file line number Diff line number Diff line change @@ -5,31 +5,24 @@ This folder contains the plugin for federated learning. Follow these steps to bu
5
5
6
6
Install gRPC
7
7
------------
8
- ``` shell
9
- sudo apt-get install build-essential autoconf libtool pkg-config cmake ninja-build
10
- git clone -b v1.47.0 https://github.com/grpc/grpc
11
- cd grpc
12
- git submodule update --init
13
- cmake -S . -B build -GNinja -DABSL_PROPAGATE_CXX_STD=ON
14
- cmake --build build --target install
15
- ```
8
+ Refer to the [ installation guide from the gRPC website] ( https://grpc.io/docs/languages/cpp/quickstart/ ) .
16
9
17
10
Build the Plugin
18
11
----------------
19
12
``` shell
20
13
# Under xgboost source tree.
21
14
mkdir build
22
15
cd build
23
- # For now NCCL needs to be turned off.
24
- cmake .. -GNinja \
25
- -DPLUGIN_FEDERATED =ON\
16
+ cmake .. -GNinja \
17
+ -DPLUGIN_FEDERATED=ON \
18
+ -DBUILD_WITH_CUDA_CUB =ON \
26
19
-DUSE_CUDA=ON\
27
- -DBUILD_WITH_CUDA_CUB=ON\
28
- -DUSE_NCCL=OFF
20
+ -DUSE_NCCL=ON
29
21
ninja
30
22
cd ../python-package
31
23
pip install -e . # or equivalently python setup.py develop
32
24
```
25
+ If CMake fails to locate gRPC, you may need to pass ` -DCMAKE_PREFIX_PATH=<grpc path> ` to CMake.
33
26
34
27
Test Federated XGBoost
35
28
----------------------
Original file line number Diff line number Diff line change 6
6
if [ " $# " -lt 1 ]
7
7
then
8
8
echo " Usage: $0 [container to build]"
9
- return 1
9
+ exit 1
10
10
fi
11
11
container=$1
12
12
@@ -17,18 +17,21 @@ echo "--- Build container ${container}"
17
17
BUILD_ARGS=" "
18
18
19
19
case " ${container} " in
20
+ cpu)
21
+ ;;
22
+
20
23
gpu|rmm)
21
24
BUILD_ARGS=" $BUILD_ARGS --build-arg CUDA_VERSION_ARG=$CUDA_VERSION "
22
25
BUILD_ARGS=" $BUILD_ARGS --build-arg RAPIDS_VERSION_ARG=$RAPIDS_VERSION "
23
26
;;
24
27
25
- jvm_gpu_build)
28
+ gpu_build_centos7| jvm_gpu_build)
26
29
BUILD_ARGS=" $BUILD_ARGS --build-arg CUDA_VERSION_ARG=$CUDA_VERSION "
27
30
;;
28
31
29
32
* )
30
33
echo " Unrecognized container ID: ${container} "
31
- return 2
34
+ exit 2
32
35
;;
33
36
esac
34
37
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ $command_wrapper rm -fv dmlc-core/include/dmlc/build_config_default.h
14
14
# the configured header build/dmlc/build_config.h instead of
15
15
# include/dmlc/build_config_default.h.
16
16
echo " --- Build libxgboost from the source"
17
- $command_wrapper tests/ci_build/build_via_cmake.sh -DPLUGIN_DENSE_PARSER=ON
17
+ $command_wrapper tests/ci_build/build_via_cmake.sh -DCMAKE_PREFIX_PATH=/opt/grpc \
18
+ -DPLUGIN_DENSE_PARSER=ON -DPLUGIN_FEDERATED=ON
18
19
echo " --- Run Google Test"
19
20
$command_wrapper bash -c " cd build && ctest --extra-verbose"
20
21
echo " --- Stash XGBoost CLI executable"
Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ command_wrapper="tests/ci_build/ci_build.sh gpu_build_centos7 docker --build-arg
20
20
21
21
echo " --- Build libxgboost from the source"
22
22
$command_wrapper tests/ci_build/prune_libnccl.sh
23
- $command_wrapper tests/ci_build/build_via_cmake.sh -DUSE_CUDA=ON -DUSE_NCCL=ON \
24
- -DUSE_OPENMP=ON -DHIDE_CXX_SYMBOLS=ON -DUSE_NCCL_LIB_PATH =ON \
25
- -DNCCL_INCLUDE_DIR=/usr/include -DNCCL_LIBRARY=/workspace/libnccl_static.a \
26
- ${arch_flag}
23
+ $command_wrapper tests/ci_build/build_via_cmake.sh -DCMAKE_PREFIX_PATH=/opt/grpc \
24
+ -DUSE_CUDA=ON -DUSE_NCCL=ON - DUSE_OPENMP=ON -DHIDE_CXX_SYMBOLS=ON -DPLUGIN_FEDERATED =ON \
25
+ -DUSE_NCCL_LIB_PATH=ON -DNCCL_INCLUDE_DIR=/usr/include \
26
+ -DNCCL_LIBRARY=/workspace/libnccl_static.a ${arch_flag}
27
27
echo " --- Build binary wheel"
28
28
$command_wrapper bash -c \
29
29
" cd python-package && rm -rf dist/* && python setup.py bdist_wheel --universal"
Original file line number Diff line number Diff line change 17
17
- label : " :docker: Build containers"
18
18
commands :
19
19
- " tests/buildkite/build-containers.sh gpu"
20
+ - " tests/buildkite/build-containers.sh gpu_build_centos7"
20
21
- " tests/buildkite/build-containers.sh jvm_gpu_build"
21
22
key : build-containers
22
23
agents :
Original file line number Diff line number Diff line change 13
13
# ### -------- CONTAINER BUILD --------
14
14
- label : " :docker: Build containers"
15
15
commands :
16
+ - " tests/buildkite/build-containers.sh cpu"
16
17
- " tests/buildkite/build-containers.sh gpu"
18
+ - " tests/buildkite/build-containers.sh gpu_build_centos7"
17
19
- " tests/buildkite/build-containers.sh rmm"
18
20
key : build-containers
19
21
agents :
Original file line number Diff line number Diff line change @@ -26,6 +26,15 @@ ENV CPP=cpp-8
26
26
ENV GOSU_VERSION 1.10
27
27
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
28
28
29
+ # Install gRPC
30
+ RUN git clone -b v1.49.1 https://github.com/grpc/grpc.git \
31
+ --recurse-submodules --depth 1 --shallow-submodules && \
32
+ pushd grpc && \
33
+ cmake -S . -B build -GNinja -DCMAKE_INSTALL_PREFIX=/opt/grpc && \
34
+ cmake --build build --target install && \
35
+ popd && \
36
+ rm -rf grpc
37
+
29
38
# Create new Conda environment
30
39
COPY conda_env/cpu_test.yml /scripts/
31
40
RUN mamba env create -n cpu_test --file=/scripts/cpu_test.yml
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments