From c2cce6bafaabe8b2b32c42fc885c7e6a09586c8f Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Mon, 4 Mar 2019 13:20:34 +0800 Subject: [PATCH] simplify parameter send and recv --- paddle/fluid/operators/distributed/communicator.cc | 10 +++++----- paddle/fluid/operators/distributed_ops/recv_op.cc | 6 ------ paddle/fluid/operators/distributed_ops/send_op.cc | 6 ------ 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/paddle/fluid/operators/distributed/communicator.cc b/paddle/fluid/operators/distributed/communicator.cc index fb9ecfa8081..bc0a57f3446 100644 --- a/paddle/fluid/operators/distributed/communicator.cc +++ b/paddle/fluid/operators/distributed/communicator.cc @@ -74,9 +74,9 @@ void Communicator::SendThread() { merged_var_num++; } MergeVars(var_name, vars, send_scope_.get()); - auto send_functor = distributed::ParameterSend(); - // send_functor(var_name, send_varname_to_ctx_[var_name], exe_ctx, - // send_scope_, true); + // auto send_functor = distributed::ParameterSend(); + // send_functor(var_name, send_varname_to_ctx_[var_name], exe_ctx, + // send_scope_, true); } } @@ -85,8 +85,8 @@ void Communicator::RecvThread() { for (auto &iter : recv_varname_to_ctx_) { auto &var_name = iter.first; VLOG(3) << "recv var " << iter.first; - auto recv_functor = distributed::ParameterRecv(); - // recv_functor(var_name, iter.second, exe_ctx, recv_scope_); + // auto recv_functor = distributed::ParameterRecv(); + // recv_functor(var_name, iter.second, exe_ctx, recv_scope_); } } diff --git a/paddle/fluid/operators/distributed_ops/recv_op.cc b/paddle/fluid/operators/distributed_ops/recv_op.cc index 41701d3a3e5..680b484d413 100644 --- a/paddle/fluid/operators/distributed_ops/recv_op.cc +++ b/paddle/fluid/operators/distributed_ops/recv_op.cc @@ -54,12 +54,6 @@ class RecvOp : public framework::OperatorBase { Attr>("recv_varnames"); if (recv_varnames.size() > 0) { - framework::RuntimeContext ctx(Inputs(), Outputs(), scope); - platform::DeviceContextPool &pool = - platform::DeviceContextPool::Instance(); - auto *dev_ctx = pool.Get(place); - auto exe_ctx = - framework::ExecutionContext(*this, scope, *dev_ctx, ctx, nullptr); auto recv_functor = distributed::ParameterRecv(); auto rpc_ctx = distributed::RpcContext(outs[0], recv_varnames, epmap, {}); recv_functor(rpc_ctx, scope); diff --git a/paddle/fluid/operators/distributed_ops/send_op.cc b/paddle/fluid/operators/distributed_ops/send_op.cc index 5585ad21cea..8b09cf86d7d 100644 --- a/paddle/fluid/operators/distributed_ops/send_op.cc +++ b/paddle/fluid/operators/distributed_ops/send_op.cc @@ -47,12 +47,6 @@ class SendOp : public framework::OperatorBase { if (send_varnames.size() > 0) { PADDLE_ENFORCE_EQ(ins.size(), 1, ""); - framework::RuntimeContext ctx(Inputs(), Outputs(), scope); - platform::DeviceContextPool& pool = - platform::DeviceContextPool::Instance(); - auto* dev_ctx = pool.Get(place); - auto exe_ctx = - framework::ExecutionContext(*this, scope, *dev_ctx, ctx, nullptr); auto send_functor = distributed::ParameterSend(); auto rpc_ctx = distributed::RpcContext(ins[0], send_varnames, epmap, height_sections); -- GitLab