Dmatrix refactor stage 2 (#3395)

* DMatrix refactor 2

* Remove buffered rowset usage where possible

* Transition to c++11 style iterators for row access

* Transition column iterators to C++ 11
This commit is contained in:
Rory Mitchell
2018-10-01 01:29:03 +13:00
committed by GitHub
parent b50bc2c1d4
commit 70d208d68c
36 changed files with 459 additions and 846 deletions

View File

@@ -53,10 +53,7 @@ class CPUPredictor : public Predictor {
<< "size_leaf_vector is enforced to 0 so far";
CHECK_EQ(preds.size(), p_fmat->Info().num_row_ * num_group);
// start collecting the prediction
auto iter = p_fmat->RowIterator();
iter->BeforeFirst();
while (iter->Next()) {
const auto& batch = iter->Value();
for (const auto &batch : p_fmat->GetRowBatches()) {
// parallel over local batch
constexpr int kUnroll = 8;
const auto nsize = static_cast<bst_omp_uint>(batch.Size());
@@ -233,10 +230,7 @@ class CPUPredictor : public Predictor {
std::vector<bst_float>& preds = *out_preds;
preds.resize(info.num_row_ * ntree_limit);
// start collecting the prediction
auto iter = p_fmat->RowIterator();
iter->BeforeFirst();
while (iter->Next()) {
auto &batch = iter->Value();
for (const auto &batch : p_fmat->GetRowBatches()) {
// parallel over local batch
const auto nsize = static_cast<bst_omp_uint>(batch.Size());
#pragma omp parallel for schedule(static)
@@ -280,12 +274,9 @@ class CPUPredictor : public Predictor {
for (bst_omp_uint i = 0; i < ntree_limit; ++i) {
model.trees[i]->FillNodeMeanValues();
}
const std::vector<bst_float>& base_margin = info.base_margin_.HostVector();
// start collecting the contributions
auto iter = p_fmat->RowIterator();
const auto& base_margin = info.base_margin_.HostVector();
iter->BeforeFirst();
while (iter->Next()) {
auto &batch = iter->Value();
for (const auto &batch : p_fmat->GetRowBatches()) {
// parallel over local batch
const auto nsize = static_cast<bst_omp_uint>(batch.Size());
#pragma omp parallel for schedule(static)