fix device sketch with weights in external memory mode (#5870)
This commit is contained in:
parent
d0a29c3135
commit
06320729d4
@ -264,7 +264,6 @@ void ProcessWeightedBatch(int device, const SparsePage& page,
|
|||||||
d_temp_weights[idx] = weights[group];
|
d_temp_weights[idx] = weights[group];
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
CHECK_EQ(weights.size(), page.offset.Size() - 1);
|
|
||||||
dh::LaunchN(device, temp_weights.size(), [=] __device__(size_t idx) {
|
dh::LaunchN(device, temp_weights.size(), [=] __device__(size_t idx) {
|
||||||
size_t element_idx = idx + begin;
|
size_t element_idx = idx + begin;
|
||||||
size_t ridx = thrust::upper_bound(thrust::seq, row_ptrs.begin(),
|
size_t ridx = thrust::upper_bound(thrust::seq, row_ptrs.begin(),
|
||||||
|
|||||||
@ -209,6 +209,23 @@ TEST(HistUtil, DeviceSketchMultipleColumnsExternal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See https://github.com/dmlc/xgboost/issues/5866.
|
||||||
|
TEST(HistUtil, DeviceSketchExternalMemoryWithWeights) {
|
||||||
|
int bin_sizes[] = {2, 16, 256, 512};
|
||||||
|
int sizes[] = {100, 1000, 1500};
|
||||||
|
int num_columns = 5;
|
||||||
|
dmlc::TemporaryDirectory temp;
|
||||||
|
for (auto num_rows : sizes) {
|
||||||
|
auto x = GenerateRandom(num_rows, num_columns);
|
||||||
|
auto dmat = GetExternalMemoryDMatrixFromData(x, num_rows, num_columns, 100, temp);
|
||||||
|
dmat->Info().weights_.HostVector() = GenerateRandomWeights(num_rows);
|
||||||
|
for (auto num_bins : bin_sizes) {
|
||||||
|
auto cuts = DeviceSketch(0, dmat.get(), num_bins);
|
||||||
|
ValidateCuts(cuts, dmat.get(), num_bins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Adapter>
|
template <typename Adapter>
|
||||||
void ValidateBatchedCuts(Adapter adapter, int num_bins, int num_columns, int num_rows,
|
void ValidateBatchedCuts(Adapter adapter, int num_bins, int num_columns, int num_rows,
|
||||||
DMatrix* dmat) {
|
DMatrix* dmat) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user