Skip to content

Commit

Permalink
cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Sep 18, 2024
1 parent 451610f commit 3ee1bbb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/data/ellpack_page.cu
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ EllpackPageImpl::EllpackPageImpl(Context const* ctx, DMatrix* p_fmat, const Batc
auto ft = p_fmat->Info().feature_types.ConstDeviceSpan();
monitor_.Start("BinningCompression");
CHECK(p_fmat->SingleColBlock());
for (const auto& batch : p_fmat->GetBatches<SparsePage>()) {
CreateHistIndices(ctx, batch, ft);
for (auto const& page : p_fmat->GetBatches<SparsePage>()) {
this->CreateHistIndices(ctx, page, ft);
}
monitor_.Stop("BinningCompression");
}
Expand Down
4 changes: 3 additions & 1 deletion src/data/sparse_page_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ class SparsePageSourceImpl : public BatchIteratorImpl<S>, public FormatStreamPol
std::size_t fetch_it = count_;

exce_.Rethrow();

// Clear out the existing page before loading new ones. This helps reduce memory usage
// when page is not loaded with mmap, in addition, it triggers necessary CUDA
// synchronizations by freeing memory.
page_.reset();

for (std::int32_t i = 0; i < n_prefetch_batches; ++i, ++fetch_it) {
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/data/test_ellpack_page.cu
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ class EllpackPageTest : public testing::TestWithParam<float> {
ASSERT_EQ(from_sparse_page->base_rowid, from_ghist->base_rowid);
ASSERT_EQ(from_sparse_page->n_rows, from_ghist->n_rows);
ASSERT_EQ(from_sparse_page->gidx_buffer.size(), from_ghist->gidx_buffer.size());
ASSERT_EQ(from_sparse_page->NumSymbols(), from_ghist->NumSymbols());
std::vector<common::CompressedByteT> h_gidx_from_sparse, h_gidx_from_ghist;
auto from_ghist_acc = from_ghist->GetHostAccessor(&gpu_ctx, &h_gidx_from_ghist);
auto from_sparse_acc = from_sparse_page->GetHostAccessor(&gpu_ctx, &h_gidx_from_sparse);
ASSERT_EQ(from_sparse_page->NumSymbols(), from_ghist->NumSymbols());
for (size_t i = 0; i < from_ghist->n_rows * from_ghist->row_stride; ++i) {
EXPECT_EQ(from_ghist_acc.gidx_iter[i], from_sparse_acc.gidx_iter[i]);
}
Expand Down

0 comments on commit 3ee1bbb

Please sign in to comment.