[GPU-Plugin] Integration of a faster version of grow_gpu plugin into mainstream (#2360)

* Integrating a faster version of grow_gpu plugin
1. Removed the older files to reduce duplication
2. Moved all of the grow_gpu files under 'exact' folder
3. All of them are inside 'exact' namespace to avoid any conflicts
4. Fixed a bug in benchmark.py while running only 'grow_gpu' plugin
5. Added cub and googletest submodules to ease integration and unit-testing
6. Updates to CMakeLists.txt to directly build cuda objects into libxgboost

* Added support for building gpu plugins through make flow
1. updated makefile and config.mk to add right targets
2. added unit-tests for gpu exact plugin code

* 1. Added support for building gpu plugin using 'make' flow as well
2. Updated instructions for building and testing gpu plugin

* Fix travis-ci errors for PR#2360
1. lint errors on unit-tests
2. removed googletest, instead depended upon dmlc-core provide gtest cache

* Some more fixes to travis-ci lint failures PR#2360

* Added Rory's copyrights to the files containing code from both.

* updated copyright statement as per Rory's request

* moved the static datasets into a script to generate them at runtime

* 1. memory usage print when silent=0
2. tests/ and test/ folder organization
3. removal of the dependency of googletest for just building xgboost
4. coding style updates for .cuh as well

* Fixes for compilation warnings

* add cuda object files as well when JVM_BINDINGS=ON
This commit is contained in:
Thejaswi
2017-06-06 03:09:53 +05:30
committed by Rory Mitchell
parent 2d9052bc7d
commit 85b2fb3eee
37 changed files with 4118 additions and 1601 deletions

View File

@@ -62,7 +62,7 @@ TEST(SimpleDMatrix, ColAccessWithoutBatches) {
num_col_batch += 1;
EXPECT_EQ(col_iter->Value().size, dmat->info().num_col)
<< "Expected batch size = number of cells as #batches is 1.";
for (int i = 0; i < col_iter->Value().size; ++i) {
for (int i = 0; i < static_cast<int>(col_iter->Value().size); ++i) {
EXPECT_EQ(col_iter->Value()[i].length, dmat->GetColSize(i))
<< "Expected length of each colbatch = colsize as #batches is 1.";
}
@@ -106,7 +106,7 @@ TEST(SimpleDMatrix, ColAccessWithBatches) {
num_col_batch += 1;
EXPECT_EQ(col_iter->Value().size, dmat->info().num_col)
<< "Expected batch size = num_cols as max_row_perbatch is 1.";
for (int i = 0; i < col_iter->Value().size; ++i) {
for (int i = 0; i < static_cast<int>(col_iter->Value().size); ++i) {
EXPECT_LE(col_iter->Value()[i].length, 1)
<< "Expected length of each colbatch <=1 as max_row_perbatch is 1.";
}

View File

@@ -40,7 +40,7 @@ void CheckObjFunction(xgboost::ObjFunction * obj,
obj->GetGradient(preds, info, 1, &gpair);
ASSERT_EQ(gpair.size(), preds.size());
for (int i = 0; i < gpair.size(); ++i) {
for (int i = 0; i < static_cast<int>(gpair.size()); ++i) {
EXPECT_NEAR(gpair[i].grad, out_grad[i], 0.01)
<< "Unexpected grad for pred=" << preds[i] << " label=" << labels[i]
<< " weight=" << weights[i];

View File

@@ -49,7 +49,7 @@ TEST(Objective, LogisticRegressionBasic) {
std::vector<xgboost::bst_float> preds = {0, 0.1, 0.5, 0.9, 1};
std::vector<xgboost::bst_float> out_preds = {0.5, 0.524, 0.622, 0.710, 0.731};
obj->PredTransform(&preds);
for (int i = 0; i < preds.size(); ++i) {
for (int i = 0; i < static_cast<int>(preds.size()); ++i) {
EXPECT_NEAR(preds[i], out_preds[i], 0.01);
}
}
@@ -97,7 +97,7 @@ TEST(Objective, PoissonRegressionBasic) {
std::vector<xgboost::bst_float> preds = {0, 0.1, 0.5, 0.9, 1};
std::vector<xgboost::bst_float> out_preds = {1, 1.10, 1.64, 2.45, 2.71};
obj->PredTransform(&preds);
for (int i = 0; i < preds.size(); ++i) {
for (int i = 0; i < static_cast<int>(preds.size()); ++i) {
EXPECT_NEAR(preds[i], out_preds[i], 0.01);
}
}
@@ -132,7 +132,7 @@ TEST(Objective, GammaRegressionBasic) {
std::vector<xgboost::bst_float> preds = {0, 0.1, 0.5, 0.9, 1};
std::vector<xgboost::bst_float> out_preds = {1, 1.10, 1.64, 2.45, 2.71};
obj->PredTransform(&preds);
for (int i = 0; i < preds.size(); ++i) {
for (int i = 0; i < static_cast<int>(preds.size()); ++i) {
EXPECT_NEAR(preds[i], out_preds[i], 0.01);
}
}
@@ -168,7 +168,7 @@ TEST(Objective, TweedieRegressionBasic) {
std::vector<xgboost::bst_float> preds = {0, 0.1, 0.5, 0.9, 1};
std::vector<xgboost::bst_float> out_preds = {1, 1.10, 1.64, 2.45, 2.71};
obj->PredTransform(&preds);
for (int i = 0; i < preds.size(); ++i) {
for (int i = 0; i < static_cast<int>(preds.size()); ++i) {
EXPECT_NEAR(preds[i], out_preds[i], 0.01);
}
}

View File

@@ -1,9 +1,21 @@
UTEST_ROOT=tests/cpp
UTEST_OBJ_ROOT=build_$(UTEST_ROOT)
UNITTEST=$(UTEST_ROOT)/xgboost_test
UNITTEST_SRC=$(wildcard $(UTEST_ROOT)/*.cc $(UTEST_ROOT)/*/*.cc)
UNITTEST_OBJ=$(patsubst $(UTEST_ROOT)%.cc, $(UTEST_OBJ_ROOT)%.o, $(UNITTEST_SRC))
# for if and when we add cuda source files into xgboost core
UNITTEST_CU_SRC=$(wildcard $(UTEST_ROOT)/*.cu $(UTEST_ROOT)/*/*.cu)
UNITTEST_OBJ += $(patsubst $(UTEST_ROOT)%.cu, $(UTEST_OBJ_ROOT)%.o, $(UNITTEST_CU_SRC))
# tests from grow_gpu plugin (only if CUDA path is enabled!)
ifeq ($(PLUGIN_UPDATER_GPU),ON)
GPU_PLUGIN_FOLDER = plugin/updater_gpu
UNITTEST_CU_PLUGIN_SRC = $(wildcard $(GPU_PLUGIN_FOLDER)/test/cpp/*.cu)
UNITTEST_OBJ += $(patsubst %.cu, $(UTEST_OBJ_ROOT)/%.o, $(UNITTEST_CU_PLUGIN_SRC))
endif
GTEST_LIB=$(GTEST_PATH)/lib/
GTEST_INC=$(GTEST_PATH)/include/
@@ -13,6 +25,19 @@ 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)/$(GPU_PLUGIN_FOLDER)/test/cpp/%.o: $(GPU_PLUGIN_FOLDER)/test/cpp/%.cu
@mkdir -p $(@D)
$(NVCC) $(NVCC_FLAGS) -I$(GTEST_INC) -o $@ -c $<
$(UTEST_OBJ_ROOT)/%.o: $(UTEST_ROOT)/%.cu
@mkdir -p $(@D)
$(NVCC) $(NVCC_FLAGS) -I$(GTEST_INC) -o $@ -c $<
$(UTEST_OBJ_ROOT)/$(GTEST_PATH)/%.o: $(GTEST_PATH)/%.cc
@mkdir -p $(@D)
$(CXX) $(UNITTEST_CFLAGS) -I$(GTEST_INC) -I$(GTEST_PATH) -o $@ -c $<
$(UTEST_OBJ_ROOT)/%.o: $(UTEST_ROOT)/%.cc
@mkdir -p $(@D)
$(CXX) $(UNITTEST_CFLAGS) -I$(GTEST_INC) -o $@ -c $<