Refactor DMatrix to return batches of different page types (#4686)
* Use explicit template parameter for specifying page type.
This commit is contained in:
@@ -58,7 +58,7 @@ void TestDeviceSketch(const GPUSet& devices, bool use_external_memory) {
|
||||
|
||||
// compare the row stride with the one obtained from the dmatrix
|
||||
size_t expected_row_stride = 0;
|
||||
for (const auto &batch : dmat->get()->GetRowBatches()) {
|
||||
for (const auto &batch : dmat->get()->GetBatches<xgboost::SparsePage>()) {
|
||||
const auto &offset_vec = batch.offset.ConstHostVector();
|
||||
for (int i = 1; i <= offset_vec.size() -1; ++i) {
|
||||
expected_row_stride = std::max(expected_row_stride, offset_vec[i] - offset_vec[i-1]);
|
||||
|
||||
@@ -61,7 +61,7 @@ TEST(SparseCuts, SingleThreadedBuild) {
|
||||
|
||||
HistogramCuts cuts;
|
||||
SparseCuts indices(&cuts);
|
||||
auto const& page = *(p_fmat->GetColumnBatches().begin());
|
||||
auto const& page = *(p_fmat->GetBatches<xgboost::CSCPage>().begin());
|
||||
indices.SingleThreadBuild(page, p_fmat->Info(), kBins, false, 0, page.Size(), 0);
|
||||
|
||||
ASSERT_EQ(hmat.cut.Ptrs().size(), cuts.Ptrs().size());
|
||||
@@ -92,7 +92,7 @@ TEST(SparseCuts, MultiThreadedBuild) {
|
||||
|
||||
HistogramCuts container;
|
||||
SparseCuts indices(&container);
|
||||
auto const& page = *(p_fmat->GetColumnBatches().begin());
|
||||
auto const& page = *(p_fmat->GetBatches<xgboost::CSCPage>().begin());
|
||||
indices.SingleThreadBuild(page, p_fmat->Info(), kBins, false, 0, page.Size(), 0);
|
||||
|
||||
ASSERT_EQ(container.Ptrs().size(), threaded_container.Ptrs().size());
|
||||
|
||||
Reference in New Issue
Block a user