From 3225e195912b1c467558bce192c6468d7f0e8540 Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Thu, 7 Mar 2019 14:54:59 +0800 Subject: [PATCH] fix remove recv op --- .../details/async_ssa_graph_executor.cc | 21 +++++++++++++++++++ .../operators/distributed/communicator.cc | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/details/async_ssa_graph_executor.cc b/paddle/fluid/framework/details/async_ssa_graph_executor.cc index e7cc14b0d..b36ed8af9 100644 --- a/paddle/fluid/framework/details/async_ssa_graph_executor.cc +++ b/paddle/fluid/framework/details/async_ssa_graph_executor.cc @@ -82,6 +82,27 @@ 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); } } diff --git a/paddle/fluid/operators/distributed/communicator.cc b/paddle/fluid/operators/distributed/communicator.cc index 506c5fbeb..f5d274b66 100644 --- a/paddle/fluid/operators/distributed/communicator.cc +++ b/paddle/fluid/operators/distributed/communicator.cc @@ -31,7 +31,7 @@ namespace distributed { static inline void MergeVars(const std::string &var_name, const std::vector> &vars, Scope *scope) { - VLOG(3) << "merge " << vars.size() << " vars " << var_name << " to one"; + VLOG(3) << "merge " << vars.size() << " vars " << var_name << " to 1"; PADDLE_ENFORCE(!vars.empty(), "should have value to merge!"); auto cpu_place = platform::CPUPlace(); auto &var0 = vars[0]; -- GitLab