half ram support
This commit is contained in:
parent
5ad1555daf
commit
dfec406afd
@ -67,9 +67,15 @@ DataMatrix* LoadDataMatrix(const char *fname,
|
|||||||
fs.Close();
|
fs.Close();
|
||||||
return dmat;
|
return dmat;
|
||||||
} else {
|
} else {
|
||||||
DMatrixPage *dmat = new DMatrixPage();
|
if (fname[0] == '!') {
|
||||||
dmat->LoadText(fname, cache_file, false, loadsplit);
|
DMatrixHalfRAM *dmat = new DMatrixHalfRAM();
|
||||||
return dmat;
|
dmat->LoadText(fname + 1, cache_file, false, loadsplit);
|
||||||
|
return dmat;
|
||||||
|
} else {
|
||||||
|
DMatrixPage *dmat = new DMatrixPage();
|
||||||
|
dmat->LoadText(fname, cache_file, false, loadsplit);
|
||||||
|
return dmat;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -224,6 +224,25 @@ class DMatrixPage : public DMatrixPageBase<0xffffab02> {
|
|||||||
/*! \brief the real fmatrix */
|
/*! \brief the real fmatrix */
|
||||||
FMatrixPage *fmat_;
|
FMatrixPage *fmat_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// mix of FMatrix S and DMatrix
|
||||||
|
// cost half of ram usually as DMatrixSimple
|
||||||
|
class DMatrixHalfRAM : public DMatrixPageBase<0xffffab03> {
|
||||||
|
public:
|
||||||
|
DMatrixHalfRAM(void) {
|
||||||
|
fmat_ = new FMatrixS(iter_);
|
||||||
|
}
|
||||||
|
virtual ~DMatrixHalfRAM(void) {
|
||||||
|
delete fmat_;
|
||||||
|
}
|
||||||
|
virtual IFMatrix *fmat(void) const {
|
||||||
|
return fmat_;
|
||||||
|
}
|
||||||
|
virtual void set_cache_file(const std::string &cache_file) {
|
||||||
|
}
|
||||||
|
/*! \brief the real fmatrix */
|
||||||
|
IFMatrix *fmat_;
|
||||||
|
};
|
||||||
} // namespace io
|
} // namespace io
|
||||||
} // namespace xgboost
|
} // namespace xgboost
|
||||||
#endif // XGBOOST_IO_PAGE_ROW_ITER_INL_HPP_
|
#endif // XGBOOST_IO_PAGE_ROW_ITER_INL_HPP_
|
||||||
|
|||||||
@ -260,9 +260,9 @@ class BoostLearner : public rabit::Serializable {
|
|||||||
std::vector<bool> enabled(ncol, true);
|
std::vector<bool> enabled(ncol, true);
|
||||||
// initialize column access
|
// initialize column access
|
||||||
p_train->fmat()->InitColAccess(enabled, prob_buffer_row);
|
p_train->fmat()->InitColAccess(enabled, prob_buffer_row);
|
||||||
const int kMagicSimple = 0xffffab01;
|
const int kMagicPage = 0xffffab02;
|
||||||
// check, if it is not DMatrix simple, then use hist maker
|
// check, if it is DMatrixPage, then use hist maker
|
||||||
if (p_train->magic != kMagicSimple) {
|
if (p_train->magic == kMagicPage) {
|
||||||
this->SetParam("updater", "grow_histmaker,prune");
|
this->SetParam("updater", "grow_histmaker,prune");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user