From b542639dc04f55584a70cb44413ca4ba9c8f2abe Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Wed, 27 Mar 2019 15:58:52 +0800 Subject: [PATCH] code clean test=develop --- .../details/async_ssa_graph_executor.cc | 27 ------------------- .../operators/distributed_ops/send_op.cc | 17 ++++++------ 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/paddle/fluid/framework/details/async_ssa_graph_executor.cc b/paddle/fluid/framework/details/async_ssa_graph_executor.cc index 12822c64e9f..5ca676ccdeb 100644 --- a/paddle/fluid/framework/details/async_ssa_graph_executor.cc +++ b/paddle/fluid/framework/details/async_ssa_graph_executor.cc @@ -80,33 +80,6 @@ void ProcessGraph(std::vector graphs, Scope *scope) { } } } - /* - VLOG(3) << "delete all recv ops"; - for (auto *node : nodes_to_delete) { - // delete input edge - for (auto *in : node->inputs) { - auto &in_outs = in->outputs; - for (auto iter = in_outs.begin(); iter != in_outs.end();) { - if (*iter == node) { - VLOG(3) << "delete input edge from " << in->Name() << " for " - << node->Name(); - iter = in_outs.erase(iter); - } else { - ++iter; - } - } - } - // delete output edge - for (auto *out : node->outputs) { - PADDLE_ENFORCE_EQ(out->outputs.size(), 0, "%s should have no outputs", - out->Name()); - VLOG(3) << "delete output edge to " << out->Name(); - graphs[i]->RemoveNode(out); - } - VLOG(3) << "delete node " << node->Name(); - graphs[i]->RemoveNode(node); - } - */ } // init communicator here if (send_varname_to_ctx.size() > 0) { diff --git a/paddle/fluid/operators/distributed_ops/send_op.cc b/paddle/fluid/operators/distributed_ops/send_op.cc index 67de7b4185b..47688d0ad45 100644 --- a/paddle/fluid/operators/distributed_ops/send_op.cc +++ b/paddle/fluid/operators/distributed_ops/send_op.cc @@ -48,15 +48,14 @@ class SendOp : public framework::OperatorBase { if (send_varnames.size() > 0) { PADDLE_ENFORCE_EQ(ins.size(), 1, ""); - /* - auto send_functor = distributed::ParameterSend(); - auto rpc_ctx = distributed::RpcContext(ins[0], send_varnames, epmap, - height_sections); - send_functor(rpc_ctx, scope, static_cast(sync_send)); - */ - VLOG(3) << "send " << ins[0]; - distributed::Communicator::GetInstance()->Send(ins[0], scope); - VLOG(3) << "send " << ins[0] << " done"; + if (distributed::Communicator::GetInstance() == nullptr) { + auto send_functor = distributed::ParameterSend(); + auto rpc_ctx = distributed::RpcContext(ins[0], send_varnames, epmap, + height_sections); + send_functor(rpc_ctx, scope, static_cast(sync_send)); + } else { + distributed::Communicator::GetInstance()->Send(ins[0], scope); + } } else { platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance(); -- GitLab