Add basic unittests for gpu-hist method. (#3785)
* Split building histogram into separated class. * Extract `InitCompressedRow` definition. * Basic tests for gpu-hist. * Document the code more verbosely. * Removed `HistCutUnit`. * Removed some duplicated copies in `GPUHistMaker`. * Implement LCG and use it in tests.
This commit is contained in:
committed by
Rory Mitchell
parent
184efff9f9
commit
516457fadc
@@ -204,7 +204,7 @@ inline void LaunchN(int device_idx, size_t n, L lambda) {
|
||||
const int GRID_SIZE =
|
||||
static_cast<int>(DivRoundUp(n, ITEMS_PER_THREAD * BLOCK_THREADS));
|
||||
LaunchNKernel<<<GRID_SIZE, BLOCK_THREADS>>>(static_cast<size_t>(0), n,
|
||||
lambda);
|
||||
lambda);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -365,6 +365,7 @@ class DVec2 {
|
||||
T *other() { return buff_.Alternate(); }
|
||||
};
|
||||
|
||||
/*! \brief Helper for allocating large block of memory. */
|
||||
template <MemoryType MemoryT>
|
||||
class BulkAllocator {
|
||||
std::vector<char *> d_ptr_;
|
||||
|
||||
@@ -53,34 +53,15 @@ struct GHistEntry {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*! \brief Cut configuration for one feature */
|
||||
struct HistCutUnit {
|
||||
/*! \brief the index pointer of each histunit */
|
||||
const bst_float* cut;
|
||||
/*! \brief number of cutting point, containing the maximum point */
|
||||
uint32_t size;
|
||||
// default constructor
|
||||
HistCutUnit() = default;
|
||||
// constructor
|
||||
HistCutUnit(const bst_float* cut, uint32_t size)
|
||||
: cut(cut), size(size) {}
|
||||
};
|
||||
|
||||
/*! \brief cut configuration for all the features. */
|
||||
/*! \brief Cut configuration for all the features. */
|
||||
struct HistCutMatrix {
|
||||
/*! \brief unit pointer to rows by element position */
|
||||
/*! \brief Unit pointer to rows by element position */
|
||||
std::vector<uint32_t> row_ptr;
|
||||
/*! \brief minimum value of each feature */
|
||||
std::vector<bst_float> min_val;
|
||||
/*! \brief the cut field */
|
||||
std::vector<bst_float> cut;
|
||||
uint32_t GetBinIdx(const Entry &e);
|
||||
/*! \brief Get histogram bound for fid */
|
||||
inline HistCutUnit operator[](bst_uint fid) const {
|
||||
return {dmlc::BeginPtr(cut) + row_ptr[fid],
|
||||
row_ptr[fid + 1] - row_ptr[fid]};
|
||||
}
|
||||
|
||||
using WXQSketch = common::WXQuantileSketch<bst_float, bst_float>;
|
||||
|
||||
@@ -189,7 +170,7 @@ class GHistIndexBlockMatrix {
|
||||
|
||||
/*!
|
||||
* \brief histogram of graident statistics for a single node.
|
||||
* Consists of multiple GHistEntry's, each entry showing total graident statistics
|
||||
* Consists of multiple GHistEntry's, each entry showing total graident statistics
|
||||
* for that particular bin
|
||||
* Uses global bin id so as to represent all features simultaneously
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user