Skip to content

Commit

Permalink
added tracking execution time for UpdatePredictionCache function (#5107)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmirnovEgorRu authored and trivialfis committed Dec 9, 2019
1 parent 38763aa commit b1789b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tree/updater_quantile_hist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,14 @@ void QuantileHistMaker::Builder::Update(const GHistIndexMatrix& gmat,
bool QuantileHistMaker::Builder::UpdatePredictionCache(
const DMatrix* data,
HostDeviceVector<bst_float>* p_out_preds) {
std::vector<bst_float>& out_preds = p_out_preds->HostVector();

// p_last_fmat_ is a valid pointer as long as UpdatePredictionCache() is called in
// conjunction with Update().
if (!p_last_fmat_ || !p_last_tree_ || data != p_last_fmat_) {
return false;
}
builder_monitor_.Start("UpdatePredictionCache");

std::vector<bst_float>& out_preds = p_out_preds->HostVector();

if (leaf_value_cache_.empty()) {
leaf_value_cache_.resize(p_last_tree_->param.num_nodes,
Expand Down Expand Up @@ -385,6 +386,8 @@ bool QuantileHistMaker::Builder::UpdatePredictionCache(
}
}
}

builder_monitor_.Stop("UpdatePredictionCache");
return true;
}

Expand Down

0 comments on commit b1789b0

Please sign in to comment.