Medial Code Documentation
|
A persistent cache for CPU histogram. More...
#include <hist_cache.h>
Public Member Functions | |
common::GHistRow | operator[] (std::size_t idx) |
common::ConstGHistRow | operator[] (std::size_t idx) const |
void | Reset (bst_bin_t n_total_bins, std::size_t n_cached_nodes) |
void | Clear (bool exceeded) |
Clear the cache, mark whether the cache is exceeded the limit. | |
bool | CanHost (common::Span< bst_node_t const > nodes_to_build, common::Span< bst_node_t const > nodes_to_sub) const |
void | AllocateHistograms (common::Span< bst_node_t const > nodes_to_build, common::Span< bst_node_t const > nodes_to_sub) |
Allocate histogram buffers for all nodes. | |
void | AllocateHistograms (std::vector< bst_node_t > const &nodes) |
bool | HasExceeded () const |
bool | HistogramExists (bst_node_t nidx) const |
std::size_t | Size () const |
A persistent cache for CPU histogram.
The size of the cache is first bounded by the Driver
class then by this cache implementaiton. The former limits the number of nodes that can be built for each node batch, while this cache limits the number of all nodes up to the size of max(|node_batch|, n_cached_node).
The caller is responsible for clearing up the cache as it needs to rearrange the nodes before making overflowed allocations. The strcut only reports whether the size limit has benn reached.
|
inline |
Allocate histogram buffers for all nodes.
The resulting histogram buffer is contiguous for all nodes in the order of allocation.