xgboost
Public Member Functions | List of all members
xgboost::common::ParallelGroupBuilder< ValueType, SizeType > Struct Template Reference

multi-thread version of group builder More...

#include <group_data.h>

Collaboration diagram for xgboost::common::ParallelGroupBuilder< ValueType, SizeType >:
Collaboration graph

Public Member Functions

 ParallelGroupBuilder (std::vector< SizeType > *p_rptr, std::vector< ValueType > *p_data)
 
 ParallelGroupBuilder (std::vector< SizeType > *p_rptr, std::vector< ValueType > *p_data, std::vector< std::vector< SizeType > > *p_thread_rptr)
 
void InitBudget (std::size_t nkeys, int nthread)
 step 1: initialize the helper, with hint of number keys and thread used in the construction More...
 
void AddBudget (std::size_t key, int threadid, SizeType nelem=1)
 step 2: add budget to each key More...
 
void InitStorage ()
 step 3: initialize the necessary storage More...
 
void Push (std::size_t key, ValueType value, int threadid)
 step 4: add data to the allocated space, the calls to this function should be exactly match previous call to AddBudget More...
 

Detailed Description

template<typename ValueType, typename SizeType = std::size_t>
struct xgboost::common::ParallelGroupBuilder< ValueType, SizeType >

multi-thread version of group builder

Template Parameters
ValueTypetype of entries in the sparse matrix
SizeTypetype of the index range holder

Constructor & Destructor Documentation

◆ ParallelGroupBuilder() [1/2]

template<typename ValueType, typename SizeType = std::size_t>
xgboost::common::ParallelGroupBuilder< ValueType, SizeType >::ParallelGroupBuilder ( std::vector< SizeType > *  p_rptr,
std::vector< ValueType > *  p_data 
)
inline

◆ ParallelGroupBuilder() [2/2]

template<typename ValueType, typename SizeType = std::size_t>
xgboost::common::ParallelGroupBuilder< ValueType, SizeType >::ParallelGroupBuilder ( std::vector< SizeType > *  p_rptr,
std::vector< ValueType > *  p_data,
std::vector< std::vector< SizeType > > *  p_thread_rptr 
)
inline

Member Function Documentation

◆ AddBudget()

template<typename ValueType, typename SizeType = std::size_t>
void xgboost::common::ParallelGroupBuilder< ValueType, SizeType >::AddBudget ( std::size_t  key,
int  threadid,
SizeType  nelem = 1 
)
inline

step 2: add budget to each key

Parameters
keythe key
threadidthe id of thread that calls this function
nelemnumber of element budget add to this row

◆ InitBudget()

template<typename ValueType, typename SizeType = std::size_t>
void xgboost::common::ParallelGroupBuilder< ValueType, SizeType >::InitBudget ( std::size_t  nkeys,
int  nthread 
)
inline

step 1: initialize the helper, with hint of number keys and thread used in the construction

Parameters
nkeysnumber of keys in the matrix, can be smaller than expected
nthreadnumber of thread that will be used in construction

◆ InitStorage()

template<typename ValueType, typename SizeType = std::size_t>
void xgboost::common::ParallelGroupBuilder< ValueType, SizeType >::InitStorage ( )
inline

step 3: initialize the necessary storage

◆ Push()

template<typename ValueType, typename SizeType = std::size_t>
void xgboost::common::ParallelGroupBuilder< ValueType, SizeType >::Push ( std::size_t  key,
ValueType  value,
int  threadid 
)
inline

step 4: add data to the allocated space, the calls to this function should be exactly match previous call to AddBudget

Parameters
keythe key of group.
valueThe value to be pushed to the group.
threadidthe id of thread that calls this function

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