From 8ce2482b8011536edee493590808411de8839582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=99=93=E4=BC=9F?= <39303645+Shixiaowei02@users.noreply.github.com> Date: Mon, 11 Jan 2021 16:08:45 +0800 Subject: [PATCH] fix header file paths of gflags, commit 1, test=develop (#30271) --- .../fluid/distributed/service/communicator.cc | 24 +++++++++---------- paddle/fluid/distributed/service/env.h | 17 ++++++------- .../fluid/distributed/table/depends/dense.h | 2 +- .../distributed/table/depends/initializers.h | 2 +- .../table/depends/large_scale_kv.h | 2 +- .../fluid/distributed/table/depends/sparse.h | 2 +- paddle/fluid/framework/operator.cc | 2 +- paddle/fluid/framework/unused_var_check.cc | 2 +- paddle/fluid/framework/unused_var_check.h | 2 +- paddle/fluid/imperative/profiler.cc | 2 +- paddle/fluid/inference/analysis/analyzer.h | 2 +- paddle/fluid/inference/analysis/flags.h | 4 +++- paddle/fluid/inference/analysis/ut_helper.h | 2 +- .../api/demo_ci/simple_on_word2vec.cc | 2 +- .../api/demo_ci/trt_mobilenet_demo.cc | 2 +- 15 files changed, 36 insertions(+), 33 deletions(-) diff --git a/paddle/fluid/distributed/service/communicator.cc b/paddle/fluid/distributed/service/communicator.cc index f0322a0cbe8..57b3636dee7 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 42f31717f7f..e80cbe5da66 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 209595de7e6..a2acdfd2014 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 8d45e83f92d..e8857ed5156 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 79a4c4700a9..9ab3711fe2e 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 1900da32155..4ee753fc75a 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 9c29c938afd..dcaebc10a74 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 dc206328246..2826014f506 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 d78b4d928f3..7d612d9316c 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 85063a68216..6d0f6a12f52 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 a6de18db600..4db54706285 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 717e543f01d..ea0406128b5 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 d599099a805..56565c8f3f7 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 3dd1d3c838c..166b84f2829 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 f9d747c1f04..4498a1bef20 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); -- GitLab