From 3d7fa7a30c6c0a0ecca880bee1ebf960138af63e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 1 Jun 2020 20:13:32 +0100 Subject: [PATCH] re-order includes (fixes #3132) (#3133) --- 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 | 6 +++--- 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 | 11 +++++------ 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 | 17 +++++++++-------- src/io/bin.cpp | 11 ++++++----- src/io/config.cpp | 5 +++-- src/io/dataset.cpp | 13 +++++++------ src/io/dataset_loader.cpp | 5 +++-- src/io/dense_bin.hpp | 3 +-- 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, 292 insertions(+), 275 deletions(-) diff --git a/R-package/src/lightgbm_R.cpp b/R-package/src/lightgbm_R.cpp index ad144be1d60c..ec2dbb79dd2f 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 @@ -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 911dedd7d94e..53f9732edea6 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 96ae6a8d641b..fab69d9ba894 100644 --- a/include/LightGBM/bin.h +++ b/include/LightGBM/bin.h @@ -5,10 +5,6 @@ #ifndef LIGHTGBM_BIN_H_ #define LIGHTGBM_BIN_H_ -#include -#include -#include - #include #include #include @@ -16,6 +12,10 @@ #include #include +#include +#include +#include + namespace LightGBM { enum BinType { diff --git a/include/LightGBM/boosting.h b/include/LightGBM/boosting.h index 31bb430f0aed..f456d7989771 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 2b3727bf56ec..e1db94c22575 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 c1aed28e02ff..1fb18b2b5162 100644 --- a/include/LightGBM/config.h +++ b/include/LightGBM/config.h @@ -11,11 +11,6 @@ #ifndef LIGHTGBM_CONFIG_H_ #define LIGHTGBM_CONFIG_H_ -#include -#include -#include -#include - #include #include #include @@ -23,6 +18,11 @@ #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 e4c5dc56511c..bd0143daffd9 100644 --- a/include/LightGBM/dataset.h +++ b/include/LightGBM/dataset.h @@ -5,13 +5,6 @@ #ifndef LIGHTGBM_DATASET_H_ #define LIGHTGBM_DATASET_H_ -#include -#include -#include -#include -#include -#include - #include #include #include @@ -20,6 +13,13 @@ #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 8d5b20b481fc..88443d62472d 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 d949beec20e9..c21ad33b6a4f 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 61d9fc99ea80..56fec3aad770 100644 --- a/include/LightGBM/metric.h +++ b/include/LightGBM/metric.h @@ -5,6 +5,9 @@ #ifndef LIGHTGBM_METRIC_H_ #define LIGHTGBM_METRIC_H_ +#include +#include + #include #include #include @@ -12,9 +15,6 @@ #include #include -#include -#include - namespace LightGBM { /*! diff --git a/include/LightGBM/network.h b/include/LightGBM/network.h index 32c24fe69845..40373508eb5f 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 5ea838dece23..76b3f7145efb 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 1d3e510981f4..40db533325f9 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 467ce0c652f8..f1ec755d9799 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 6c549a5ed71c..cdb3d2823b8a 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 0183ecc22ddb..a071247fb285 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 8acf62d218e9..ed1edeb3e859 100644 --- a/include/LightGBM/utils/common.h +++ b/include/LightGBM/utils/common.h @@ -5,9 +5,6 @@ #ifndef LIGHTGBM_UTILS_COMMON_FUN_H_ #define LIGHTGBM_UTILS_COMMON_FUN_H_ -#include -#include - #include #include #include @@ -26,6 +23,9 @@ #include #include +#include +#include + #if defined(_MSC_VER) #include #elif MM_MALLOC diff --git a/include/LightGBM/utils/openmp_wrapper.h b/include/LightGBM/utils/openmp_wrapper.h index 075c991371c0..fdd4b3850fb9 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 f02500c9751a..4e07b8b36741 100644 --- a/include/LightGBM/utils/pipeline_reader.h +++ b/include/LightGBM/utils/pipeline_reader.h @@ -5,9 +5,6 @@ #ifndef LIGHTGBM_UTILS_PIPELINE_READER_H_ #define LIGHTGBM_UTILS_PIPELINE_READER_H_ -#include -#include - #include #include #include @@ -16,6 +13,9 @@ #include #include +#include +#include + namespace LightGBM { /*! diff --git a/include/LightGBM/utils/text_reader.h b/include/LightGBM/utils/text_reader.h index 638bb2683627..7aaf7f8153a8 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 d293fc811eb1..dcf4f7608afc 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 1b9eabf8a120..a46cf419c534 100644 --- a/src/application/application.cpp +++ b/src/application/application.cpp @@ -2,6 +2,15 @@ * 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 @@ -15,14 +24,6 @@ #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 1c56cfa5eb2c..ab775d429133 100644 --- a/src/application/predictor.hpp +++ b/src/application/predictor.hpp @@ -5,12 +5,6 @@ #ifndef LIGHTGBM_PREDICTOR_HPP_ #define LIGHTGBM_PREDICTOR_HPP_ -#include -#include -#include -#include -#include - #include #include #include @@ -21,6 +15,12 @@ #include #include +#include +#include +#include +#include +#include + namespace LightGBM { /*! diff --git a/src/boosting/dart.hpp b/src/boosting/dart.hpp index e2481e797729..b9dca6a78f2f 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 64baba793cd9..c7c82afd4e92 100644 --- a/src/boosting/gbdt.cpp +++ b/src/boosting/gbdt.cpp @@ -2,8 +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 "gbdt.h" +#include +#include +#include + #include #include #include @@ -11,10 +16,6 @@ #include #include -#include -#include -#include - namespace LightGBM { #ifdef USE_CUDA diff --git a/src/boosting/gbdt.h b/src/boosting/gbdt.h index d460894d44bf..ba281bcd48bd 100644 --- a/src/boosting/gbdt.h +++ b/src/boosting/gbdt.h @@ -5,12 +5,6 @@ #ifndef LIGHTGBM_BOOSTING_GBDT_H_ #define LIGHTGBM_BOOSTING_GBDT_H_ -#include -#include -#include -#include -#include - #include #include #include @@ -25,6 +19,11 @@ #ifdef USE_CUDA #include //LGBM_CUDA #endif +#include +#include +#include +#include +#include #include "score_updater.hpp" diff --git a/src/boosting/gbdt_model_text.cpp b/src/boosting/gbdt_model_text.cpp index 5ce26bca95ca..9ac4b269ac1a 100644 --- a/src/boosting/gbdt_model_text.cpp +++ b/src/boosting/gbdt_model_text.cpp @@ -2,16 +2,17 @@ * 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 b4711f7c01a6..e906bc0aaca1 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 2af6dee14f64..d3a3c6a344c0 100644 --- a/src/boosting/goss.hpp +++ b/src/boosting/goss.hpp @@ -5,10 +5,6 @@ #ifndef LIGHTGBM_BOOSTING_GOSS_H_ #define LIGHTGBM_BOOSTING_GOSS_H_ -#include -#include -#include - #include #include #include @@ -16,6 +12,10 @@ #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 7e21141f6852..7eda08f00d6a 100644 --- a/src/boosting/prediction_early_stop.cpp +++ b/src/boosting/prediction_early_stop.cpp @@ -2,15 +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 + namespace LightGBM { PredictionEarlyStopInstance CreateNone(const PredictionEarlyStopConfig&) { diff --git a/src/boosting/rf.hpp b/src/boosting/rf.hpp index 6b72eebf0a4f..c9c9718e89d1 100644 --- a/src/boosting/rf.hpp +++ b/src/boosting/rf.hpp @@ -5,9 +5,6 @@ #ifndef LIGHTGBM_BOOSTING_RF_H_ #define LIGHTGBM_BOOSTING_RF_H_ -#include -#include - #include #include #include @@ -15,6 +12,9 @@ #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 7446691a4709..231de245068c 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 9e8069d7c864..81c0724eec12 100644 --- a/src/c_api.cpp +++ b/src/c_api.cpp @@ -2,6 +2,15 @@ * 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 @@ -22,14 +31,6 @@ #include #endif -#include -#include -#include -#include -#include -#include -#include - #include "application/predictor.hpp" namespace LightGBM { diff --git a/src/io/bin.cpp b/src/io/bin.cpp index 367edaa3f7b9..9ead232fda02 100644 --- a/src/io/bin.cpp +++ b/src/io/bin.cpp @@ -2,17 +2,18 @@ * 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 c6a2dd6714bc..fd630dcdf037 100644 --- a/src/io/config.cpp +++ b/src/io/config.cpp @@ -2,14 +2,15 @@ * 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 edae575f345a..1001a9432cee 100644 --- a/src/io/dataset.cpp +++ b/src/io/dataset.cpp @@ -3,12 +3,6 @@ * Licensed under the MIT License. See LICENSE file in the project root for * license information. */ -#include - -#include -#include -#include -#include #ifdef USE_CUDA #include @@ -20,6 +14,13 @@ #include #include +#include + +#include +#include +#include +#include + namespace LightGBM { const char* Dataset::binary_file_token = diff --git a/src/io/dataset_loader.cpp b/src/io/dataset_loader.cpp index c0b2edf1a8c3..33ce1df7eb05 100644 --- a/src/io/dataset_loader.cpp +++ b/src/io/dataset_loader.cpp @@ -2,6 +2,9 @@ * 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 @@ -10,8 +13,6 @@ #include #include -#include - namespace LightGBM { using json11::Json; diff --git a/src/io/dense_bin.hpp b/src/io/dense_bin.hpp index 99feadf9f7f8..d7f839bffe39 100644 --- a/src/io/dense_bin.hpp +++ b/src/io/dense_bin.hpp @@ -6,8 +6,6 @@ #ifndef LIGHTGBM_IO_DENSE_BIN_HPP_ #define LIGHTGBM_IO_DENSE_BIN_HPP_ -#include - #include #include #include @@ -17,6 +15,7 @@ #endif #include // LGBM_CUDA +#include namespace LightGBM { diff --git a/src/io/file_io.cpp b/src/io/file_io.cpp index a205964287e9..67a719de0a8e 100644 --- a/src/io/file_io.cpp +++ b/src/io/file_io.cpp @@ -3,14 +3,15 @@ * 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 db21c6aab544..a3fec7724b50 100644 --- a/src/io/json11.cpp +++ b/src/io/json11.cpp @@ -18,15 +18,16 @@ * 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 ea0d5b08def8..9b540045650b 100644 --- a/src/io/metadata.cpp +++ b/src/io/metadata.cpp @@ -2,12 +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 + namespace LightGBM { Metadata::Metadata() { diff --git a/src/io/multi_val_dense_bin.hpp b/src/io/multi_val_dense_bin.hpp index 7645530d774b..d7c6599c381b 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 ec3f64a11a02..09c13420c660 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 df14ea87a99d..c30da4305f94 100644 --- a/src/io/parser.cpp +++ b/src/io/parser.cpp @@ -2,7 +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 "parser.hpp" #include #include @@ -11,6 +10,8 @@ #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 1cfde0635a57..43764a68e754 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 c56cd6da99d5..730ea161a2a6 100644 --- a/src/io/sparse_bin.hpp +++ b/src/io/sparse_bin.hpp @@ -6,10 +6,6 @@ #ifndef LIGHTGBM_IO_SPARSE_BIN_HPP_ #define LIGHTGBM_IO_SPARSE_BIN_HPP_ -#include -#include -#include - #include #include #include @@ -17,6 +13,10 @@ #include #include +#include +#include +#include + namespace LightGBM { template diff --git a/src/io/tree.cpp b/src/io/tree.cpp index be928b7e3124..3c997055a745 100644 --- a/src/io/tree.cpp +++ b/src/io/tree.cpp @@ -2,16 +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 - namespace LightGBM { Tree::Tree(int max_leaves) diff --git a/src/main.cpp b/src/main.cpp index ef277ac0c1f5..0a8931ae4ff7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,10 +2,11 @@ * 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 00a51d6cd24e..5bde453cdbae 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 58843d89f9e1..cd477612bdc2 100644 --- a/src/metric/dcg_calculator.cpp +++ b/src/metric/dcg_calculator.cpp @@ -2,13 +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 + namespace LightGBM { /*! \brief Declaration for some static members */ diff --git a/src/metric/map_metric.hpp b/src/metric/map_metric.hpp index 18539ee44ee0..b373a02b56f1 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 59548cd3a794..f60588cac3fc 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 3b3afb547eb9..d92275020090 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 4d1a36621424..3085bc941b34 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 bec611d28e54..1b86e60e6406 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 1d7b2990f0e1..102fdc993cd2 100644 --- a/src/network/linker_topo.cpp +++ b/src/network/linker_topo.cpp @@ -2,14 +2,15 @@ * 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 8ddbb902a152..5a91d40f73de 100644 --- a/src/network/linkers.h +++ b/src/network/linkers.h @@ -5,11 +5,6 @@ #ifndef LIGHTGBM_NETWORK_LINKERS_H_ #define LIGHTGBM_NETWORK_LINKERS_H_ -#include -#include -#include -#include - #include #include #include @@ -18,6 +13,11 @@ #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 40c6de7aab66..708e3ae9bad5 100644 --- a/src/network/linkers_socket.cpp +++ b/src/network/linkers_socket.cpp @@ -4,10 +4,6 @@ */ #ifdef USE_SOCKET -#include -#include -#include - #include #include #include @@ -16,6 +12,10 @@ #include #include +#include +#include +#include + #include "linkers.h" namespace LightGBM { diff --git a/src/network/network.cpp b/src/network/network.cpp index 3976d72a6926..cbc241d88c66 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -2,13 +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 "linkers.h" namespace LightGBM { diff --git a/src/network/socket_wrapper.hpp b/src/network/socket_wrapper.hpp index 70f9586b99c5..87bd88f934ae 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 4861bd1b83f8..dff3a9c10979 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 c133e1f75fdf..da604baeb499 100644 --- a/src/objective/multiclass_objective.hpp +++ b/src/objective/multiclass_objective.hpp @@ -5,9 +5,6 @@ #ifndef LIGHTGBM_OBJECTIVE_MULTICLASS_OBJECTIVE_HPP_ #define LIGHTGBM_OBJECTIVE_MULTICLASS_OBJECTIVE_HPP_ -#include -#include - #include #include #include @@ -15,6 +12,9 @@ #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 1b20721e238b..730d358f030d 100644 --- a/src/objective/rank_objective.hpp +++ b/src/objective/rank_objective.hpp @@ -6,9 +6,6 @@ #ifndef LIGHTGBM_OBJECTIVE_RANK_OBJECTIVE_HPP_ #define LIGHTGBM_OBJECTIVE_RANK_OBJECTIVE_HPP_ -#include -#include - #include #include #include @@ -17,6 +14,9 @@ #include #include +#include +#include + namespace LightGBM { /*! diff --git a/src/objective/regression_objective.hpp b/src/objective/regression_objective.hpp index 53fa7020be55..fe391f2c15fe 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 cad2b8faafd3..3a145bd2cbb4 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 68a98d159271..8cc667c75afb 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 fad966e64877..fda2bffc8206 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 01c5d2606e71..bdae960c1d9f 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 8916ee48fd40..4dd5f29af0aa 100644 --- a/src/treelearner/feature_histogram.hpp +++ b/src/treelearner/feature_histogram.hpp @@ -6,10 +6,6 @@ #ifndef LIGHTGBM_TREELEARNER_FEATURE_HISTOGRAM_HPP_ #define LIGHTGBM_TREELEARNER_FEATURE_HISTOGRAM_HPP_ -#include -#include -#include - #include #include #include @@ -17,6 +13,10 @@ #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 400b6ab90bf2..411e216b2148 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 937474dd671d..19f696f48f5c 100644 --- a/src/treelearner/gpu_tree_learner.h +++ b/src/treelearner/gpu_tree_learner.h @@ -5,12 +5,6 @@ #ifndef LIGHTGBM_TREELEARNER_GPU_TREE_LEARNER_H_ #define LIGHTGBM_TREELEARNER_GPU_TREE_LEARNER_H_ -#include -#include -#include -#include -#include - #include #include #include @@ -18,6 +12,12 @@ #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 b0a753eafe1b..5c94846eb7b6 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 070b3105affc..59503499ea90 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 e548d07d1230..169d7935e40d 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 eded538288cb..16f160b55f56 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 492434d5160f..72dd3fa324cc 100644 --- a/src/treelearner/split_info.hpp +++ b/src/treelearner/split_info.hpp @@ -5,8 +5,6 @@ #ifndef LIGHTGBM_TREELEARNER_SPLIT_INFO_HPP_ #define LIGHTGBM_TREELEARNER_SPLIT_INFO_HPP_ -#include - #include #include #include @@ -14,6 +12,8 @@ #include #include +#include + namespace LightGBM { /*! diff --git a/src/treelearner/voting_parallel_tree_learner.cpp b/src/treelearner/voting_parallel_tree_learner.cpp index 9485d1f2fe5f..b1d671eb2a52 100644 --- a/src/treelearner/voting_parallel_tree_learner.cpp +++ b/src/treelearner/voting_parallel_tree_learner.cpp @@ -2,12 +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 "parallel_tree_learner.h" namespace LightGBM {