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 1158014 commit 8320640
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
9 changes: 6 additions & 3 deletions src/data/ellpack_page.cu
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ EllpackPageImpl::EllpackPageImpl(Context const* ctx, GHistIndexMatrix const& pag
this->monitor_.Stop("CopyGHistToEllpack");
}

EllpackPageImpl::~EllpackPageImpl() noexcept(false) { dh::DefaultStream().Sync(); }
EllpackPageImpl::~EllpackPageImpl() noexcept(false) {
// Sync the stream to make sure all running CUDA kernels finish before deallocation.
dh::DefaultStream().Sync();
}

// A functor that copies the data from one EllpackPage to another.
struct CopyPage {
Expand All @@ -420,15 +423,15 @@ struct CopyPage {
: cbw{dst->NumSymbols()},
dst_data_d{dst->gidx_buffer.data()},
src_iterator_d{src->gidx_buffer.data(), src->NumSymbols()},
offset(offset) {}
offset{offset} {}

__device__ void operator()(size_t element_id) {
cbw.AtomicWriteSymbol(dst_data_d, src_iterator_d[element_id], element_id + offset);
}
};

// Copy the data from the given EllpackPage to the current page.
size_t EllpackPageImpl::Copy(Context const* ctx, EllpackPageImpl const* page, bst_idx_t offset) {
bst_idx_t EllpackPageImpl::Copy(Context const* ctx, EllpackPageImpl const* page, bst_idx_t offset) {
monitor_.Start(__func__);
bst_idx_t num_elements = page->n_rows * page->row_stride;
CHECK_EQ(this->row_stride, page->row_stride);
Expand Down
8 changes: 0 additions & 8 deletions src/data/extmem_quantile_dmatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ ExtMemQuantileDMatrix::~ExtMemQuantileDMatrix() {
DeleteCacheFiles(cache_info_);
}

[[nodiscard]] bst_idx_t ExtMemQuantileDMatrix::EllpackPageFetchCount() const {
return std::visit([](auto &&ptr) { return ptr->FetchCount(); }, this->ellpack_page_source_);
}

[[nodiscard]] bst_idx_t ExtMemQuantileDMatrix::GradientIndexFetchCount() const {
return this->ghist_index_source_->FetchCount();
}

BatchSet<ExtSparsePage> ExtMemQuantileDMatrix::GetExtBatches(Context const *, BatchParam const &) {
LOG(FATAL) << "Not implemented";
auto begin_iter =
Expand Down
4 changes: 0 additions & 4 deletions src/data/extmem_quantile_dmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ class ExtMemQuantileDMatrix : public QuantileDMatrix {

[[nodiscard]] std::int32_t NumBatches() const override { return n_batches_; }

// For testing, getter for the number of fetches.
[[nodiscard]] bst_idx_t EllpackPageFetchCount() const;
[[nodiscard]] bst_idx_t GradientIndexFetchCount() const;

private:
void InitFromCPU(
Context const *ctx,
Expand Down

0 comments on commit 8320640

Please sign in to comment.