* add ellpack source * add batch param * extract function to parse cache info * construct ellpack info separately * push batch to ellpack page * write ellpack page. * make sparse page source reusable
27 lines
768 B
Plaintext
27 lines
768 B
Plaintext
// Copyright by Contributors
|
|
|
|
#include <dmlc/filesystem.h>
|
|
#include "../helpers.h"
|
|
|
|
namespace xgboost {
|
|
|
|
TEST(GPUSparsePageDMatrix, EllpackPage) {
|
|
dmlc::TemporaryDirectory tempdir;
|
|
const std::string tmp_file = tempdir.path + "/simple.libsvm";
|
|
CreateSimpleTestData(tmp_file);
|
|
DMatrix* dmat = DMatrix::Load(tmp_file + "#" + tmp_file + ".cache", true, false);
|
|
|
|
// Loop over the batches and assert the data is as expected
|
|
for (const auto& batch : dmat->GetBatches<EllpackPage>({0, 256, 64})) {
|
|
EXPECT_EQ(batch.Size(), dmat->Info().num_row_);
|
|
}
|
|
|
|
EXPECT_TRUE(FileExists(tmp_file + ".cache"));
|
|
EXPECT_TRUE(FileExists(tmp_file + ".cache.row.page"));
|
|
EXPECT_TRUE(FileExists(tmp_file + ".cache.ellpack.page"));
|
|
|
|
delete dmat;
|
|
}
|
|
|
|
} // namespace xgboost
|