Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions
xgboost::common::ParallelGroupBuilder< ValueType, SizeType, is_row_major > Class Template Reference

multi-thread version of group builder More...

#include <group_data.h>

Public Member Functions

 ParallelGroupBuilder (std::vector< SizeType > *p_rptr, std::vector< ValueType > *p_data, size_t base_row_offset=0)
 parallel group builder of data.
 
void InitBudget (std::size_t max_key, int nthread)
 step 1: initialize the helper, with hint of number keys and thread used in the construction
 
void AddBudget (std::size_t key, int threadid, SizeType nelem=1)
 step 2: add budget to each key
 
void InitStorage ()
 step 3: initialize the necessary storage
 
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
 

Detailed Description

template<typename ValueType, typename SizeType = bst_ulong, bool is_row_major = false>
class xgboost::common::ParallelGroupBuilder< ValueType, SizeType, is_row_major >

multi-thread version of group builder

Template Parameters
ValueTypetype of entries in the sparse matrix
SizeTypetype of the index range holder
is_row_majorbool value helps to reduce memory for row major

Constructor & Destructor Documentation

◆ ParallelGroupBuilder()

template<typename ValueType , typename SizeType = bst_ulong, bool is_row_major = false>
xgboost::common::ParallelGroupBuilder< ValueType, SizeType, is_row_major >::ParallelGroupBuilder ( std::vector< SizeType > *  p_rptr,
std::vector< ValueType > *  p_data,
size_t  base_row_offset = 0 
)
inline

parallel group builder of data.

Parameters
[in,out]p_rptrRow offsets for CSR matrix.
[in,out]p_dataData vector to populate
base_row_offset(Optional) If the matrix we are building is already partially populated, use this to indicate the row index we are starting from. This saves considerable amounts of time/memory when incrementaly building.

Member Function Documentation

◆ AddBudget()

template<typename ValueType , typename SizeType = bst_ulong, bool is_row_major = false>
void xgboost::common::ParallelGroupBuilder< ValueType, SizeType, is_row_major >::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 = bst_ulong, bool is_row_major = false>
void xgboost::common::ParallelGroupBuilder< ValueType, SizeType, is_row_major >::InitBudget ( std::size_t  max_key,
int  nthread 
)
inline

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

Parameters
max_keynumber of keys in the matrix, can be smaller than expected, for row major adapter max_key is equal to batch size
nthreadnumber of thread that will be used in construction

◆ Push()

template<typename ValueType , typename SizeType = bst_ulong, bool is_row_major = false>
void xgboost::common::ParallelGroupBuilder< ValueType, SizeType, is_row_major >::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 class was generated from the following file: