Various bug fixes (#2825)

* Fatal error if GPU algorithm selected without GPU support compiled

* Resolve type conversion warnings

* Fix gpu unit test failure

* Fix compressed iterator edge case

* Fix python unit test failures due to flake8 update on pip
This commit is contained in:
Rory Mitchell
2017-10-25 14:45:01 +13:00
committed by GitHub
parent c71b62d48d
commit 13e7a2cff0
21 changed files with 163 additions and 180 deletions

View File

@@ -7,7 +7,7 @@ namespace common {
TEST(CompressedIterator, Test) {
ASSERT_TRUE(detail::SymbolBits(256) == 8);
ASSERT_TRUE(detail::SymbolBits(150) == 8);
std::vector<int> test_cases = {3, 426, 21, 64, 256, 100000, INT32_MAX};
std::vector<int> test_cases = {1, 3, 426, 21, 64, 256, 100000, INT32_MAX};
int num_elements = 1000;
int repetitions = 1000;
srand(9);

View File

@@ -12,7 +12,7 @@ void CreateTestData(xgboost::bst_uint num_rows, int max_row_size,
thrust::host_vector<xgboost::bst_uint> *rows) {
row_ptr->resize(num_rows + 1);
int sum = 0;
for (int i = 0; i <= num_rows; i++) {
for (xgboost::bst_uint i = 0; i <= num_rows; i++) {
(*row_ptr)[i] = sum;
sum += rand() % max_row_size; // NOLINT

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::unique_ptr<RegTree>());
trees.push_back(std::unique_ptr<RegTree>(new RegTree()));
trees.back()->InitModel();
(*trees.back())[0].set_leaf(1.5f);
(*trees.back()).stat(0).sum_hess = 1.0f;
@@ -39,7 +39,6 @@ TEST(gpu_predictor, Test) {
ASSERT_LT(std::abs(gpu_out_predictions[i] - cpu_out_predictions[i]),
abs_tolerance);
}
// Test predict instance
auto batch = dmat->RowIterator()->Value();
for (int i = 0; i < batch.size; i++) {

View File

@@ -16,7 +16,7 @@ TEST(gpu_hist_experimental, TestSparseShard) {
int rows = 100;
int columns = 80;
int max_bins = 4;
auto dmat = CreateDMatrix(rows, columns, 0.9);
auto dmat = CreateDMatrix(rows, columns, 0.9f);
common::HistCutMatrix hmat;
common::GHistIndexMatrix gmat;
hmat.Init(dmat.get(), max_bins);
@@ -33,7 +33,7 @@ TEST(gpu_hist_experimental, TestSparseShard) {
for (int i = 0; i < rows; i++) {
int row_offset = 0;
for (int j = gmat.row_ptr[i]; j < gmat.row_ptr[i + 1]; j++) {
for (auto j = gmat.row_ptr[i]; j < gmat.row_ptr[i + 1]; j++) {
ASSERT_EQ(gidx[i * shard.row_stride + row_offset], gmat.index[j]);
row_offset++;
}

View File

@@ -61,7 +61,7 @@ if [ ${TASK} == "python_lightweight_test" ]; then
conda install numpy scipy nose
python -m pip install graphviz
python -m nose tests/python || exit -1
python -m pip install flake8
python -m pip install flake8==3.4.1
flake8 --ignore E501 python-package || exit -1
flake8 --ignore E501 tests/python || exit -1
exit 0