Integer gradient summation for GPU histogram algorithm. (#2681)

This commit is contained in:
Rory Mitchell
2017-09-08 15:07:29 +12:00
committed by GitHub
parent 15267eedf2
commit e6a9063344
15 changed files with 182 additions and 128 deletions

View File

@@ -43,10 +43,10 @@ void CheckObjFunction(xgboost::ObjFunction * obj,
ASSERT_EQ(gpair.size(), preds.size());
for (int i = 0; i < static_cast<int>(gpair.size()); ++i) {
EXPECT_NEAR(gpair[i].grad, out_grad[i], 0.01)
EXPECT_NEAR(gpair[i].GetGrad(), out_grad[i], 0.01)
<< "Unexpected grad for pred=" << preds[i] << " label=" << labels[i]
<< " weight=" << weights[i];
EXPECT_NEAR(gpair[i].hess, out_hess[i], 0.01)
EXPECT_NEAR(gpair[i].GetHess(), out_hess[i], 0.01)
<< "Unexpected hess for pred=" << preds[i] << " label=" << labels[i]
<< " weight=" << weights[i];
}

View File

@@ -16,7 +16,7 @@ TEST(gpu_predictor, Test) {
std::unique_ptr<Predictor>(Predictor::Create("cpu_predictor"));
std::vector<std::unique_ptr<RegTree>> trees;
trees.push_back(std::make_unique<RegTree>());
trees.push_back(std::unique_ptr<RegTree>());
trees.back()->InitModel();
(*trees.back())[0].set_leaf(1.5f);
gbm::GBTreeModel model(0.5);

View File

@@ -14,7 +14,6 @@ UNITTEST_DEPS=lib/libxgboost.a $(DMLC_CORE)/libdmlc.a $(RABIT)/lib/$(LIB_RABIT)
COVER_OBJ=$(patsubst %.o, %.gcda, $(ALL_OBJ)) $(patsubst %.o, %.gcda, $(UNITTEST_OBJ))
# the order of the below targets matter!
$(UTEST_OBJ_ROOT)/$(GTEST_PATH)/%.o: $(GTEST_PATH)/%.cc
@mkdir -p $(@D)
$(CXX) $(UNITTEST_CFLAGS) -I$(GTEST_INC) -I$(GTEST_PATH) -o $@ -c $<