提交 5a0c6593 编写于 作者: Q Qiao Longfei

revert RequestGetHandler

上级 84220765
...@@ -100,25 +100,21 @@ bool RequestGetHandler::Handle(const std::string& varname, ...@@ -100,25 +100,21 @@ bool RequestGetHandler::Handle(const std::string& varname,
} }
} else { } else {
if (varname != FETCH_BARRIER_MESSAGE && varname != COMPLETE_MESSAGE) { if (varname != FETCH_BARRIER_MESSAGE && varname != COMPLETE_MESSAGE) {
PADDLE_THROW( if (enable_dc_asgd_) {
"async mode should not send FETCH_BARRIER_MESSAGE or " // NOTE: the format is determined by distributed_transpiler.py
"COMPLETE_MESSAGE"); std::string param_bak_name =
} string::Sprintf("%s.trainer_%d_bak", varname, trainer_id);
VLOG(3) << "getting " << param_bak_name << " trainer_id " << trainer_id;
if (enable_dc_asgd_) { auto var = scope_->FindVar(varname);
// NOTE: the format is determined by distributed_transpiler.py auto t_orig = var->Get<framework::LoDTensor>();
std::string param_bak_name = auto param_bak = scope_->Var(param_bak_name);
string::Sprintf("%s.trainer_%d_bak", varname, trainer_id); auto t = param_bak->GetMutable<framework::LoDTensor>();
VLOG(3) << "getting " << param_bak_name << " trainer_id " << trainer_id; t->mutable_data(dev_ctx_->GetPlace(), t_orig.type());
auto var = scope_->FindVar(varname); VLOG(3) << "copying " << varname << " to " << param_bak_name;
auto t_orig = var->Get<framework::LoDTensor>(); framework::TensorCopy(t_orig, dev_ctx_->GetPlace(), t);
auto param_bak = scope_->Var(param_bak_name); }
auto t = param_bak->GetMutable<framework::LoDTensor>(); *outvar = scope_->FindVar(varname);
t->mutable_data(dev_ctx_->GetPlace(), t_orig.type());
VLOG(3) << "copying " << varname << " to " << param_bak_name;
framework::TensorCopy(t_orig, dev_ctx_->GetPlace(), t);
} }
*outvar = scope_->FindVar(varname);
} }
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册