Minor refactor of split evaluation in gpu_hist (#3889)

* Refactor evaluate split into shard

* Use span in evaluate split

* Update google tests
This commit is contained in:
Rory Mitchell
2018-11-14 00:11:20 +13:00
committed by GitHub
parent daf77ca7b7
commit 926eb651fe
3 changed files with 129 additions and 193 deletions

View File

@@ -257,6 +257,14 @@ class DVec {
const T *Data() const { return ptr_; }
xgboost::common::Span<const T> GetSpan() const {
return xgboost::common::Span<const T>(ptr_, this->Size());
}
xgboost::common::Span<T> GetSpan() {
return xgboost::common::Span<T>(ptr_, this->Size());
}
std::vector<T> AsVector() const {
std::vector<T> h_vector(Size());
safe_cuda(cudaSetDevice(device_idx_));
@@ -497,8 +505,9 @@ struct CubMemory {
~CubMemory() { Free(); }
template <typename T>
T *Pointer() {
return static_cast<T *>(d_temp_storage);
xgboost::common::Span<T> GetSpan(size_t size) {
this->LazyAllocate(size * sizeof(T));
return xgboost::common::Span<T>(static_cast<T*>(d_temp_storage), size);
}
void Free() {