From d33043a3489f077f6d732b8ca287d38e38700d8c Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Tue, 2 Jul 2024 15:34:38 +0800 Subject: [PATCH] [coll] Allow using local host for testing. (#10526) - Don't try to retrieve the IP address if a host is specified. - Fix compiler deprecation warning. --- src/collective/tracker.cc | 10 ++++++---- src/common/cuda_pinned_allocator.h | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/collective/tracker.cc b/src/collective/tracker.cc index 56ec5d546b72..6cb3601db7f4 100644 --- a/src/collective/tracker.cc +++ b/src/collective/tracker.cc @@ -111,12 +111,14 @@ RabitTracker::WorkerProxy::WorkerProxy(std::int32_t world, TCPSocket sock, SockA } RabitTracker::RabitTracker(Json const& config) : Tracker{config} { - std::string self; auto rc = Success() << [&] { - return collective::GetHostAddress(&self); + host_.clear(); + host_ = OptionalArg(config, "host", std::string{}); + if (host_.empty()) { + return collective::GetHostAddress(&host_); + } + return Success(); } << [&] { - host_ = OptionalArg(config, "host", self); - auto addr = MakeSockAddress(xgboost::StringView{host_}, 0); listener_ = TCPSocket::Create(addr.IsV4() ? SockDomain::kV4 : SockDomain::kV6); return listener_.Bind(host_, &this->port_); diff --git a/src/common/cuda_pinned_allocator.h b/src/common/cuda_pinned_allocator.h index d11851d99d37..6fe1757fd369 100644 --- a/src/common/cuda_pinned_allocator.h +++ b/src/common/cuda_pinned_allocator.h @@ -61,6 +61,8 @@ class pinned_allocator { XGBOOST_DEVICE inline ~pinned_allocator() {} // NOLINT: host/device markup ignored on defaulted functions XGBOOST_DEVICE inline pinned_allocator(pinned_allocator const&) {} // NOLINT: host/device markup ignored on defaulted functions + pinned_allocator& operator=(pinned_allocator const& that) = default; + pinned_allocator& operator=(pinned_allocator&& that) = default; template XGBOOST_DEVICE inline pinned_allocator(pinned_allocator const&) {} // NOLINT