Speed up tests with federated learning enabled (#8350)

* Speed up tests with federated learning enabled

* Re-enable timeouts

Co-authored-by: Hyunsu Philip Cho <chohyu01@cs.washington.edu>
This commit is contained in:
Rong Ou 2022-10-17 15:17:04 -07:00 committed by GitHub
parent 031d66ec27
commit 8f3dee58be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 14 deletions

View File

@ -29,5 +29,5 @@ target_link_libraries(federated_client INTERFACE federated_proto)
# Rabit engine for Federated Learning. # Rabit engine for Federated Learning.
target_sources(objxgboost PRIVATE federated_server.cc) target_sources(objxgboost PRIVATE federated_server.cc)
target_link_libraries(objxgboost PRIVATE federated_client) target_link_libraries(objxgboost PRIVATE federated_client "-Wl,--exclude-libs,ALL")
target_compile_definitions(objxgboost PUBLIC -DXGBOOST_USE_FEDERATED=1) target_compile_definitions(objxgboost PUBLIC -DXGBOOST_USE_FEDERATED=1)

View File

@ -41,7 +41,7 @@ def skip_ipv6() -> PytestSkip:
return {"condition": not has_ipv6(), "reason": "IPv6 is required to be enabled."} return {"condition": not has_ipv6(), "reason": "IPv6 is required to be enabled."}
def timeout(sec: int, *args: Any, enable: bool = False, **kwargs: Any) -> Any: def timeout(sec: int, *args: Any, enable: bool = True, **kwargs: Any) -> Any:
"""Make a pytest mark for the `pytest-timeout` package. """Make a pytest mark for the `pytest-timeout` package.
Parameters Parameters

View File

@ -42,19 +42,15 @@ void XGBBuildInfoDevice(Json *p_info) {
} }
void XGBoostAPIGuard::SetGPUAttribute() { void XGBoostAPIGuard::SetGPUAttribute() {
try { // Not calling `safe_cuda` to avoid unnecessary exception handling overhead.
device_id_ = dh::CurrentDevice(); // If errors, do nothing, assuming running on CPU only machine.
} catch (dmlc::Error const&) { cudaGetDevice(&device_id_);
// do nothing, running on CPU only machine
}
} }
void XGBoostAPIGuard::RestoreGPUAttribute() { void XGBoostAPIGuard::RestoreGPUAttribute() {
try { // Not calling `safe_cuda` to avoid unnecessary exception handling overhead.
dh::safe_cuda(cudaSetDevice(device_id_)); // If errors, do nothing, assuming running on CPU only machine.
} catch (dmlc::Error const&) { cudaSetDevice(device_id_);
// do nothing, running on CPU only machine
}
} }
} // namespace xgboost } // namespace xgboost

View File

@ -30,7 +30,7 @@ ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN git clone -b v1.49.1 https://github.com/grpc/grpc.git \ RUN git clone -b v1.49.1 https://github.com/grpc/grpc.git \
--recurse-submodules --depth 1 --shallow-submodules && \ --recurse-submodules --depth 1 --shallow-submodules && \
pushd grpc && \ pushd grpc && \
cmake -S . -B build -GNinja -DCMAKE_INSTALL_PREFIX=/opt/grpc && \ cmake -S . -B build -GNinja -DCMAKE_INSTALL_PREFIX=/opt/grpc -DCMAKE_CXX_VISIBILITY_PRESET=hidden && \
cmake --build build --target install && \ cmake --build build --target install && \
popd && \ popd && \
rm -rf grpc rm -rf grpc

View File

@ -39,7 +39,7 @@ ENV GOSU_VERSION 1.10
RUN git clone -b v1.49.1 https://github.com/grpc/grpc.git \ RUN git clone -b v1.49.1 https://github.com/grpc/grpc.git \
--recurse-submodules --depth 1 && \ --recurse-submodules --depth 1 && \
pushd grpc && \ pushd grpc && \
cmake -S . -B build -GNinja -DCMAKE_INSTALL_PREFIX=/opt/grpc && \ cmake -S . -B build -GNinja -DCMAKE_INSTALL_PREFIX=/opt/grpc -DCMAKE_CXX_VISIBILITY_PRESET=hidden && \
cmake --build build --target install && \ cmake --build build --target install && \
popd && \ popd && \
rm -rf grpc rm -rf grpc