Skip to content

Commit 1a1786f

Browse files
authored
[EM] Retry if quantile merge failed. (#11641)
1 parent 6c1b499 commit 1a1786f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/common/quantile.cu

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,16 @@ void SketchContainer::Merge(Context const *ctx, Span<OffsetT const> d_that_colum
464464
return;
465465
}
466466

467-
this->Other().resize(this->Current().size() + that.size());
467+
std::size_t new_size = this->Current().size() + that.size();
468+
try {
469+
this->Other().resize(new_size);
470+
} catch (dmlc::Error const &) {
471+
// Retry
472+
this->Other().clear();
473+
this->Other().shrink_to_fit();
474+
this->Other().resize(new_size);
475+
}
476+
468477
CHECK_EQ(d_that_columns_ptr.size(), this->columns_ptr_.Size());
469478

470479
MergeImpl(ctx, this->Data(), this->ColumnsPtr(), that, d_that_columns_ptr,

src/data/quantile_dmatrix.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void MakeSketches(Context const* ctx,
7373
/**
7474
* Get the data shape.
7575
*/
76-
// We use do while here as the first batch is fetched in ctor
76+
// We use do while here as the first batch has been fetched in the ctor
7777
CHECK_LT(ctx->Ordinal(), curt::AllVisibleGPUs());
7878
auto device = dh::GetDevice(ctx);
7979
curt::SetDevice(device.ordinal);

0 commit comments

Comments
 (0)