Skip to content

Commit

Permalink
Fix rebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Jan 25, 2022
1 parent 68ba3fd commit 71af21f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/data/gradient_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ namespace xgboost {
GHistIndexMatrix::GHistIndexMatrix() : columns_{std::make_unique<common::ColumnMatrix>()} {}

GHistIndexMatrix::GHistIndexMatrix(DMatrix *x, int32_t max_bin, double sparse_thresh,
bool sorted_sketch, common::Span<float> hess) {
this->Init(x, max_bin, sparse_thresh, sorted_sketch, hess);
bool sorted_sketch, int32_t n_threads,
common::Span<float> hess) {
this->Init(x, max_bin, sparse_thresh, sorted_sketch, n_threads, hess);
}

GHistIndexMatrix::~GHistIndexMatrix() = default;
Expand All @@ -27,8 +28,7 @@ void GHistIndexMatrix::PushBatch(SparsePage const &batch,
// block is parallelized on anything other than the batch/block size,
// it should be reassigned
const size_t batch_threads =
std::max(size_t(1), std::min(batch.Size(),
static_cast<size_t>(n_threads)));
std::max(static_cast<size_t>(1), std::min(batch.Size(), static_cast<size_t>(n_threads)));
auto page = batch.GetView();
common::MemStackAllocator<size_t, 128> partial_sums(batch_threads);
size_t *p_part = partial_sums.Get();
Expand Down
6 changes: 3 additions & 3 deletions src/data/gradient_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class GHistIndexMatrix {

GHistIndexMatrix();
GHistIndexMatrix(DMatrix* x, int32_t max_bin, double sparse_thresh, bool sorted_sketch,
int32_t n_threads, common::Span<float> hess = {}) {
this->Init(x, max_bin, sparse_thresh, sorted_sketch, n_threads, hess);
}
int32_t n_threads, common::Span<float> hess = {});
~GHistIndexMatrix();

// Create a global histogram matrix, given cut
void Init(DMatrix* p_fmat, int max_bins, double sparse_thresh, bool sorted_sketch,
int32_t n_threads, common::Span<float> hess);
Expand Down
3 changes: 2 additions & 1 deletion tests/cpp/tree/hist/test_histogram.cc
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ TEST(CPUHistogram, ExternalMemory) {
SparsePage concat;
GHistIndexMatrix gmat;
std::vector<float> hess(m->Info().num_row_, 1.0f);
gmat.Init(m.get(), kBins, std::numeric_limits<double>::quiet_NaN(), false, hess);
gmat.Init(m.get(), kBins, std::numeric_limits<double>::quiet_NaN(), false,
common::OmpGetNumThreads(0), hess);
single_build.BuildHist(0, gmat, &tree, row_set_collection, nodes, {}, h_gpair);
single_page = single_build.Histogram()[0];
}
Expand Down

0 comments on commit 71af21f

Please sign in to comment.