提交 79c6001a 编写于 作者: S seiriosPlus

rename communicator meet->BatchesCounter

上级 db272ca5
...@@ -157,16 +157,18 @@ void AsyncCommunicator::MainThread() { ...@@ -157,16 +157,18 @@ void AsyncCommunicator::MainThread() {
} }
while (running_) { while (running_) {
int meet = Meet(); int batches = BatchesCounter();
VLOG(1) << "async_meet: " << meet; if (batches > 0) {
SendGlobalStep(batches);
SendGlobalStep(meet); SendByCommunicator(batches);
SendByCommunicator(meet); BarrierSend();
BarrierSend(); RecvByCommunicator();
RecvByCommunicator(); BarrierRecv();
BarrierRecv(); BarrierWeakUp();
BarrierWeakUp(); } else {
VLOG(1) << "get nothing from sending queue, will skip send/recv";
}
} }
VLOG(1) << "communicator stopped, send thread exit"; VLOG(1) << "communicator stopped, send thread exit";
} }
...@@ -197,7 +199,7 @@ void AsyncCommunicator::RecvNoBarrier() { ...@@ -197,7 +199,7 @@ void AsyncCommunicator::RecvNoBarrier() {
} }
} }
int AsyncCommunicator::Meet() { int AsyncCommunicator::BatchesCounter() {
auto &step_queue = send_varname_to_queue_.at(STEP_COUNTER); auto &step_queue = send_varname_to_queue_.at(STEP_COUNTER);
size_t merged_var_num = 0; size_t merged_var_num = 0;
...@@ -316,7 +318,7 @@ void HalfAsyncCommunicator::Clean() { ...@@ -316,7 +318,7 @@ void HalfAsyncCommunicator::Clean() {
} }
} }
int HalfAsyncCommunicator::Meet() { int HalfAsyncCommunicator::BatchesCounter() {
while (running_) { while (running_) {
if (barrier_counter_.load() >= barrier_trigger_.load() && if (barrier_counter_.load() >= barrier_trigger_.load() &&
barrier_trigger_.load() != 0) { barrier_trigger_.load() != 0) {
......
...@@ -293,7 +293,7 @@ class AsyncCommunicator : public Communicator { ...@@ -293,7 +293,7 @@ class AsyncCommunicator : public Communicator {
virtual void RecvNoBarrier(); virtual void RecvNoBarrier();
virtual int Meet(); virtual int BatchesCounter();
virtual void BarrierSend() {} virtual void BarrierSend() {}
...@@ -350,7 +350,7 @@ class HalfAsyncCommunicator : public AsyncCommunicator { ...@@ -350,7 +350,7 @@ class HalfAsyncCommunicator : public AsyncCommunicator {
void BarrierTriggerReset(int initial_val) override; void BarrierTriggerReset(int initial_val) override;
int Meet(); int BatchesCounter();
void BarrierWeakUp(); void BarrierWeakUp();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册