16#include "communicator-inl.h"
35template <
typename Function>
43 std::forward<Function>(function)();
50 if (message.empty()) {
53 LOG(FATAL) << &message[0];
56 std::forward<Function>(function)();
74 collective::Allreduce<collective::Operation::kMax>(&value, 1);
93 collective::Allreduce<collective::Operation::kSum>(values, size);
97template <
typename Container>
99 GlobalSum(info, values->data(), values->size());
116 std::array<T, 2> results{dividend, divisor};
118 std::tie(dividend, divisor) = std::tuple_cat(results);
120 return std::numeric_limits<T>::quiet_NaN();
122 return dividend / divisor;
Copyright 2015-2023 by XGBoost Contributors.
void Broadcast(void *send_receive_buffer, size_t size, int root)
Broadcast a memory region to all others from root. This function is NOT thread-safe.
Definition communicator-inl.h:129
void GlobalSum(MetaInfo const &info, T *values, size_t size)
Find the global sum of the given values across all workers.
Definition aggregator.h:91
T GlobalRatio(MetaInfo const &info, T dividend, T divisor)
Find the global ratio of the given two values across all workers.
Definition aggregator.h:115
void ApplyWithLabels(MetaInfo const &info, void *buffer, size_t size, Function &&function)
Apply the given function where the labels are.
Definition aggregator.h:36
int GetRank()
Get rank of current process.
Definition communicator-inl.h:76
T GlobalMax(MetaInfo const &info, T value)
Find the global max of the given value across all workers.
Definition aggregator.h:72
namespace of xgboost
Definition base.h:90
exception class that will be thrown by default logger if DMLC_LOG_FATAL_THROW == 1
Definition logging.h:29