Initial support for external memory in gradient index. (#7183)
* Add hessian to batch param in preparation of new approx impl. * Extract a push method for gradient index matrix. * Use span instead of vector ref for hessian in sketching. * Create a binary format for gradient index.
This commit is contained in:
@@ -111,7 +111,7 @@ class HistogramCuts {
|
||||
};
|
||||
|
||||
inline HistogramCuts SketchOnDMatrix(DMatrix *m, int32_t max_bins,
|
||||
std::vector<float> const &hessian = {}) {
|
||||
Span<float> const hessian = {}) {
|
||||
HistogramCuts out;
|
||||
auto const& info = m->Info();
|
||||
const auto threads = omp_get_max_threads();
|
||||
@@ -136,7 +136,7 @@ inline HistogramCuts SketchOnDMatrix(DMatrix *m, int32_t max_bins,
|
||||
return out;
|
||||
}
|
||||
|
||||
enum BinTypeSize {
|
||||
enum BinTypeSize : uint32_t {
|
||||
kUint8BinsTypeSize = 1,
|
||||
kUint16BinsTypeSize = 2,
|
||||
kUint32BinsTypeSize = 4
|
||||
@@ -207,6 +207,13 @@ struct Index {
|
||||
return data_.end();
|
||||
}
|
||||
|
||||
std::vector<uint8_t>::iterator begin() { // NOLINT
|
||||
return data_.begin();
|
||||
}
|
||||
std::vector<uint8_t>::iterator end() { // NOLINT
|
||||
return data_.end();
|
||||
}
|
||||
|
||||
private:
|
||||
static uint32_t GetValueFromUint8(void *t, size_t i) {
|
||||
return reinterpret_cast<uint8_t*>(t)[i];
|
||||
|
||||
Reference in New Issue
Block a user