From d3a14377d5cf0376a5f0170406fecd336e3fc41a Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Mon, 11 Mar 2019 15:08:38 +0800 Subject: [PATCH] add fake rpc to send --- .../operators/distributed/communicator.cc | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/paddle/fluid/operators/distributed/communicator.cc b/paddle/fluid/operators/distributed/communicator.cc index 6acb572de9..d3b77a758c 100644 --- a/paddle/fluid/operators/distributed/communicator.cc +++ b/paddle/fluid/operators/distributed/communicator.cc @@ -191,15 +191,17 @@ void Communicator::RecvThread() { void Communicator::Send(const std::string &var_name, const framework::Scope &scope) { - VLOG(3) << "communicator send " << var_name; - // push var into send queue by var_name - auto *grad_var = scope.FindVar(var_name); - PADDLE_ENFORCE(grad_var->IsInitialized(), "grad var should be inited"); - auto tmp_grad_var = std::make_shared(); - framework::CopyVariable(*grad_var, tmp_grad_var.get()); - auto &queue = send_varname_to_queue_.at(var_name); - VLOG(3) << "send " << var_name << " queue size " << queue->Size(); - queue->Push(tmp_grad_var); + if (!FLAGS_communicator_fake_rpc) { + VLOG(3) << "communicator send " << var_name; + // push var into send queue by var_name + auto *grad_var = scope.FindVar(var_name); + PADDLE_ENFORCE(grad_var->IsInitialized(), "grad var should be inited"); + auto tmp_grad_var = std::make_shared(); + framework::CopyVariable(*grad_var, tmp_grad_var.get()); + auto &queue = send_varname_to_queue_.at(var_name); + VLOG(3) << "send " << var_name << " queue size " << queue->Size(); + queue->Push(tmp_grad_var); + } } Communicator *Communicator::GetInstance() { return communicator_.get(); } -- GitLab