Unverified Commit c315087f authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

fixed cpplint issues (#2771)

parent 9f79e840
......@@ -297,7 +297,7 @@ struct TrainingTempState {
#pragma omp parallel
#pragma omp master
{ num_threads = omp_get_num_threads(); }
num_bin_aligned =
num_bin_aligned =
(bin->num_bin() + kAlignedSize - 1) / kAlignedSize * kAlignedSize;
size_t new_size = static_cast<size_t>(num_bin_aligned) * 2 * num_threads;
if (new_size > hist_buf.size()) {
......@@ -447,8 +447,8 @@ class Dataset {
MultiValBin* GetMultiBinFromAllFeatures() const;
TrainingTempState* TestMultiThreadingMethod(
score_t* gradients, score_t* hessians,
const std::vector<int8_t>& is_feature_used, bool is_constant_hessian,
score_t* gradients, score_t* hessians,
const std::vector<int8_t>& is_feature_used, bool is_constant_hessian,
bool force_colwise, bool force_rowwise, bool* is_hist_col_wise) const;
LIGHTGBM_EXPORT void FinishLoad();
......
......@@ -639,9 +639,8 @@ TrainingTempState* Dataset::TestMultiThreadingMethod(
auto overhead_cost = row_wise_init_time + row_wise_time + col_wise_time;
Log::Warning(
"Auto-choosing col-wise multi-threading, the overhead of testing was "
"%f "
"seconds.\nYou can set `force_col_wise=true` to remove the "
"overhead.",
"%f seconds.\n"
"You can set `force_col_wise=true` to remove the overhead.",
overhead_cost * 1e-3);
return colwise_state.release();
} else {
......@@ -649,10 +648,9 @@ TrainingTempState* Dataset::TestMultiThreadingMethod(
auto overhead_cost = col_wise_init_time + row_wise_time + col_wise_time;
Log::Warning(
"Auto-choosing row-wise multi-threading, the overhead of testing was "
"%f "
"seconds.\nYou can set `force_row_wise=true` to remove the "
"overhead.\nAnd if memory is not enough, you can set "
"`force_col_wise=true`.",
"%f seconds.\n"
"You can set `force_row_wise=true` to remove the overhead.\n"
"And if memory is not enough, you can set `force_col_wise=true`.",
overhead_cost * 1e-3);
if (rowwise_state->multi_val_bin->IsSparse()) {
Log::Debug("Using Sparse Multi-Val Bin");
......@@ -1008,7 +1006,6 @@ void Dataset::DumpTextFile(const char* text_filename) {
fclose(file);
}
void Dataset::InitTrain(const std::vector<int8_t>& is_feature_used,
bool is_colwise, TrainingTempState* temp_state) const {
Common::FunctionTimer fun_time("Dataset::InitTrain", global_timer);
......@@ -1024,7 +1021,7 @@ void Dataset::InitTrain(const std::vector<int8_t>& is_feature_used,
std::vector<int> used_feature_index;
for (int i = 0; i < num_groups_; ++i) {
int f_start = group_feature_start_[i];
if (feature_groups_[i]->is_multi_val_ ) {
if (feature_groups_[i]->is_multi_val_) {
for (int j = 0; j < feature_groups_[i]->num_feature_; ++j) {
const auto dense_rate =
1.0 - feature_groups_[i]->bin_mappers_[j]->sparse_rate();
......@@ -1086,11 +1083,11 @@ void Dataset::InitTrain(const std::vector<int8_t>& is_feature_used,
lower_bound.push_back(num_total_bin - cur_num_bin);
upper_bound.push_back(num_total_bin);
temp_state->hist_move_src.push_back(
(new_num_total_bin - cur_num_bin) * 2);
temp_state->hist_move_dest.push_back((num_total_bin - cur_num_bin) *
2);
temp_state->hist_move_dest.push_back(
(num_total_bin - cur_num_bin) * 2);
temp_state->hist_move_size.push_back(cur_num_bin * 2);
delta.push_back(num_total_bin - new_num_total_bin);
}
......@@ -1111,8 +1108,8 @@ void Dataset::InitTrain(const std::vector<int8_t>& is_feature_used,
lower_bound.push_back(num_total_bin - cur_num_bin);
upper_bound.push_back(num_total_bin);
temp_state->hist_move_src.push_back((new_num_total_bin - cur_num_bin) *
2);
temp_state->hist_move_src.push_back(
(new_num_total_bin - cur_num_bin) * 2);
temp_state->hist_move_dest.push_back((num_total_bin - cur_num_bin) * 2);
temp_state->hist_move_size.push_back(cur_num_bin * 2);
delta.push_back(num_total_bin - new_num_total_bin);
......
......@@ -5,9 +5,10 @@
#ifndef LIGHTGBM_IO_MULTI_VAL_DENSE_BIN_HPP_
#define LIGHTGBM_IO_MULTI_VAL_DENSE_BIN_HPP_
#include <LightGBM/utils/openmp_wrapper.h>
#include <LightGBM/bin.h>
#include <LightGBM/utils/openmp_wrapper.h>
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <vector>
......
/*!
* Copyright (c) 2020 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for
* license information.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
#ifndef LIGHTGBM_IO_MULTI_VAL_SPARSE_BIN_HPP_
#define LIGHTGBM_IO_MULTI_VAL_SPARSE_BIN_HPP_
......@@ -9,6 +8,7 @@
#include <LightGBM/bin.h>
#include <LightGBM/utils/openmp_wrapper.h>
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <vector>
......
......@@ -81,12 +81,12 @@ void SerialTreeLearner::GetMultiValBin(const Dataset* dataset, bool is_first_tim
if (is_first_time) {
auto used_feature = GetUsedFeatures(true);
temp_state_.reset(dataset->TestMultiThreadingMethod(
ordered_gradients_.data(), ordered_hessians_.data(), used_feature,
ordered_gradients_.data(), ordered_hessians_.data(), used_feature,
is_constant_hessian_, config_->force_col_wise, config_->force_row_wise, &is_hist_colwise_));
} else {
// cannot change is_hist_col_wise during training
temp_state_.reset(dataset->TestMultiThreadingMethod(
ordered_gradients_.data(), ordered_hessians_.data(), is_feature_used_,
ordered_gradients_.data(), ordered_hessians_.data(), is_feature_used_,
is_constant_hessian_, is_hist_colwise_, !is_hist_colwise_, &is_hist_colwise_));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment