Skip to content

Commit

Permalink
Remove debug code.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Jan 31, 2020
1 parent bab4d09 commit 63d001d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/common/observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace xgboost {
* similiar facilities.
*/
class TrainingObserver {
#if !defined(XGBOOST_USE_DEBUG_OUTPUT)
#if defined(XGBOOST_USE_DEBUG_OUTPUT)
bool constexpr static observe_ {true};
#else
bool constexpr static observe_ {false};
Expand Down
3 changes: 0 additions & 3 deletions src/gbm/gbtree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ void GBTree::ConfigureUpdaters() {
void GBTree::DoBoost(DMatrix* p_fmat,
HostDeviceVector<GradientPair>* in_gpair,
PredictionCacheEntry* predt) {
LOG(WARNING) << "train: " << p_fmat;
std::vector<std::vector<std::unique_ptr<RegTree> > > new_trees;
const int ngroup = model_.learner_model_param_->num_output_group;
ConfigureWithKnownData(this->cfg_, p_fmat);
Expand Down Expand Up @@ -216,9 +215,7 @@ void GBTree::DoBoost(DMatrix* p_fmat,
}
}
monitor_.Stop("BoostNewTrees");
LOG(WARNING) << "before commit:" << predt->version;
this->CommitModel(std::move(new_trees), p_fmat, predt);
LOG(WARNING) << "after commit:" << predt->version;
}

void GBTree::InitUpdater(Args const& cfg) {
Expand Down
1 change: 1 addition & 0 deletions src/learner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ class LearnerImpl : public Learner {
monitor_.Start("GetGradient");
obj_->GetGradient(predt->predictions, train->Info(), iter, &gpair_);
monitor_.Stop("GetGradient");
TrainingObserver::Instance().Observe(gpair_, "Gradients");

gbm_->DoBoost(train, &gpair_, &cache_->Entry(train));
monitor_.Stop("UpdateOneIter");
Expand Down
10 changes: 1 addition & 9 deletions src/predictor/cpu_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "xgboost/host_device_vector.h"

#include "../gbm/gbtree_model.h"
#include "../common/observer.h"

namespace xgboost {
namespace predictor {

Expand Down Expand Up @@ -141,7 +141,6 @@ class CPUPredictor : public Predictor {
const gbm::GBTreeModel& model, int tree_begin,
unsigned ntree_limit = 0) override {
auto* out_preds = &predts->predictions;
TrainingObserver::Instance().Observe(out_preds, "before preds", 8);
CHECK_GE(predts->version, tree_begin);
if (predts->version == 0) {
CHECK_EQ(out_preds->Size(), 0);
Expand All @@ -152,12 +151,9 @@ class CPUPredictor : public Predictor {
if (ntree_limit == 0 || ntree_limit > model.trees.size()) {
ntree_limit = static_cast<unsigned>(model.trees.size());
}
LOG(WARNING) << "predts->version: " << predts->version << ", "
<< "ntree_limit: " << ntree_limit;
auto tree_end = tree_begin + ntree_limit;
CHECK_GE(tree_end, predts->version);
if (tree_end - predts->version == 0) {
LOG(WARNING) << "no prediction should happen";
CHECK_EQ(out_preds->Size(), dmat->Info().num_row_);
} else {
this->PredLoopInternal(dmat, &out_preds->HostVector(), model,
Expand All @@ -166,8 +162,6 @@ class CPUPredictor : public Predictor {

auto delta = (ntree_limit - (predts->version - tree_begin)) /
model.learner_model_param_->num_output_group;
LOG(WARNING) << "batch delta: " << delta;
TrainingObserver::Instance().Observe(out_preds, "after preds", 8);
predts->version += delta;
}

Expand All @@ -192,9 +186,7 @@ class CPUPredictor : public Predictor {
PredLoopInternal(m, &out->HostVector(), model, old_ntree, model.trees.size());
}
auto delta = num_new_trees / model.learner_model_param_->num_output_group;
LOG(WARNING) << "cache delta: " << delta;
predts->version += delta;
TrainingObserver::Instance().Observe(out, "after update", 8);
}

void PredictInstance(const SparsePage::Inst& inst,
Expand Down
5 changes: 0 additions & 5 deletions src/predictor/predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ DMLC_REGISTRY_ENABLE(::xgboost::PredictorReg);
namespace xgboost {

PredictionCacheEntry &PredictionContainer::Entry(DMatrix *m) {
if (Container().find(m) == Container().cend()) {
LOG(WARNING) << "Adding m: " << m << " to container.";
}
LOG(WARNING) << "m is already there: " << m << ", "
<< "version: " << container_[m].version;
return container_[m];
}

Expand Down

0 comments on commit 63d001d

Please sign in to comment.