Skip to content

Commit 37410a0

Browse files
committed
update by comment
1 parent 029425a commit 37410a0

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

paddle/fluid/framework/executor.cc

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,15 @@ Executor::Executor(const platform::Place& place) : place_(place) {}
4747

4848
#ifdef PADDLE_WITH_DISTRIBUTE
4949
void Executor::BeginPass() {
50-
auto client = ::paddle::operators::distributed::RPCClient::GetInstance<
51-
::paddle::operators::distributed::GRPCClient>();
52-
53-
client->SendBeginPass();
54-
client->Wait();
50+
::paddle::operators::distributed::RPCClient::GetInstance<
51+
::paddle::operators::distributed::GRPCClient>()
52+
->SendBeginPass();
5553
}
5654

5755
void Executor::EndPass() {
58-
auto client = ::paddle::operators::distributed::RPCClient::GetInstance<
59-
::paddle::operators::distributed::GRPCClient>();
60-
61-
client->SendEndPass();
62-
client->Wait();
56+
::paddle::operators::distributed::RPCClient::GetInstance<
57+
::paddle::operators::distributed::GRPCClient>()
58+
->SendEndPass();
6359
}
6460
#endif
6561

paddle/fluid/operators/distributed/grpc_client.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ void GRPCClient::SendBeginPass() {
4040
VLOG(3) << "send begin pass to: " << it.first;
4141
this->AsyncSendBeginPass(it.first);
4242
}
43+
this->Wait();
4344
}
4445

4546
void GRPCClient::SendEndPass() {
4647
for (auto& it : channels_) {
4748
VLOG(3) << "send end pass to " << it.first;
4849
this->AsyncSendEndPass(it.first);
4950
}
51+
this->Wait();
5052
}
5153

5254
GRPCClient::~GRPCClient() {

paddle/fluid/operators/distributed/rpc_server.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void RPCServer::IncreaseBatchBarrier(const std::string rpc_name) {
6767
void RPCServer::BeginPass() {
6868
VLOG(4) << "RPCServer begin increase pass barrier";
6969
{
70-
std::unique_lock<std::mutex> locl(mutex_);
70+
std::unique_lock<std::mutex> lock(mutex_);
7171
client_num_++;
7272
VLOG(4) << "increase client_num to: " << client_num_;
7373
}
@@ -77,7 +77,7 @@ void RPCServer::BeginPass() {
7777
void RPCServer::EndPass() {
7878
VLOG(4) << "RPCServer begin increase pass barrier";
7979
{
80-
std::unique_lock<std::mutex> locl(mutex_);
80+
std::unique_lock<std::mutex> lock(mutex_);
8181
client_num_--;
8282
VLOG(4) << "decrease client_num to: " << client_num_;
8383
if (cur_cond_.load() == rpc_cond_map_[kRequestGet]) {

0 commit comments

Comments
 (0)