From 2ee516192dbde25de303f2f00ef51814a248a1c4 Mon Sep 17 00:00:00 2001 From: seiriosPlus Date: Fri, 21 Aug 2020 18:15:52 +0800 Subject: [PATCH] optimize init from pserver --- paddle/fluid/operators/distributed/communicator.cc | 4 ++-- paddle/fluid/operators/distributed/parameter_recv.cc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/operators/distributed/communicator.cc b/paddle/fluid/operators/distributed/communicator.cc index 993bf6c988e..a0ac82a6f4a 100644 --- a/paddle/fluid/operators/distributed/communicator.cc +++ b/paddle/fluid/operators/distributed/communicator.cc @@ -449,7 +449,7 @@ void GeoCommunicator::InitImpl(const RpcCtxMap &send_varname_to_ctx, old_scope_.reset(new Scope()); pserver_scope_.reset(new Scope()); - Init(); + InitParams(); } void GeoCommunicator::Send(const std::vector &var_names, @@ -822,7 +822,7 @@ void GeoCommunicator::InitSparse() { paddle::platform::CPUDeviceContext()); for (auto &id : ids) { - blas.VCOPY(dim1, global_value.data() + k * width, + blas.VCOPY(dim1, global_value.data() + id * dim1, values[id][0]->data()); } } diff --git a/paddle/fluid/operators/distributed/parameter_recv.cc b/paddle/fluid/operators/distributed/parameter_recv.cc index fa68562b08c..3b8479c91b0 100644 --- a/paddle/fluid/operators/distributed/parameter_recv.cc +++ b/paddle/fluid/operators/distributed/parameter_recv.cc @@ -60,7 +60,7 @@ void RecvSparseLodTensor(const CommContext &rpc_ctx, // sparse param in recv_scope is LoDTensor rets.push_back(rpc_client->AsyncGetVarNoBarrier( rpc_ctx.epmap[i], cpu_ctx, *local_scope.get(), recv_var_name, - recv_var_name, recv_var_name)); + recv_var_name)); const auto *value = local_var->Get().data(); tensors.push_back(value); @@ -88,7 +88,7 @@ void RecvSparseLodTensor(const CommContext &rpc_ctx, "recved var must has same dims with local var"); auto *merged_t = merged_var->GetMutable(); - auto *merged_d = merged_t->mutable_data(place)(); + auto *merged_d = merged_t->mutable_data(cpu_place); auto pserver_num = rpc_ctx.splited_varnames.size(); for (int x = 0; x < height; ++x) { @@ -220,9 +220,9 @@ void ParameterRecv::operator()(const CommContext &rpc_ctx, if (rpc_ctx.is_sparse) { if (geo_records) { - RecvGeoSparseRecords()(rpc_ctx, scope); + RecvGeoSparseRecords(rpc_ctx, scope); } else { - RecvSparseLodTensor()(rpc_ctx, scope); + RecvSparseLodTensor(rpc_ctx, scope); } } else { RecvLodTensor(rpc_ctx, scope); -- GitLab