Skip to content

Commit 9c3910f

Browse files
committed
IncreaseBatchBarrier should be in the right condition test=develop
1 parent 5a0c659 commit 9c3910f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

paddle/fluid/operators/distributed/rpc_server.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ void RPCServer::WaitBarrier(const std::string& rpc_name) {
5656

5757
void RPCServer::IncreaseBatchBarrier(const std::string rpc_name) {
5858
VLOG(3) << "RPCServer begin IncreaseBatchBarrier " << rpc_name;
59+
// barrier msg should make sure that it's in the right cond(send|recv)
60+
WaitCond(rpc_name);
5961
int b = 0;
6062
std::unique_lock<std::mutex> lock(mutex_);
6163
b = ++barrier_counter_[rpc_name];
@@ -124,7 +126,7 @@ void RPCServer::SetCond(const std::string& rpc_name) {
124126
}
125127

126128
void RPCServer::WaitCond(const std::string& rpc_name) {
127-
VLOG(3) << "RPCServer WaitCond " << rpc_name;
129+
VLOG(3) << "RPCServer WaitCond in " << rpc_name;
128130
int cond = 0;
129131
{
130132
std::unique_lock<std::mutex> lock(mutex_);
@@ -134,6 +136,7 @@ void RPCServer::WaitCond(const std::string& rpc_name) {
134136
std::unique_lock<std::mutex> lock(mutex_);
135137
rpc_cond_.wait(
136138
lock, [=] { return (cur_cond_.load() == cond || exit_flag_.load()); });
139+
VLOG(3) << "RPCServer WaitCond out " << rpc_name;
137140
}
138141

139142
void RPCServer::RegisterVar(const std::string& var_name,

0 commit comments

Comments
 (0)