From a0b59773af160930085e8a60630ef9ef67f9e912 Mon Sep 17 00:00:00 2001 From: dongdaxiang Date: Sat, 23 Mar 2019 15:00:11 +0800 Subject: [PATCH] fix code style --- paddle/fluid/framework/async_executor.cc | 3 +-- paddle/fluid/framework/fleet/fleet_wrapper.h | 17 ++++++++--------- paddle/fluid/framework/io/shell.cc | 2 +- paddle/fluid/framework/io/shell.h | 4 ++++ paddle/fluid/platform/lodtensor_printer_test.cc | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/paddle/fluid/framework/async_executor.cc b/paddle/fluid/framework/async_executor.cc index b2423694d..b13eefba2 100644 --- a/paddle/fluid/framework/async_executor.cc +++ b/paddle/fluid/framework/async_executor.cc @@ -155,8 +155,7 @@ void AsyncExecutor::RunFromFile(const ProgramDesc& main_program, } #ifdef PADDLE_WITH_PSLIB if (mode == "mpi") { - // todo ? - //_pull_dense_thread->stop(); + _pull_dense_thread->stop(); } #endif VLOG(3) << "start to run from files in async_executor"; diff --git a/paddle/fluid/framework/fleet/fleet_wrapper.h b/paddle/fluid/framework/fleet/fleet_wrapper.h index 6090ec753..7a60686c2 100644 --- a/paddle/fluid/framework/fleet/fleet_wrapper.h +++ b/paddle/fluid/framework/fleet/fleet_wrapper.h @@ -21,13 +21,14 @@ limitations under the License. */ #endif #include #include +#include #include #include #include +#include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/variable_helper.h" #include "paddle/fluid/platform/macros.h" // for DISABLE_COPY_AND_ASSIGN -#include "paddle/fluid/framework/program_desc.h" namespace paddle { namespace framework { @@ -72,9 +73,8 @@ class FleetWrapper { const std::vector& var_names, std::vector<::std::future>* pull_dense_status); - void PushDenseParamSync( - const ProgramDesc& program, const uint64_t table_id, - const std::vector& var_names); + void PushDenseParamSync(const ProgramDesc& program, const uint64_t table_id, + const std::vector& var_names); // Push dense variables to server in async mode // Param: scope, table_id, var_names, @@ -122,13 +122,12 @@ class FleetWrapper { uint64_t RunServer(); void GatherServers(const std::vector& host_sign_list, int node_num); - typedef std::function MsgHandlerFunc; + typedef std::function MsgHandlerFunc; int RegisterClientToClientMsgHandler(int msg_type, MsgHandlerFunc handler); - std::future SendClientToClientMsg(int msg_type, - int to_client_id, - const std::string& msg); - std::default_random_engine& LocalRandomEngine(); + std::future SendClientToClientMsg(int msg_type, int to_client_id, + const std::string& msg); + std::default_random_engine& LocalRandomEngine(); template void Serialize(const std::vector& t, std::string* str); template diff --git a/paddle/fluid/framework/io/shell.cc b/paddle/fluid/framework/io/shell.cc index 47de5c650..42f513fef 100644 --- a/paddle/fluid/framework/io/shell.cc +++ b/paddle/fluid/framework/io/shell.cc @@ -197,7 +197,7 @@ std::shared_ptr shell_popen(const std::string& cmd, static int shell_p2open_fork_internal(const char* real_cmd, int pipein_fds[2], int pipeout_fds[2]) { -#ifndef +#ifndef _WIN32 int child_pid = -1; if ((child_pid = fork()) < 0) { return -1; diff --git a/paddle/fluid/framework/io/shell.h b/paddle/fluid/framework/io/shell.h index effaa1e99..5c56417da 100644 --- a/paddle/fluid/framework/io/shell.h +++ b/paddle/fluid/framework/io/shell.h @@ -16,7 +16,11 @@ #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include #include #include diff --git a/paddle/fluid/platform/lodtensor_printer_test.cc b/paddle/fluid/platform/lodtensor_printer_test.cc index f0618c921..0afc70fcf 100644 --- a/paddle/fluid/platform/lodtensor_printer_test.cc +++ b/paddle/fluid/platform/lodtensor_printer_test.cc @@ -18,7 +18,7 @@ TEST(LodTensorPrinter, PrintVar) { paddle::framework::Scope scope; - PrintVar(&scope, "NotAVar", "We don't have var"); + paddle::platform::PrintVar(&scope, "NotAVar", "We don't have var"); paddle::framework::Variable* v = scope.Var("NotAVar"); - PrintVar(&scope, "NotAVar", "Now we have a var"); + paddle::platform::PrintVar(&scope, "NotAVar", "Now we have a var"); } -- GitLab