1 /*!
2  * Copyright 2019-2021 XGBoost contributors
3  */
4 #include <memory>
5 #include <utility>
6 
7 #include "ellpack_page.cuh"
8 #include "ellpack_page_source.h"
9 
10 namespace xgboost {
11 namespace data {
Fetch()12 void EllpackPageSource::Fetch() {
13   dh::safe_cuda(cudaSetDevice(param_.gpu_id));
14   if (!this->ReadCache()) {
15     auto const &csr = source_->Page();
16     this->page_.reset(new EllpackPage{});
17     auto *impl = this->page_->Impl();
18     *impl = EllpackPageImpl(param_.gpu_id, *cuts_, *csr, is_dense_, row_stride_,
19                             feature_types_);
20     page_->SetBaseRowId(csr->base_rowid);
21     this->WriteCache();
22   }
23 }
24 }  // namespace data
25 }  // namespace xgboost
26