Skip to content

Commit

Permalink
[coll] Allow using local host for testing. (#10526)
Browse files Browse the repository at this point in the history
- Don't try to retrieve the IP address if a host is specified.
- Fix compiler deprecation warning.
  • Loading branch information
trivialfis authored Jul 2, 2024
1 parent a39fef2 commit d33043a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/collective/tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>(config, "host", std::string{});
if (host_.empty()) {
return collective::GetHostAddress(&host_);
}
return Success();
} << [&] {
host_ = OptionalArg<String>(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_);
Expand Down
2 changes: 2 additions & 0 deletions src/common/cuda_pinned_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename U>
XGBOOST_DEVICE inline pinned_allocator(pinned_allocator<U> const&) {} // NOLINT
Expand Down

0 comments on commit d33043a

Please sign in to comment.