提交 fe6a8409 编写于 作者: Q Qiao Longfei

fix delete recv ops

上级 446fdf95
...@@ -48,9 +48,9 @@ void ProcessGraph(std::vector<ir::Graph *> graphs, Scope *scope) { ...@@ -48,9 +48,9 @@ void ProcessGraph(std::vector<ir::Graph *> graphs, Scope *scope) {
RpcCtxMap send_varname_to_ctx; RpcCtxMap send_varname_to_ctx;
RpcCtxMap recv_varname_to_ctx; RpcCtxMap recv_varname_to_ctx;
for (auto i = 0; i < graphs.size(); ++i) { for (auto i = 0; i < graphs.size(); ++i) {
std::vector<ir::Node *> nodes_to_delete;
for (auto &node : graphs[i]->Nodes()) { for (auto &node : graphs[i]->Nodes()) {
VLOG(3) << "node name " << node->Name(); VLOG(3) << "node name " << node->Name();
std::vector<ir::Node *> nodes_to_delete;
if (node && node->IsOp()) { if (node && node->IsOp()) {
if (node->Name() == "send") { if (node->Name() == "send") {
auto send_var_name = node->Op()->Input("X")[0]; auto send_var_name = node->Op()->Input("X")[0];
...@@ -78,13 +78,13 @@ void ProcessGraph(std::vector<ir::Graph *> graphs, Scope *scope) { ...@@ -78,13 +78,13 @@ void ProcessGraph(std::vector<ir::Graph *> graphs, Scope *scope) {
VLOG(3) << "find and remove an recv op: " VLOG(3) << "find and remove an recv op: "
<< recv_varname_to_ctx[recv_var_name]; << recv_varname_to_ctx[recv_var_name];
} }
}
}
VLOG(3) << "delete all recv ops"; VLOG(3) << "delete all recv ops";
for (auto *node : nodes_to_delete) { for (auto *node : nodes_to_delete) {
graphs[i]->RemoveNode(node); graphs[i]->RemoveNode(node);
} }
} }
}
}
// init communicator here // init communicator here
if (send_varname_to_ctx.size() > 0) { if (send_varname_to_ctx.size() > 0) {
VLOG(3) << "this is distribute mode, will use communicator"; VLOG(3) << "this is distribute mode, will use communicator";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册