Prevent copying SimpleDMatrix. (#5453)
* Set default dtor for SimpleDMatrix to initialize default copy ctor, which is deleted due to unique ptr. * Remove commented code. * Remove warning for calling host function (std::max). * Remove warning for initialization order. * Remove warning for unused variables.
This commit is contained in:
@@ -64,6 +64,11 @@ inline std::vector<std::string> Split(const std::string& s, char delim) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
XGBOOST_DEVICE T Max(T a, T b) {
|
||||
return a < b ? b : a;
|
||||
}
|
||||
|
||||
// simple routine to convert any data to string
|
||||
template<typename T>
|
||||
inline std::string ToString(const T& data) {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <cstddef>
|
||||
#include <algorithm>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __CUDACC__
|
||||
#include "device_helpers.cuh"
|
||||
#endif // __CUDACC__
|
||||
@@ -29,12 +31,12 @@ inline void ClearBit(CompressedByteT *byte, int bit_idx) {
|
||||
*byte &= ~(1 << bit_idx);
|
||||
}
|
||||
static const int kPadding = 4; // Assign padding so we can read slightly off
|
||||
// the beginning of the array
|
||||
// the beginning of the array
|
||||
|
||||
// The number of bits required to represent a given unsigned range
|
||||
inline XGBOOST_DEVICE size_t SymbolBits(size_t num_symbols) {
|
||||
auto bits = std::ceil(log2(static_cast<double>(num_symbols)));
|
||||
return std::max(static_cast<size_t>(bits), size_t(1));
|
||||
return common::Max(static_cast<size_t>(bits), size_t(1));
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
|
||||
@@ -297,9 +297,9 @@ struct Index {
|
||||
std::vector<uint8_t> data_;
|
||||
std::vector<uint32_t> offset_; // size of this field is equal to number of features
|
||||
void* data_ptr_;
|
||||
uint32_t* offset_ptr_;
|
||||
size_t p_;
|
||||
BinTypeSize binTypeSize_;
|
||||
size_t p_;
|
||||
uint32_t* offset_ptr_;
|
||||
Func func_;
|
||||
};
|
||||
|
||||
|
||||
@@ -710,7 +710,7 @@ class QuantileSketchTemplate {
|
||||
// check invariant
|
||||
size_t n = (1ULL << nlevel);
|
||||
CHECK(n * limit_size >= maxn) << "invalid init parameter";
|
||||
CHECK(nlevel <= std::max(1, static_cast<int>(limit_size * eps)))
|
||||
CHECK(nlevel <= std::max(static_cast<size_t>(1), static_cast<size_t>(limit_size * eps)))
|
||||
<< "invalid init parameter";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user