This PR replaces the original RABIT implementation with a new one, which has already been partially merged into XGBoost. The new one features: - Federated learning for both CPU and GPU. - NCCL. - More data types. - A unified interface for all the underlying implementations. - Improved timeout handling for both tracker and workers. - Exhausted tests with metrics (fixed a couple of bugs along the way). - A reusable tracker for Python and JVM packages.
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
/**
|
|
* Copyright 2020-2024, XGBoost Contributors
|
|
*/
|
|
#ifndef XGBOOST_TESTS_CPP_COMMON_TEST_QUANTILE_H_
|
|
#define XGBOOST_TESTS_CPP_COMMON_TEST_QUANTILE_H_
|
|
|
|
#include <algorithm>
|
|
#include <vector>
|
|
|
|
#include "../helpers.h"
|
|
|
|
namespace xgboost::common {
|
|
template <typename Fn> void RunWithSeedsAndBins(size_t rows, Fn fn) {
|
|
std::vector<int32_t> seeds(2);
|
|
SimpleLCG lcg;
|
|
SimpleRealUniformDistribution<float> dist(3, 1000);
|
|
std::generate(seeds.begin(), seeds.end(), [&](){ return dist(&lcg); });
|
|
|
|
std::vector<bst_bin_t> bins(2);
|
|
for (size_t i = 0; i < bins.size() - 1; ++i) {
|
|
bins[i] = i * 35 + 2;
|
|
}
|
|
bins.back() = rows + 160; // provide a bin number greater than rows.
|
|
|
|
std::vector<MetaInfo> infos(2);
|
|
auto& h_weights = infos.front().weights_.HostVector();
|
|
h_weights.resize(rows);
|
|
|
|
SimpleRealUniformDistribution<float> weight_dist(0, 10);
|
|
std::generate(h_weights.begin(), h_weights.end(), [&]() { return weight_dist(&lcg); });
|
|
|
|
for (auto seed : seeds) {
|
|
for (auto n_bin : bins) {
|
|
for (auto const& info : infos) {
|
|
fn(seed, n_bin, info);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} // namespace xgboost::common
|
|
|
|
#endif // XGBOOST_TESTS_CPP_COMMON_TEST_QUANTILE_H_
|