xgboost

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
xgboost::common::ParallelGHistBuilder< GradientSumT > Class Template Reference

Stores temporary histograms to compute them in parallel Supports processing multiple tree-nodes for nested parallelism Able to reduce histograms across threads in efficient way. More...

`#include <hist_util.h>`

Collaboration diagram for xgboost::common::ParallelGHistBuilder< GradientSumT >:

## Public Types
using | GHistRowT = GHistRow< GradientSumT >

## Public Member Functions
void | Init (size_t nbins)
void | Reset (size_t nthreads, size_t nodes, const BlockedSpace2d &space, const std::vector< GHistRowT > &targeted_hists)
GHistRowT | GetInitializedHist (size_t tid, size_t nid)
void | ReduceHist (size_t nid, size_t begin, size_t end)

## Protected Member Functions
void | MatchThreadsToNodes (const BlockedSpace2d &space)
void | AllocateAdditionalHistograms ()
void | MatchNodeNidPairToHist ()

## Protected Attributes
size_t | nbins_ = 0
| number of bins in each histogram More...
size_t | nthreads_ = 0
| number of threads for parallel computation More...
size_t | nodes_ = 0
| number of nodes which will be processed in parallel More...
HistCollection< GradientSumT > | hist_buffer_
| Buffer for additional histograms for Parallel processing More...
std::vector< int > | hist_was_used_
| Marks which hists were used, it means that they should be merged. Contains only {true or false} values but 'int' is used instead of 'bool', because std::vector<bool> isn't thread safe. More...
std::vector< bool > | threads_to_nids_map_
| Buffer for additional histograms for Parallel processing More...
std::vector< GHistRowT > | targeted_hists_
| Contains histograms for final results More...
std::map< std::pair< size_t, size_t >, int > | tid_nid_to_hist_
| map pair {tid, nid} to index of allocated histogram from hist_buffer_ and targeted_hists_, -1 is reserved for targeted_hists_ More...

## Detailed Description

### template<typename GradientSumT>
class xgboost::common::ParallelGHistBuilder< GradientSumT >

Stores temporary histograms to compute them in parallel Supports processing multiple tree-nodes for nested parallelism Able to reduce histograms across threads in efficient way.

## Member Typedef Documentation

## ◆ GHistRowT

template<typename GradientSumT >

using xgboost::common::ParallelGHistBuilder< GradientSumT >::GHistRowT = GHistRow<GradientSumT>

## Member Function Documentation

## ◆ AllocateAdditionalHistograms()

template<typename GradientSumT >

void xgboost::common::ParallelGHistBuilder< GradientSumT >::AllocateAdditionalHistograms | ( |  | ) |
| inline protected

## ◆ GetInitializedHist()

template<typename GradientSumT >

GHistRowT xgboost::common::ParallelGHistBuilder< GradientSumT >::GetInitializedHist | ( | size_t | tid,
|  | size_t | nid
| ) |  |
| inline

## ◆ Init()

template<typename GradientSumT >

void xgboost::common::ParallelGHistBuilder< GradientSumT >::Init | ( | size_t | nbins | ) |
| inline

## ◆ MatchNodeNidPairToHist()

template<typename GradientSumT >

void xgboost::common::ParallelGHistBuilder< GradientSumT >::MatchNodeNidPairToHist | ( |  | ) |
| inline protected

## ◆ MatchThreadsToNodes()

template<typename GradientSumT >

void xgboost::common::ParallelGHistBuilder< GradientSumT >::MatchThreadsToNodes | ( | const BlockedSpace2d & | space | ) |
| inline protected

## ◆ ReduceHist()

template<typename GradientSumT >

void xgboost::common::ParallelGHistBuilder< GradientSumT >::ReduceHist | ( | size_t | nid,
|  | size_t | begin,
|  | size_t | end
| ) |  |
| inline

## ◆ Reset()

template<typename GradientSumT >

void xgboost::common::ParallelGHistBuilder< GradientSumT >::Reset | ( | size_t | nthreads,
|  | size_t | nodes,
|  | const BlockedSpace2d & | space,
|  | const std::vector< GHistRowT > & | targeted_hists
| ) |  |
| inline

## Member Data Documentation

## ◆ hist_buffer_

template<typename GradientSumT >

HistCollection<GradientSumT> xgboost::common::ParallelGHistBuilder< GradientSumT >::hist_buffer_
| protected

Buffer for additional histograms for Parallel processing

## ◆ hist_was_used_

template<typename GradientSumT >

std::vector<int> xgboost::common::ParallelGHistBuilder< GradientSumT >::hist_was_used_
| protected

Marks which hists were used, it means that they should be merged. Contains only {true or false} values but 'int' is used instead of 'bool', because std::vector<bool> isn't thread safe.

## ◆ nbins_

template<typename GradientSumT >

size_t xgboost::common::ParallelGHistBuilder< GradientSumT >::nbins_ = 0
| protected

number of bins in each histogram

## ◆ nodes_

template<typename GradientSumT >

size_t xgboost::common::ParallelGHistBuilder< GradientSumT >::nodes_ = 0
| protected

number of nodes which will be processed in parallel

## ◆ nthreads_

template<typename GradientSumT >

size_t xgboost::common::ParallelGHistBuilder< GradientSumT >::nthreads_ = 0
| protected

number of threads for parallel computation

## ◆ targeted_hists_

template<typename GradientSumT >

std::vector<GHistRowT> xgboost::common::ParallelGHistBuilder< GradientSumT >::targeted_hists_
| protected

Contains histograms for final results

## ◆ threads_to_nids_map_

template<typename GradientSumT >

std::vector<bool> xgboost::common::ParallelGHistBuilder< GradientSumT >::threads_to_nids_map_
| protected

Buffer for additional histograms for Parallel processing

## ◆ tid_nid_to_hist_

template<typename GradientSumT >

std::map<std::pair<size_t, size_t>, int> xgboost::common::ParallelGHistBuilder< GradientSumT >::tid_nid_to_hist_
| protected

map pair {tid, nid} to index of allocated histogram from hist_buffer_ and targeted_hists_, -1 is reserved for targeted_hists_

The documentation for this class was generated from the following file:

- /home/runner/work/xgboost/xgboost/src/common/hist_util.h