From 02b32563d428cfdb661df9378bf16e24141b6f2a Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 5 Jun 2020 18:53:07 +0300 Subject: [PATCH] Revert "re-order includes (fixes #3132) (#3133)" (#3153) This reverts commit 656d2676c2174781c91747ba158cb6d27f4cacbd. --- R-package/src/lightgbm_R.cpp | 14 +++++++------- include/LightGBM/application.h | 6 +++--- include/LightGBM/bin.h | 8 ++++---- include/LightGBM/boosting.h | 6 +++--- include/LightGBM/c_api.h | 4 ++-- include/LightGBM/config.h | 10 +++++----- include/LightGBM/dataset.h | 14 +++++++------- include/LightGBM/dataset_loader.h | 4 ++-- include/LightGBM/feature_group.h | 8 ++++---- include/LightGBM/metric.h | 6 +++--- include/LightGBM/network.h | 8 ++++---- include/LightGBM/objective_function.h | 6 +++--- include/LightGBM/prediction_early_stop.h | 4 ++-- include/LightGBM/tree.h | 6 +++--- include/LightGBM/tree_learner.h | 6 +++--- include/LightGBM/utils/array_args.h | 6 +++--- include/LightGBM/utils/common.h | 3 +++ include/LightGBM/utils/openmp_wrapper.h | 8 ++++---- include/LightGBM/utils/pipeline_reader.h | 6 +++--- include/LightGBM/utils/text_reader.h | 8 ++++---- include/LightGBM/utils/threading.h | 8 ++++---- src/application/application.cpp | 17 ++++++++--------- src/application/predictor.hpp | 12 ++++++------ src/boosting/dart.hpp | 4 ++-- src/boosting/gbdt.cpp | 9 ++++----- src/boosting/gbdt.h | 12 ++++++------ src/boosting/gbdt_model_text.cpp | 9 ++++----- src/boosting/gbdt_prediction.cpp | 4 ++-- src/boosting/goss.hpp | 8 ++++---- src/boosting/prediction_early_stop.cpp | 7 +++---- src/boosting/rf.hpp | 6 +++--- src/boosting/score_updater.hpp | 6 +++--- src/c_api.cpp | 9 --------- src/io/bin.cpp | 11 +++++------ src/io/config.cpp | 5 ++--- src/io/dataset.cpp | 18 +++++++++--------- src/io/dataset_loader.cpp | 5 ++--- src/io/dense_bin.hpp | 4 ++-- src/io/file_io.cpp | 7 +++---- src/io/json11.cpp | 7 +++---- src/io/metadata.cpp | 5 ++--- src/io/multi_val_dense_bin.hpp | 6 +++--- src/io/multi_val_sparse_bin.hpp | 6 +++--- src/io/parser.cpp | 3 +-- src/io/parser.hpp | 8 ++++---- src/io/sparse_bin.hpp | 8 ++++---- src/io/tree.cpp | 9 ++++----- src/main.cpp | 3 +-- src/metric/binary_metric.hpp | 8 ++++---- src/metric/dcg_calculator.cpp | 5 ++--- src/metric/map_metric.hpp | 10 +++++----- src/metric/multiclass_metric.hpp | 6 +++--- src/metric/rank_metric.hpp | 8 ++++---- src/metric/regression_metric.hpp | 6 +++--- src/metric/xentropy_metric.hpp | 10 +++++----- src/network/linker_topo.cpp | 7 +++---- src/network/linkers.h | 10 +++++----- src/network/linkers_socket.cpp | 8 ++++---- src/network/network.cpp | 7 +++---- src/network/socket_wrapper.hpp | 4 ++-- src/objective/binary_objective.hpp | 6 +++--- src/objective/multiclass_objective.hpp | 6 +++--- src/objective/rank_objective.hpp | 6 +++--- src/objective/regression_objective.hpp | 8 ++++---- src/objective/xentropy_objective.hpp | 8 ++++---- src/treelearner/col_sampler.hpp | 6 +++--- .../cost_effective_gradient_boosting.hpp | 4 ++-- src/treelearner/data_partition.hpp | 8 ++++---- src/treelearner/feature_histogram.hpp | 8 ++++---- src/treelearner/gpu_tree_learner.cpp | 4 ++-- src/treelearner/gpu_tree_learner.h | 12 ++++++------ src/treelearner/leaf_splits.hpp | 4 ++-- src/treelearner/parallel_tree_learner.h | 6 +++--- src/treelearner/serial_tree_learner.cpp | 10 +++++----- src/treelearner/serial_tree_learner.h | 14 +++++++------- src/treelearner/split_info.hpp | 4 ++-- .../voting_parallel_tree_learner.cpp | 3 +-- 77 files changed, 270 insertions(+), 293 deletions(-) diff --git a/R-package/src/lightgbm_R.cpp b/R-package/src/lightgbm_R.cpp index 14609272fa34..f3165e1fa1ac 100644 --- a/R-package/src/lightgbm_R.cpp +++ b/R-package/src/lightgbm_R.cpp @@ -5,13 +5,6 @@ #include "lightgbm_R.h" -#include -#include -#include -#include -#include -#include - #include #include #include @@ -19,6 +12,13 @@ #include +#include +#include +#include +#include +#include +#include + #define COL_MAJOR (0) #define R_API_BEGIN() \ diff --git a/include/LightGBM/application.h b/include/LightGBM/application.h index 53f9732edea6..911dedd7d94e 100644 --- a/include/LightGBM/application.h +++ b/include/LightGBM/application.h @@ -5,12 +5,12 @@ #ifndef LIGHTGBM_APPLICATION_H_ #define LIGHTGBM_APPLICATION_H_ -#include -#include - #include #include +#include +#include + namespace LightGBM { class DatasetLoader; diff --git a/include/LightGBM/bin.h b/include/LightGBM/bin.h index fab69d9ba894..96ae6a8d641b 100644 --- a/include/LightGBM/bin.h +++ b/include/LightGBM/bin.h @@ -5,6 +5,10 @@ #ifndef LIGHTGBM_BIN_H_ #define LIGHTGBM_BIN_H_ +#include +#include +#include + #include #include #include @@ -12,10 +16,6 @@ #include #include -#include -#include -#include - namespace LightGBM { enum BinType { diff --git a/include/LightGBM/boosting.h b/include/LightGBM/boosting.h index f456d7989771..31bb430f0aed 100644 --- a/include/LightGBM/boosting.h +++ b/include/LightGBM/boosting.h @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_BOOSTING_H_ #define LIGHTGBM_BOOSTING_H_ +#include +#include + #include #include #include #include -#include -#include - namespace LightGBM { /*! \brief forward declaration */ diff --git a/include/LightGBM/c_api.h b/include/LightGBM/c_api.h index 553982eefed7..3fbccdac0759 100644 --- a/include/LightGBM/c_api.h +++ b/include/LightGBM/c_api.h @@ -13,12 +13,12 @@ #ifndef LIGHTGBM_C_API_H_ #define LIGHTGBM_C_API_H_ +#include + #include #include #include -#include - typedef void* DatasetHandle; /*!< \brief Handle of dataset. */ typedef void* BoosterHandle; /*!< \brief Handle of booster. */ diff --git a/include/LightGBM/config.h b/include/LightGBM/config.h index 1fb18b2b5162..c1aed28e02ff 100644 --- a/include/LightGBM/config.h +++ b/include/LightGBM/config.h @@ -11,6 +11,11 @@ #ifndef LIGHTGBM_CONFIG_H_ #define LIGHTGBM_CONFIG_H_ +#include +#include +#include +#include + #include #include #include @@ -18,11 +23,6 @@ #include #include -#include -#include -#include -#include - namespace LightGBM { /*! \brief Types of tasks */ diff --git a/include/LightGBM/dataset.h b/include/LightGBM/dataset.h index bd0143daffd9..e4c5dc56511c 100644 --- a/include/LightGBM/dataset.h +++ b/include/LightGBM/dataset.h @@ -5,6 +5,13 @@ #ifndef LIGHTGBM_DATASET_H_ #define LIGHTGBM_DATASET_H_ +#include +#include +#include +#include +#include +#include + #include #include #include @@ -13,13 +20,6 @@ #include #include -#include -#include -#include -#include -#include -#include - namespace LightGBM { /*! \brief forward declaration */ diff --git a/include/LightGBM/dataset_loader.h b/include/LightGBM/dataset_loader.h index 88443d62472d..8d5b20b481fc 100644 --- a/include/LightGBM/dataset_loader.h +++ b/include/LightGBM/dataset_loader.h @@ -5,12 +5,12 @@ #ifndef LIGHTGBM_DATASET_LOADER_H_ #define LIGHTGBM_DATASET_LOADER_H_ +#include + #include #include #include -#include - namespace LightGBM { class DatasetLoader { diff --git a/include/LightGBM/feature_group.h b/include/LightGBM/feature_group.h index c21ad33b6a4f..d949beec20e9 100644 --- a/include/LightGBM/feature_group.h +++ b/include/LightGBM/feature_group.h @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_FEATURE_GROUP_H_ #define LIGHTGBM_FEATURE_GROUP_H_ -#include -#include -#include - #include #include #include +#include +#include +#include + namespace LightGBM { class Dataset; diff --git a/include/LightGBM/metric.h b/include/LightGBM/metric.h index 56fec3aad770..61d9fc99ea80 100644 --- a/include/LightGBM/metric.h +++ b/include/LightGBM/metric.h @@ -5,9 +5,6 @@ #ifndef LIGHTGBM_METRIC_H_ #define LIGHTGBM_METRIC_H_ -#include -#include - #include #include #include @@ -15,6 +12,9 @@ #include #include +#include +#include + namespace LightGBM { /*! diff --git a/include/LightGBM/network.h b/include/LightGBM/network.h index 40373508eb5f..32c24fe69845 100644 --- a/include/LightGBM/network.h +++ b/include/LightGBM/network.h @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_NETWORK_H_ #define LIGHTGBM_NETWORK_H_ -#include -#include -#include - #include #include #include +#include +#include +#include + namespace LightGBM { /*! \brief forward declaration */ diff --git a/include/LightGBM/objective_function.h b/include/LightGBM/objective_function.h index 76b3f7145efb..5ea838dece23 100644 --- a/include/LightGBM/objective_function.h +++ b/include/LightGBM/objective_function.h @@ -5,13 +5,13 @@ #ifndef LIGHTGBM_OBJECTIVE_FUNCTION_H_ #define LIGHTGBM_OBJECTIVE_FUNCTION_H_ -#include -#include - #include #include #include +#include +#include + namespace LightGBM { /*! * \brief The interface of Objective Function. diff --git a/include/LightGBM/prediction_early_stop.h b/include/LightGBM/prediction_early_stop.h index 40db533325f9..1d3e510981f4 100644 --- a/include/LightGBM/prediction_early_stop.h +++ b/include/LightGBM/prediction_early_stop.h @@ -5,11 +5,11 @@ #ifndef LIGHTGBM_PREDICTION_EARLY_STOP_H_ #define LIGHTGBM_PREDICTION_EARLY_STOP_H_ +#include + #include #include -#include - namespace LightGBM { struct PredictionEarlyStopInstance { diff --git a/include/LightGBM/tree.h b/include/LightGBM/tree.h index f1ec755d9799..467ce0c652f8 100644 --- a/include/LightGBM/tree.h +++ b/include/LightGBM/tree.h @@ -5,15 +5,15 @@ #ifndef LIGHTGBM_TREE_H_ #define LIGHTGBM_TREE_H_ +#include +#include + #include #include #include #include #include -#include -#include - namespace LightGBM { #define kCategoricalMask (1) diff --git a/include/LightGBM/tree_learner.h b/include/LightGBM/tree_learner.h index cdb3d2823b8a..6c549a5ed71c 100644 --- a/include/LightGBM/tree_learner.h +++ b/include/LightGBM/tree_learner.h @@ -5,13 +5,13 @@ #ifndef LIGHTGBM_TREE_LEARNER_H_ #define LIGHTGBM_TREE_LEARNER_H_ -#include -#include - #include #include #include +#include +#include + namespace LightGBM { using json11::Json; diff --git a/include/LightGBM/utils/array_args.h b/include/LightGBM/utils/array_args.h index a071247fb285..0183ecc22ddb 100644 --- a/include/LightGBM/utils/array_args.h +++ b/include/LightGBM/utils/array_args.h @@ -5,13 +5,13 @@ #ifndef LIGHTGBM_UTILS_ARRAY_AGRS_H_ #define LIGHTGBM_UTILS_ARRAY_AGRS_H_ +#include +#include + #include #include #include -#include -#include - namespace LightGBM { /*! diff --git a/include/LightGBM/utils/common.h b/include/LightGBM/utils/common.h index 4cee543c18d8..0679de4d493a 100644 --- a/include/LightGBM/utils/common.h +++ b/include/LightGBM/utils/common.h @@ -5,6 +5,9 @@ #ifndef LIGHTGBM_UTILS_COMMON_FUN_H_ #define LIGHTGBM_UTILS_COMMON_FUN_H_ +#include +#include + #include #include #include diff --git a/include/LightGBM/utils/openmp_wrapper.h b/include/LightGBM/utils/openmp_wrapper.h index fdd4b3850fb9..075c991371c0 100644 --- a/include/LightGBM/utils/openmp_wrapper.h +++ b/include/LightGBM/utils/openmp_wrapper.h @@ -6,16 +6,16 @@ #define LIGHTGBM_OPENMP_WRAPPER_H_ #ifdef _OPENMP +#include + +#include + #include #include #include #include #include -#include - -#include - inline int OMP_NUM_THREADS() { int ret = 1; #pragma omp parallel diff --git a/include/LightGBM/utils/pipeline_reader.h b/include/LightGBM/utils/pipeline_reader.h index 4e07b8b36741..f02500c9751a 100644 --- a/include/LightGBM/utils/pipeline_reader.h +++ b/include/LightGBM/utils/pipeline_reader.h @@ -5,6 +5,9 @@ #ifndef LIGHTGBM_UTILS_PIPELINE_READER_H_ #define LIGHTGBM_UTILS_PIPELINE_READER_H_ +#include +#include + #include #include #include @@ -13,9 +16,6 @@ #include #include -#include -#include - namespace LightGBM { /*! diff --git a/include/LightGBM/utils/text_reader.h b/include/LightGBM/utils/text_reader.h index 7aaf7f8153a8..638bb2683627 100644 --- a/include/LightGBM/utils/text_reader.h +++ b/include/LightGBM/utils/text_reader.h @@ -5,16 +5,16 @@ #ifndef LIGHTGBM_UTILS_TEXT_READER_H_ #define LIGHTGBM_UTILS_TEXT_READER_H_ +#include +#include +#include + #include #include #include #include #include -#include -#include -#include - namespace LightGBM { const size_t kGbs = size_t(1024) * 1024 * 1024; diff --git a/include/LightGBM/utils/threading.h b/include/LightGBM/utils/threading.h index dcf4f7608afc..d293fc811eb1 100644 --- a/include/LightGBM/utils/threading.h +++ b/include/LightGBM/utils/threading.h @@ -6,14 +6,14 @@ #ifndef LIGHTGBM_UTILS_THREADING_H_ #define LIGHTGBM_UTILS_THREADING_H_ -#include -#include -#include - #include #include #include +#include +#include +#include + namespace LightGBM { class Threading { diff --git a/src/application/application.cpp b/src/application/application.cpp index a46cf419c534..1b9eabf8a120 100644 --- a/src/application/application.cpp +++ b/src/application/application.cpp @@ -2,15 +2,6 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - -#include -#include -#include -#include -#include -#include -#include - #include #include @@ -24,6 +15,14 @@ #include #include +#include +#include +#include +#include +#include +#include +#include + #include "predictor.hpp" #ifdef USE_CUDA diff --git a/src/application/predictor.hpp b/src/application/predictor.hpp index ab775d429133..1c56cfa5eb2c 100644 --- a/src/application/predictor.hpp +++ b/src/application/predictor.hpp @@ -5,6 +5,12 @@ #ifndef LIGHTGBM_PREDICTOR_HPP_ #define LIGHTGBM_PREDICTOR_HPP_ +#include +#include +#include +#include +#include + #include #include #include @@ -15,12 +21,6 @@ #include #include -#include -#include -#include -#include -#include - namespace LightGBM { /*! diff --git a/src/boosting/dart.hpp b/src/boosting/dart.hpp index b9dca6a78f2f..e2481e797729 100644 --- a/src/boosting/dart.hpp +++ b/src/boosting/dart.hpp @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_BOOSTING_DART_H_ #define LIGHTGBM_BOOSTING_DART_H_ +#include + #include #include #include #include #include -#include - #include "gbdt.h" #include "score_updater.hpp" diff --git a/src/boosting/gbdt.cpp b/src/boosting/gbdt.cpp index 23691476524d..937d77de2c4c 100644 --- a/src/boosting/gbdt.cpp +++ b/src/boosting/gbdt.cpp @@ -2,13 +2,8 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - #include "gbdt.h" -#include -#include -#include - #include #include #include @@ -16,6 +11,10 @@ #include #include +#include +#include +#include + namespace LightGBM { #ifdef USE_CUDA diff --git a/src/boosting/gbdt.h b/src/boosting/gbdt.h index 420d5479e049..02476f810a8c 100644 --- a/src/boosting/gbdt.h +++ b/src/boosting/gbdt.h @@ -5,6 +5,12 @@ #ifndef LIGHTGBM_BOOSTING_GBDT_H_ #define LIGHTGBM_BOOSTING_GBDT_H_ +#include +#include +#include +#include +#include + #include #include #include @@ -16,12 +22,6 @@ #include #include -#include -#include -#include -#include -#include - #include "score_updater.hpp" #ifdef USE_CUDA diff --git a/src/boosting/gbdt_model_text.cpp b/src/boosting/gbdt_model_text.cpp index 9ac4b269ac1a..5ce26bca95ca 100644 --- a/src/boosting/gbdt_model_text.cpp +++ b/src/boosting/gbdt_model_text.cpp @@ -2,17 +2,16 @@ * Copyright (c) 2017 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - -#include -#include -#include - #include #include #include #include #include +#include +#include +#include + #include "gbdt.h" namespace LightGBM { diff --git a/src/boosting/gbdt_prediction.cpp b/src/boosting/gbdt_prediction.cpp index e906bc0aaca1..b4711f7c01a6 100644 --- a/src/boosting/gbdt_prediction.cpp +++ b/src/boosting/gbdt_prediction.cpp @@ -2,12 +2,12 @@ * Copyright (c) 2017 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ -#include "gbdt.h" - #include #include #include +#include "gbdt.h" + namespace LightGBM { void GBDT::PredictRaw(const double* features, double* output, const PredictionEarlyStopInstance* early_stop) const { diff --git a/src/boosting/goss.hpp b/src/boosting/goss.hpp index d3a3c6a344c0..2af6dee14f64 100644 --- a/src/boosting/goss.hpp +++ b/src/boosting/goss.hpp @@ -5,6 +5,10 @@ #ifndef LIGHTGBM_BOOSTING_GOSS_H_ #define LIGHTGBM_BOOSTING_GOSS_H_ +#include +#include +#include + #include #include #include @@ -12,10 +16,6 @@ #include #include -#include -#include -#include - #include "gbdt.h" #include "score_updater.hpp" diff --git a/src/boosting/prediction_early_stop.cpp b/src/boosting/prediction_early_stop.cpp index 7eda08f00d6a..7e21141f6852 100644 --- a/src/boosting/prediction_early_stop.cpp +++ b/src/boosting/prediction_early_stop.cpp @@ -2,16 +2,15 @@ * Copyright (c) 2017 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ +#include + +#include #include #include #include #include -#include - -#include - namespace LightGBM { PredictionEarlyStopInstance CreateNone(const PredictionEarlyStopConfig&) { diff --git a/src/boosting/rf.hpp b/src/boosting/rf.hpp index c9c9718e89d1..6b72eebf0a4f 100644 --- a/src/boosting/rf.hpp +++ b/src/boosting/rf.hpp @@ -5,6 +5,9 @@ #ifndef LIGHTGBM_BOOSTING_RF_H_ #define LIGHTGBM_BOOSTING_RF_H_ +#include +#include + #include #include #include @@ -12,9 +15,6 @@ #include #include -#include -#include - #include "gbdt.h" #include "score_updater.hpp" diff --git a/src/boosting/score_updater.hpp b/src/boosting/score_updater.hpp index 231de245068c..7446691a4709 100644 --- a/src/boosting/score_updater.hpp +++ b/src/boosting/score_updater.hpp @@ -5,15 +5,15 @@ #ifndef LIGHTGBM_BOOSTING_SCORE_UPDATER_HPP_ #define LIGHTGBM_BOOSTING_SCORE_UPDATER_HPP_ -#include -#include - #include #include #include #include #include +#include +#include + namespace LightGBM { /*! * \brief Used to store and update score for data diff --git a/src/c_api.cpp b/src/c_api.cpp index 979ab104b742..4820690fd7e4 100644 --- a/src/c_api.cpp +++ b/src/c_api.cpp @@ -2,15 +2,6 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - -#include -#include -#include -#include -#include -#include -#include - #include #include diff --git a/src/io/bin.cpp b/src/io/bin.cpp index 9ead232fda02..367edaa3f7b9 100644 --- a/src/io/bin.cpp +++ b/src/io/bin.cpp @@ -2,18 +2,17 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include + #include "dense_bin.hpp" #include "multi_val_dense_bin.hpp" #include "multi_val_sparse_bin.hpp" diff --git a/src/io/config.cpp b/src/io/config.cpp index fd630dcdf037..c6a2dd6714bc 100644 --- a/src/io/config.cpp +++ b/src/io/config.cpp @@ -2,15 +2,14 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - -#include - #include #include #include #include +#include + namespace LightGBM { void Config::KV2Map(std::unordered_map* params, const char* kv) { diff --git a/src/io/dataset.cpp b/src/io/dataset.cpp index 1001a9432cee..3d4e29be1fe9 100644 --- a/src/io/dataset.cpp +++ b/src/io/dataset.cpp @@ -4,9 +4,12 @@ * license information. */ -#ifdef USE_CUDA -#include -#endif +#include + +#include +#include +#include +#include #include #include @@ -14,12 +17,9 @@ #include #include -#include - -#include -#include -#include -#include +#ifdef USE_CUDA +#include +#endif namespace LightGBM { diff --git a/src/io/dataset_loader.cpp b/src/io/dataset_loader.cpp index 33ce1df7eb05..c0b2edf1a8c3 100644 --- a/src/io/dataset_loader.cpp +++ b/src/io/dataset_loader.cpp @@ -2,9 +2,6 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - -#include - #include #include @@ -13,6 +10,8 @@ #include #include +#include + namespace LightGBM { using json11::Json; diff --git a/src/io/dense_bin.hpp b/src/io/dense_bin.hpp index 10d988b68e01..99feadf9f7f8 100644 --- a/src/io/dense_bin.hpp +++ b/src/io/dense_bin.hpp @@ -6,6 +6,8 @@ #ifndef LIGHTGBM_IO_DENSE_BIN_HPP_ #define LIGHTGBM_IO_DENSE_BIN_HPP_ +#include + #include #include #include @@ -16,8 +18,6 @@ #include // LGBM_CUDA -#include - namespace LightGBM { template diff --git a/src/io/file_io.cpp b/src/io/file_io.cpp index 67a719de0a8e..a205964287e9 100644 --- a/src/io/file_io.cpp +++ b/src/io/file_io.cpp @@ -3,15 +3,14 @@ * Licensed under the MIT License. See LICENSE file in the project root for * license information. */ +#include + +#include #include #include #include -#include - -#include - #ifdef USE_HDFS #include #endif diff --git a/src/io/json11.cpp b/src/io/json11.cpp index a3fec7724b50..db21c6aab544 100644 --- a/src/io/json11.cpp +++ b/src/io/json11.cpp @@ -18,16 +18,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include + +#include #include #include #include #include -#include - -#include - namespace json11 { static const int max_depth = 200; diff --git a/src/io/metadata.cpp b/src/io/metadata.cpp index 9b540045650b..ea0d5b08def8 100644 --- a/src/io/metadata.cpp +++ b/src/io/metadata.cpp @@ -2,13 +2,12 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ +#include +#include #include #include -#include -#include - namespace LightGBM { Metadata::Metadata() { diff --git a/src/io/multi_val_dense_bin.hpp b/src/io/multi_val_dense_bin.hpp index d7c6599c381b..7645530d774b 100644 --- a/src/io/multi_val_dense_bin.hpp +++ b/src/io/multi_val_dense_bin.hpp @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_IO_MULTI_VAL_DENSE_BIN_HPP_ #define LIGHTGBM_IO_MULTI_VAL_DENSE_BIN_HPP_ +#include +#include + #include #include #include #include -#include -#include - namespace LightGBM { template diff --git a/src/io/multi_val_sparse_bin.hpp b/src/io/multi_val_sparse_bin.hpp index 09c13420c660..ec3f64a11a02 100644 --- a/src/io/multi_val_sparse_bin.hpp +++ b/src/io/multi_val_sparse_bin.hpp @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_IO_MULTI_VAL_SPARSE_BIN_HPP_ #define LIGHTGBM_IO_MULTI_VAL_SPARSE_BIN_HPP_ +#include +#include + #include #include #include #include -#include -#include - namespace LightGBM { template diff --git a/src/io/parser.cpp b/src/io/parser.cpp index c30da4305f94..df14ea87a99d 100644 --- a/src/io/parser.cpp +++ b/src/io/parser.cpp @@ -2,6 +2,7 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ +#include "parser.hpp" #include #include @@ -10,8 +11,6 @@ #include #include -#include "parser.hpp" - namespace LightGBM { void GetStatistic(const char* str, int* comma_cnt, int* tab_cnt, int* colon_cnt) { diff --git a/src/io/parser.hpp b/src/io/parser.hpp index 43764a68e754..1cfde0635a57 100644 --- a/src/io/parser.hpp +++ b/src/io/parser.hpp @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_IO_PARSER_HPP_ #define LIGHTGBM_IO_PARSER_HPP_ -#include -#include -#include - #include #include #include +#include +#include +#include + namespace LightGBM { class CSVParser: public Parser { diff --git a/src/io/sparse_bin.hpp b/src/io/sparse_bin.hpp index 730ea161a2a6..c56cd6da99d5 100644 --- a/src/io/sparse_bin.hpp +++ b/src/io/sparse_bin.hpp @@ -6,6 +6,10 @@ #ifndef LIGHTGBM_IO_SPARSE_BIN_HPP_ #define LIGHTGBM_IO_SPARSE_BIN_HPP_ +#include +#include +#include + #include #include #include @@ -13,10 +17,6 @@ #include #include -#include -#include -#include - namespace LightGBM { template diff --git a/src/io/tree.cpp b/src/io/tree.cpp index bdf19bdeafaf..d653ad433487 100644 --- a/src/io/tree.cpp +++ b/src/io/tree.cpp @@ -2,17 +2,16 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - -#include -#include -#include - #include #include #include #include +#include +#include +#include + namespace LightGBM { Tree::Tree(int max_leaves) diff --git a/src/main.cpp b/src/main.cpp index 0a8931ae4ff7..ef277ac0c1f5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,11 +2,10 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ +#include #include -#include - #include "network/linkers.h" int main(int argc, char** argv) { diff --git a/src/metric/binary_metric.hpp b/src/metric/binary_metric.hpp index 5bde453cdbae..00a51d6cd24e 100644 --- a/src/metric/binary_metric.hpp +++ b/src/metric/binary_metric.hpp @@ -5,15 +5,15 @@ #ifndef LIGHTGBM_METRIC_BINARY_METRIC_HPP_ #define LIGHTGBM_METRIC_BINARY_METRIC_HPP_ +#include +#include +#include + #include #include #include #include -#include -#include -#include - namespace LightGBM { /*! diff --git a/src/metric/dcg_calculator.cpp b/src/metric/dcg_calculator.cpp index cd477612bdc2..58843d89f9e1 100644 --- a/src/metric/dcg_calculator.cpp +++ b/src/metric/dcg_calculator.cpp @@ -2,14 +2,13 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ +#include +#include #include #include #include -#include -#include - namespace LightGBM { /*! \brief Declaration for some static members */ diff --git a/src/metric/map_metric.hpp b/src/metric/map_metric.hpp index b373a02b56f1..18539ee44ee0 100644 --- a/src/metric/map_metric.hpp +++ b/src/metric/map_metric.hpp @@ -5,16 +5,16 @@ #ifndef LIGHTGBM_METRIC_MAP_METRIC_HPP_ #define LIGHTGBM_METRIC_MAP_METRIC_HPP_ -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include + namespace LightGBM { class MapMetric:public Metric { diff --git a/src/metric/multiclass_metric.hpp b/src/metric/multiclass_metric.hpp index f60588cac3fc..59548cd3a794 100644 --- a/src/metric/multiclass_metric.hpp +++ b/src/metric/multiclass_metric.hpp @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_METRIC_MULTICLASS_METRIC_HPP_ #define LIGHTGBM_METRIC_MULTICLASS_METRIC_HPP_ +#include +#include + #include #include #include #include -#include -#include - namespace LightGBM { /*! * \brief Metric for multiclass task. diff --git a/src/metric/rank_metric.hpp b/src/metric/rank_metric.hpp index d92275020090..3b3afb547eb9 100644 --- a/src/metric/rank_metric.hpp +++ b/src/metric/rank_metric.hpp @@ -5,15 +5,15 @@ #ifndef LIGHTGBM_METRIC_RANK_METRIC_HPP_ #define LIGHTGBM_METRIC_RANK_METRIC_HPP_ -#include -#include -#include - #include #include #include #include +#include +#include +#include + namespace LightGBM { class NDCGMetric:public Metric { diff --git a/src/metric/regression_metric.hpp b/src/metric/regression_metric.hpp index 3085bc941b34..4d1a36621424 100644 --- a/src/metric/regression_metric.hpp +++ b/src/metric/regression_metric.hpp @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_METRIC_REGRESSION_METRIC_HPP_ #define LIGHTGBM_METRIC_REGRESSION_METRIC_HPP_ +#include +#include + #include #include #include #include -#include -#include - namespace LightGBM { /*! * \brief Metric for regression task. diff --git a/src/metric/xentropy_metric.hpp b/src/metric/xentropy_metric.hpp index 1b86e60e6406..bec611d28e54 100644 --- a/src/metric/xentropy_metric.hpp +++ b/src/metric/xentropy_metric.hpp @@ -5,16 +5,16 @@ #ifndef LIGHTGBM_METRIC_XENTROPY_METRIC_HPP_ #define LIGHTGBM_METRIC_XENTROPY_METRIC_HPP_ -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include + /* * Implements three related metrics: * diff --git a/src/network/linker_topo.cpp b/src/network/linker_topo.cpp index 102fdc993cd2..1d7b2990f0e1 100644 --- a/src/network/linker_topo.cpp +++ b/src/network/linker_topo.cpp @@ -2,15 +2,14 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ +#include +#include +#include #include #include #include -#include -#include -#include - namespace LightGBM { diff --git a/src/network/linkers.h b/src/network/linkers.h index 5a91d40f73de..8ddbb902a152 100644 --- a/src/network/linkers.h +++ b/src/network/linkers.h @@ -5,6 +5,11 @@ #ifndef LIGHTGBM_NETWORK_LINKERS_H_ #define LIGHTGBM_NETWORK_LINKERS_H_ +#include +#include +#include +#include + #include #include #include @@ -13,11 +18,6 @@ #include #include -#include -#include -#include -#include - #ifdef USE_SOCKET #include "socket_wrapper.hpp" #endif diff --git a/src/network/linkers_socket.cpp b/src/network/linkers_socket.cpp index 708e3ae9bad5..40c6de7aab66 100644 --- a/src/network/linkers_socket.cpp +++ b/src/network/linkers_socket.cpp @@ -4,6 +4,10 @@ */ #ifdef USE_SOCKET +#include +#include +#include + #include #include #include @@ -12,10 +16,6 @@ #include #include -#include -#include -#include - #include "linkers.h" namespace LightGBM { diff --git a/src/network/network.cpp b/src/network/network.cpp index cbc241d88c66..3976d72a6926 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -2,14 +2,13 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ - -#include -#include - #include #include +#include +#include + #include "linkers.h" namespace LightGBM { diff --git a/src/network/socket_wrapper.hpp b/src/network/socket_wrapper.hpp index 87bd88f934ae..70f9586b99c5 100644 --- a/src/network/socket_wrapper.hpp +++ b/src/network/socket_wrapper.hpp @@ -6,13 +6,13 @@ #define LIGHTGBM_NETWORK_SOCKET_WRAPPER_HPP_ #ifdef USE_SOCKET +#include + #include #include #include #include -#include - #if defined(_WIN32) #ifdef _MSC_VER diff --git a/src/objective/binary_objective.hpp b/src/objective/binary_objective.hpp index dff3a9c10979..4861bd1b83f8 100644 --- a/src/objective/binary_objective.hpp +++ b/src/objective/binary_objective.hpp @@ -5,15 +5,15 @@ #ifndef LIGHTGBM_OBJECTIVE_BINARY_OBJECTIVE_HPP_ #define LIGHTGBM_OBJECTIVE_BINARY_OBJECTIVE_HPP_ +#include +#include + #include #include #include #include #include -#include -#include - namespace LightGBM { /*! * \brief Objective function for binary classification diff --git a/src/objective/multiclass_objective.hpp b/src/objective/multiclass_objective.hpp index da604baeb499..c133e1f75fdf 100644 --- a/src/objective/multiclass_objective.hpp +++ b/src/objective/multiclass_objective.hpp @@ -5,6 +5,9 @@ #ifndef LIGHTGBM_OBJECTIVE_MULTICLASS_OBJECTIVE_HPP_ #define LIGHTGBM_OBJECTIVE_MULTICLASS_OBJECTIVE_HPP_ +#include +#include + #include #include #include @@ -12,9 +15,6 @@ #include #include -#include -#include - #include "binary_objective.hpp" namespace LightGBM { diff --git a/src/objective/rank_objective.hpp b/src/objective/rank_objective.hpp index 730d358f030d..1b20721e238b 100644 --- a/src/objective/rank_objective.hpp +++ b/src/objective/rank_objective.hpp @@ -6,6 +6,9 @@ #ifndef LIGHTGBM_OBJECTIVE_RANK_OBJECTIVE_HPP_ #define LIGHTGBM_OBJECTIVE_RANK_OBJECTIVE_HPP_ +#include +#include + #include #include #include @@ -14,9 +17,6 @@ #include #include -#include -#include - namespace LightGBM { /*! diff --git a/src/objective/regression_objective.hpp b/src/objective/regression_objective.hpp index fe391f2c15fe..53fa7020be55 100644 --- a/src/objective/regression_objective.hpp +++ b/src/objective/regression_objective.hpp @@ -5,14 +5,14 @@ #ifndef LIGHTGBM_OBJECTIVE_REGRESSION_OBJECTIVE_HPP_ #define LIGHTGBM_OBJECTIVE_REGRESSION_OBJECTIVE_HPP_ -#include -#include -#include - #include #include #include +#include +#include +#include + namespace LightGBM { #define PercentileFun(T, data_reader, cnt_data, alpha) \ diff --git a/src/objective/xentropy_objective.hpp b/src/objective/xentropy_objective.hpp index 3a145bd2cbb4..cad2b8faafd3 100644 --- a/src/objective/xentropy_objective.hpp +++ b/src/objective/xentropy_objective.hpp @@ -5,16 +5,16 @@ #ifndef LIGHTGBM_OBJECTIVE_XENTROPY_OBJECTIVE_HPP_ #define LIGHTGBM_OBJECTIVE_XENTROPY_OBJECTIVE_HPP_ +#include +#include +#include + #include #include #include #include #include -#include -#include -#include - /* * Implements gradients and hessians for the following point losses. * Target y is anything in interval [0, 1]. diff --git a/src/treelearner/col_sampler.hpp b/src/treelearner/col_sampler.hpp index 8cc667c75afb..68a98d159271 100644 --- a/src/treelearner/col_sampler.hpp +++ b/src/treelearner/col_sampler.hpp @@ -6,15 +6,15 @@ #ifndef LIGHTGBM_TREELEARNER_COL_SAMPLER_HPP_ #define LIGHTGBM_TREELEARNER_COL_SAMPLER_HPP_ -#include -#include - #include #include #include #include #include +#include +#include + namespace LightGBM { class ColSampler { public: diff --git a/src/treelearner/cost_effective_gradient_boosting.hpp b/src/treelearner/cost_effective_gradient_boosting.hpp index fda2bffc8206..fad966e64877 100644 --- a/src/treelearner/cost_effective_gradient_boosting.hpp +++ b/src/treelearner/cost_effective_gradient_boosting.hpp @@ -5,13 +5,13 @@ #ifndef LIGHTGBM_TREELEARNER_COST_EFFECTIVE_GRADIENT_BOOSTING_HPP_ #define LIGHTGBM_TREELEARNER_COST_EFFECTIVE_GRADIENT_BOOSTING_HPP_ -#include - #include #include #include #include +#include + #include "data_partition.hpp" #include "serial_tree_learner.h" #include "split_info.hpp" diff --git a/src/treelearner/data_partition.hpp b/src/treelearner/data_partition.hpp index bdae960c1d9f..01c5d2606e71 100644 --- a/src/treelearner/data_partition.hpp +++ b/src/treelearner/data_partition.hpp @@ -5,15 +5,15 @@ #ifndef LIGHTGBM_TREELEARNER_DATA_PARTITION_HPP_ #define LIGHTGBM_TREELEARNER_DATA_PARTITION_HPP_ -#include -#include -#include - #include #include #include #include +#include +#include +#include + namespace LightGBM { /*! * \brief DataPartition is used to store the the partition of data on tree. diff --git a/src/treelearner/feature_histogram.hpp b/src/treelearner/feature_histogram.hpp index 4dd5f29af0aa..8916ee48fd40 100644 --- a/src/treelearner/feature_histogram.hpp +++ b/src/treelearner/feature_histogram.hpp @@ -6,6 +6,10 @@ #ifndef LIGHTGBM_TREELEARNER_FEATURE_HISTOGRAM_HPP_ #define LIGHTGBM_TREELEARNER_FEATURE_HISTOGRAM_HPP_ +#include +#include +#include + #include #include #include @@ -13,10 +17,6 @@ #include #include -#include -#include -#include - #include "monotone_constraints.hpp" #include "split_info.hpp" diff --git a/src/treelearner/gpu_tree_learner.cpp b/src/treelearner/gpu_tree_learner.cpp index 411e216b2148..400b6ab90bf2 100644 --- a/src/treelearner/gpu_tree_learner.cpp +++ b/src/treelearner/gpu_tree_learner.cpp @@ -6,12 +6,12 @@ #include "gpu_tree_learner.h" -#include - #include #include #include +#include + #include "../io/dense_bin.hpp" #define GPU_DEBUG 0 diff --git a/src/treelearner/gpu_tree_learner.h b/src/treelearner/gpu_tree_learner.h index 19f696f48f5c..937474dd671d 100644 --- a/src/treelearner/gpu_tree_learner.h +++ b/src/treelearner/gpu_tree_learner.h @@ -5,6 +5,12 @@ #ifndef LIGHTGBM_TREELEARNER_GPU_TREE_LEARNER_H_ #define LIGHTGBM_TREELEARNER_GPU_TREE_LEARNER_H_ +#include +#include +#include +#include +#include + #include #include #include @@ -12,12 +18,6 @@ #include #include -#include -#include -#include -#include -#include - #include "data_partition.hpp" #include "feature_histogram.hpp" #include "leaf_splits.hpp" diff --git a/src/treelearner/leaf_splits.hpp b/src/treelearner/leaf_splits.hpp index 5c94846eb7b6..b0a753eafe1b 100644 --- a/src/treelearner/leaf_splits.hpp +++ b/src/treelearner/leaf_splits.hpp @@ -5,11 +5,11 @@ #ifndef LIGHTGBM_TREELEARNER_LEAF_SPLITS_HPP_ #define LIGHTGBM_TREELEARNER_LEAF_SPLITS_HPP_ +#include + #include #include -#include - #include "data_partition.hpp" namespace LightGBM { diff --git a/src/treelearner/parallel_tree_learner.h b/src/treelearner/parallel_tree_learner.h index 59503499ea90..070b3105affc 100644 --- a/src/treelearner/parallel_tree_learner.h +++ b/src/treelearner/parallel_tree_learner.h @@ -5,13 +5,13 @@ #ifndef LIGHTGBM_TREELEARNER_PARALLEL_TREE_LEARNER_H_ #define LIGHTGBM_TREELEARNER_PARALLEL_TREE_LEARNER_H_ +#include +#include + #include #include #include -#include -#include - #include "gpu_tree_learner.h" #include "serial_tree_learner.h" #include "cuda_tree_learner.h" diff --git a/src/treelearner/serial_tree_learner.cpp b/src/treelearner/serial_tree_learner.cpp index 169d7935e40d..e548d07d1230 100644 --- a/src/treelearner/serial_tree_learner.cpp +++ b/src/treelearner/serial_tree_learner.cpp @@ -4,16 +4,16 @@ */ #include "serial_tree_learner.h" -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include + #include "cost_effective_gradient_boosting.hpp" namespace LightGBM { diff --git a/src/treelearner/serial_tree_learner.h b/src/treelearner/serial_tree_learner.h index 16f160b55f56..eded538288cb 100644 --- a/src/treelearner/serial_tree_learner.h +++ b/src/treelearner/serial_tree_learner.h @@ -5,13 +5,6 @@ #ifndef LIGHTGBM_TREELEARNER_SERIAL_TREE_LEARNER_H_ #define LIGHTGBM_TREELEARNER_SERIAL_TREE_LEARNER_H_ -#include -#include -#include -#include -#include -#include - #include #include #include @@ -19,6 +12,13 @@ #include #include +#include +#include +#include +#include +#include +#include + #include "col_sampler.hpp" #include "data_partition.hpp" #include "feature_histogram.hpp" diff --git a/src/treelearner/split_info.hpp b/src/treelearner/split_info.hpp index 72dd3fa324cc..492434d5160f 100644 --- a/src/treelearner/split_info.hpp +++ b/src/treelearner/split_info.hpp @@ -5,6 +5,8 @@ #ifndef LIGHTGBM_TREELEARNER_SPLIT_INFO_HPP_ #define LIGHTGBM_TREELEARNER_SPLIT_INFO_HPP_ +#include + #include #include #include @@ -12,8 +14,6 @@ #include #include -#include - namespace LightGBM { /*! diff --git a/src/treelearner/voting_parallel_tree_learner.cpp b/src/treelearner/voting_parallel_tree_learner.cpp index b1d671eb2a52..9485d1f2fe5f 100644 --- a/src/treelearner/voting_parallel_tree_learner.cpp +++ b/src/treelearner/voting_parallel_tree_learner.cpp @@ -2,13 +2,12 @@ * Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for license information. */ +#include #include #include #include -#include - #include "parallel_tree_learner.h" namespace LightGBM {