Skip to content

Commit

Permalink
Fix empty DMatrix.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Sep 2, 2022
1 parent 8348538 commit 1af5a8a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/data/iterative_dmatrix.cu
Expand Up @@ -173,10 +173,15 @@ BatchSet<EllpackPage> IterativeDMatrix::GetEllpackBatches(BatchParam const& para
}
if (!ellpack_ && ghist_) {
ellpack_.reset(new EllpackPage());
// Evaluation QuantileDMatrix initialized from CPU data might not have the correct GPU
// ID.
if (this->ctx_.IsCPU()) {
this->ctx_.gpu_id = param.gpu_id;
}
this->Info().feature_types.SetDevice(param.gpu_id);
if (this->ctx_.IsCPU()) {
this->ctx_.gpu_id = dh::CurrentDevice();
}
this->Info().feature_types.SetDevice(this->ctx_.gpu_id);
*ellpack_->Impl() =
EllpackPageImpl(&ctx_, *this->ghist_, this->Info().feature_types.ConstDeviceSpan());
}
Expand Down

0 comments on commit 1af5a8a

Please sign in to comment.