diff --git a/paddle/fluid/distributed/service/communicator.cc b/paddle/fluid/distributed/service/communicator.cc index f0322a0cbe8f52bcb2c663a7dbf470e862c579d3..57b3636dee794050d35d66e173c63584cb3faf5e 100644 --- a/paddle/fluid/distributed/service/communicator.cc +++ b/paddle/fluid/distributed/service/communicator.cc @@ -13,10 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/distributed/service/communicator.h" -#include -#include "paddle/fluid/distributed/table/table.h" -#include +#include #include #include @@ -25,6 +23,8 @@ limitations under the License. */ #include // NOLINT #include +#include "gflags/gflags.h" +#include "paddle/fluid/distributed/table/table.h" #include "paddle/fluid/framework/eigen.h" #include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/framework/tensor_util.h" @@ -64,7 +64,7 @@ void Communicator::init_gflag(const std::string &gflags) { flags.insert(it, "exe default"); char *flags_ptr[flags.size()]; for (size_t i = 0; i < flags.size(); ++i) { - flags_ptr[i] = (char *)(flags[i].c_str()); + flags_ptr[i] = (char *)(flags[i].c_str()); // NOLINT } int params_cnt = flags.size(); char **params_ptr = &(flags_ptr[0]); @@ -225,7 +225,7 @@ void Communicator::RpcSendDense(const CommContext &ctx, const Scope &scope) { DownpourBrpcClosure *closure = new DownpourBrpcClosure( request_call_num, [this, request_call_num](void *done) { int ret = 0; - auto *closure = (DownpourBrpcClosure *)done; + auto *closure = (DownpourBrpcClosure *)done; // NOLINT for (size_t i = 0; i < request_call_num; ++i) { if (closure->check_response(i, PS_PUSH_DENSE_TABLE) != 0) { ret = -1; @@ -262,7 +262,7 @@ void Communicator::RpcSendSparseParam(const std::string &varname, int table_id, DownpourBrpcClosure *closure = new DownpourBrpcClosure( request_call_num, [this, request_call_num](void *done) { int ret = 0; - auto *closure = (DownpourBrpcClosure *)done; + auto *closure = (DownpourBrpcClosure *)done; // NOLINT for (size_t i = 0; i < request_call_num; ++i) { if (closure->check_response(i, PS_PUSH_SPARSE_PARAM) != 0) { ret = -1; @@ -300,7 +300,7 @@ void Communicator::RpcSendSparse(const std::string &var_name, int table_id, DownpourBrpcClosure *closure = new DownpourBrpcClosure( request_call_num, [this, request_call_num](void *done) { int ret = 0; - auto *closure = (DownpourBrpcClosure *)done; + auto *closure = (DownpourBrpcClosure *)done; // NOLINT for (size_t i = 0; i < request_call_num; ++i) { if (closure->check_response(i, PS_PUSH_SPARSE_TABLE) != 0) { ret = -1; @@ -333,9 +333,9 @@ void Communicator::RpcRecvSparse(const std::string &varname, int table_id, push_g_vec.push_back(tensor->data() + i * dim); } - auto status = _worker_ptr->pull_sparse((float **)push_g_vec.data(), table_id, - sparse_push_keys.data(), - sparse_push_keys.size()); + auto status = _worker_ptr->pull_sparse( + (float **)push_g_vec.data(), table_id, // NOLINT + sparse_push_keys.data(), sparse_push_keys.size()); status.wait(); return; } @@ -397,7 +397,7 @@ void Communicator::SendGlobalStep(const CommContext &ctx, int batches, DownpourBrpcClosure *closure = new DownpourBrpcClosure( request_call_num, [this, request_call_num](void *done) { int ret = 0; - auto *closure = (DownpourBrpcClosure *)done; + auto *closure = (DownpourBrpcClosure *)done; // NOLINT for (size_t i = 0; i < request_call_num; ++i) { if (closure->check_response(i, PS_PUSH_GLOBAL_STEP) != 0) { ret = -1; @@ -1106,7 +1106,7 @@ void GeoCommunicator::SendSparse(const std::string &varname, ++_async_call_num; DownpourBrpcClosure *closure = new DownpourBrpcClosure(1, [this](void *done) { int ret = 0; - auto *closure = (DownpourBrpcClosure *)done; + auto *closure = (DownpourBrpcClosure *)done; // NOLINT if (closure->check_response(0, PS_PUSH_SPARSE_TABLE) != 0) { ret = -1; } diff --git a/paddle/fluid/distributed/service/env.h b/paddle/fluid/distributed/service/env.h index 42f31717f7fba4203cdbd24d59cfa2d9973d5e8a..e80cbe5da661943e43ba28611cef61ba9b88b33c 100644 --- a/paddle/fluid/distributed/service/env.h +++ b/paddle/fluid/distributed/service/env.h @@ -15,7 +15,6 @@ #pragma once #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include "gflags/gflags.h" namespace paddle { namespace distributed { @@ -55,7 +55,7 @@ struct PSHost { rank = host_label & rank_label_mask; port = (host_label >> 12) & port_label_mask; uint32_t ip_addr = (host_label >> 32); - ip = inet_ntoa(*(in_addr *)&ip_addr); + ip = inet_ntoa(*(in_addr *)&ip_addr); // NOLINT } std::string to_string() { @@ -108,7 +108,7 @@ struct PSHost { class PSEnvironment { public: - explicit PSEnvironment() {} + explicit PSEnvironment() {} // NOLINT virtual ~PSEnvironment() {} virtual int32_t set_ps_servers(uint64_t *host_sign_list, int node_num) { @@ -162,10 +162,11 @@ class PSEnvironment { } protected: - //注册一个host - virtual int32_t registe_ps_host(const std::string &ip, uint32_t port, - int32_t rank, std::vector &host_list, - std::unordered_set &sign_set) { + //注册一个host // NOLINT + virtual int32_t registe_ps_host( + const std::string &ip, uint32_t port, int32_t rank, + std::vector &host_list, // NOLINT + std::unordered_set &sign_set) { // NOLINT PSHost host; host.ip = ip; host.port = port; @@ -198,7 +199,7 @@ class PSEnvironment { class PaddlePSEnvironment : public PSEnvironment { public: - explicit PaddlePSEnvironment() {} + explicit PaddlePSEnvironment() {} // NOLINT virtual ~PaddlePSEnvironment() {} virtual int32_t set_ps_servers(uint64_t *host_sign_list, int node_num) { diff --git a/paddle/fluid/distributed/table/depends/dense.h b/paddle/fluid/distributed/table/depends/dense.h index 209595de7e636dc25667e0a606e254d4251cb2ab..a2acdfd20148ac282f6633e55ea450dd3367e5f2 100644 --- a/paddle/fluid/distributed/table/depends/dense.h +++ b/paddle/fluid/distributed/table/depends/dense.h @@ -14,13 +14,13 @@ #pragma once -#include #include // for sqrt in CPU and CUDA #include #include #include #include #include +#include "gflags/gflags.h" #include "paddle/fluid/distributed/common/utils.h" diff --git a/paddle/fluid/distributed/table/depends/initializers.h b/paddle/fluid/distributed/table/depends/initializers.h index 8d45e83f92d85ff6671a600689524437344de34e..e8857ed51560de1af34f55a4feca29d4e8b1292b 100644 --- a/paddle/fluid/distributed/table/depends/initializers.h +++ b/paddle/fluid/distributed/table/depends/initializers.h @@ -14,12 +14,12 @@ #pragma once -#include #include #include #include #include #include +#include "gflags/gflags.h" #include "paddle/fluid/framework/generator.h" diff --git a/paddle/fluid/distributed/table/depends/large_scale_kv.h b/paddle/fluid/distributed/table/depends/large_scale_kv.h index 79a4c4700a9504e37ad71648f2657b68747b5fbb..9ab3711fe2ea0d053167582af838bdc2ba5fd5e1 100644 --- a/paddle/fluid/distributed/table/depends/large_scale_kv.h +++ b/paddle/fluid/distributed/table/depends/large_scale_kv.h @@ -15,7 +15,6 @@ #pragma once #include -#include #include #include // NOLINT #include @@ -25,6 +24,7 @@ #include #include #include +#include "gflags/gflags.h" #include "paddle/fluid/distributed/common/utils.h" #include "paddle/fluid/distributed/table/depends/initializers.h" diff --git a/paddle/fluid/distributed/table/depends/sparse.h b/paddle/fluid/distributed/table/depends/sparse.h index 1900da32155cd7d573029fd4b97ab97dbf9e30d5..4ee753fc75a3f6f39d2f4bafe3310735922a52ac 100644 --- a/paddle/fluid/distributed/table/depends/sparse.h +++ b/paddle/fluid/distributed/table/depends/sparse.h @@ -14,7 +14,6 @@ #pragma once -#include #include // for sqrt in CPU and CUDA #include #include @@ -22,6 +21,7 @@ #include #include #include +#include "gflags/gflags.h" #include "paddle/fluid/distributed/common/utils.h" #include "paddle/fluid/distributed/table/depends/large_scale_kv.h" diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index 9c29c938afd919c037c5a28656ab03b26ffd8a7a..dcaebc10a7408320831503dba4bd76ef55d2ed37 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -14,7 +14,6 @@ limitations under the License. */ #include "paddle/fluid/framework/operator.h" -#include #include #include @@ -23,6 +22,7 @@ limitations under the License. */ #include #include +#include "gflags/gflags.h" #include "paddle/fluid/framework/data_transform.h" #include "paddle/fluid/framework/data_type_transform.h" #include "paddle/fluid/framework/details/nan_inf_utils.h" diff --git a/paddle/fluid/framework/unused_var_check.cc b/paddle/fluid/framework/unused_var_check.cc index dc2063282463b577a9239a62dbe1a9decc1bc659..2826014f506b2b4491650df164658e6a1e6523a3 100644 --- a/paddle/fluid/framework/unused_var_check.cc +++ b/paddle/fluid/framework/unused_var_check.cc @@ -14,10 +14,10 @@ limitations under the License. */ #include "paddle/fluid/framework/unused_var_check.h" -#include #include #include #include +#include "gflags/gflags.h" #include "paddle/fluid/framework/no_need_buffer_vars_inference.h" #include "paddle/fluid/framework/op_info.h" diff --git a/paddle/fluid/framework/unused_var_check.h b/paddle/fluid/framework/unused_var_check.h index d78b4d928f3ec85fe768f2de1316111533579bec..7d612d9316cdf4adc780f12cdf930bac46909edd 100644 --- a/paddle/fluid/framework/unused_var_check.h +++ b/paddle/fluid/framework/unused_var_check.h @@ -14,10 +14,10 @@ limitations under the License. */ #pragma once -#include #include #include #include +#include "gflags/gflags.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/imperative/profiler.cc b/paddle/fluid/imperative/profiler.cc index 85063a6821680f6c990282f8492b3fe9f54bfbf5..6d0f6a12f522977564c9dc36029670d4f3c9d752 100644 --- a/paddle/fluid/imperative/profiler.cc +++ b/paddle/fluid/imperative/profiler.cc @@ -17,9 +17,9 @@ #ifdef WITH_GPERFTOOLS #include "gperftools/profiler.h" #endif -#include #include #include // NOLINT +#include "gflags/gflags.h" DEFINE_string( tracer_profile_fname, "xxgperf", diff --git a/paddle/fluid/inference/analysis/analyzer.h b/paddle/fluid/inference/analysis/analyzer.h index a6de18db60072fc2a5310893a885994d675dd8b6..4db54706285d457a9ae435892dab143f81aa2111 100644 --- a/paddle/fluid/inference/analysis/analyzer.h +++ b/paddle/fluid/inference/analysis/analyzer.h @@ -35,9 +35,9 @@ limitations under the License. */ * phase in the inference service. */ -#include #include #include +#include "gflags/gflags.h" #include "paddle/fluid/inference/analysis/analysis_pass.h" #include "paddle/fluid/inference/analysis/flags.h" diff --git a/paddle/fluid/inference/analysis/flags.h b/paddle/fluid/inference/analysis/flags.h index 717e543f01dfa071865a5c14c0b7679e65239daf..ea0406128b53bfdf04ccb97d2eba2c1c236c845c 100644 --- a/paddle/fluid/inference/analysis/flags.h +++ b/paddle/fluid/inference/analysis/flags.h @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#pragma once + +#include "gflags/gflags.h" // TODO(Superjomn) add a definition flag like PADDLE_WITH_TENSORRT and hide this // flag if not available. diff --git a/paddle/fluid/inference/analysis/ut_helper.h b/paddle/fluid/inference/analysis/ut_helper.h index d599099a8050eaeabb8e0544b1bfe3b6b46b17ec..56565c8f3f72abe5925b64199c428f378dfca136 100644 --- a/paddle/fluid/inference/analysis/ut_helper.h +++ b/paddle/fluid/inference/analysis/ut_helper.h @@ -13,10 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ #pragma once -#include #include #include #include +#include "gflags/gflags.h" #include "paddle/fluid/framework/executor.h" #include "paddle/fluid/inference/analysis/helper.h" diff --git a/paddle/fluid/inference/api/demo_ci/simple_on_word2vec.cc b/paddle/fluid/inference/api/demo_ci/simple_on_word2vec.cc index 3dd1d3c838c4b1bcdefdadff16b02dbfb4a02ee9..166b84f2829cae3309cc4837d73550d7330869d9 100644 --- a/paddle/fluid/inference/api/demo_ci/simple_on_word2vec.cc +++ b/paddle/fluid/inference/api/demo_ci/simple_on_word2vec.cc @@ -16,13 +16,13 @@ limitations under the License. */ * This file contains a simple demo for how to take a model for inference. */ -#include #include #include #include #include //NOLINT +#include "gflags/gflags.h" #include "utils.h" // NOLINT DEFINE_string(dirname, "", "Directory of the inference model."); diff --git a/paddle/fluid/inference/api/demo_ci/trt_mobilenet_demo.cc b/paddle/fluid/inference/api/demo_ci/trt_mobilenet_demo.cc index f9d747c1f04970505652d1d2100f1b2164d9f224..4498a1bef200ecd1b969e55b1b0fb9f00a23967d 100644 --- a/paddle/fluid/inference/api/demo_ci/trt_mobilenet_demo.cc +++ b/paddle/fluid/inference/api/demo_ci/trt_mobilenet_demo.cc @@ -16,8 +16,8 @@ limitations under the License. */ * This file contains demo of mobilenet for tensorrt. */ -#include #include // use glog instead of CHECK to avoid importing other paddle header files. +#include "gflags/gflags.h" #include "utils.h" // NOLINT DECLARE_double(fraction_of_gpu_memory_to_use);