Skip to content

Commit 54dd6a7

Browse files
committed
Fix
1 parent 5fb7aeb commit 54dd6a7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/data/simple_dmatrix.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,12 @@ BatchSet<EllpackPage> SimpleDMatrix::GetEllpackBatches(Context const* ctx,
156156
if (ctx->IsCUDA()) {
157157
// The context passed in is on GPU, we pick it first since we prioritize the context
158158
// in Booster.
159-
ellpack_page_.reset(new EllpackPage(ctx, this, param));
160-
} else if (fmat_ctx_.IsCUDA()) {
161-
// DMatrix was initialized on GPU, we use the context from initialization.
162-
ellpack_page_.reset(new EllpackPage(&fmat_ctx_, this, param));
163-
} else {
159+
fmat_ctx_ = *ctx;
160+
} else if (!fmat_ctx_.IsCUDA()) {
164161
// Mismatched parameter, user set a new max_bin during training.
165-
auto cuda_ctx = ctx->MakeCUDA();
166-
ellpack_page_.reset(new EllpackPage(&cuda_ctx, this, param));
162+
fmat_ctx_ = ctx->MakeCUDA();
167163
}
164+
ellpack_page_.reset(new EllpackPage(&fmat_ctx_, this, param));
168165

169166
batch_param_ = param.MakeCache();
170167
}

0 commit comments

Comments
 (0)