未验证 提交 287de41c 编写于 作者: Q Qiao Longfei 提交者: GitHub

Optimize communicator flags (#17494)

* optimize communicator flag

* change flags in init py test=develop
上级 9eb19df2
...@@ -29,7 +29,7 @@ DEFINE_bool(communicator_independent_recv_thread, true, ...@@ -29,7 +29,7 @@ DEFINE_bool(communicator_independent_recv_thread, true,
"use an independent to recv vars from parameter server"); "use an independent to recv vars from parameter server");
DEFINE_int32(communicator_send_queue_size, 20, DEFINE_int32(communicator_send_queue_size, 20,
"queue size to recv gradient before send"); "queue size to recv gradient before send");
DEFINE_int32(communicator_max_send_grad_num_before_recv, 20, DEFINE_int32(communicator_min_send_grad_num_before_recv, 20,
"max grad num to send before recv parameters"); "max grad num to send before recv parameters");
DEFINE_int32(communicator_thread_pool_size, 5, "thread num to do send or recv"); DEFINE_int32(communicator_thread_pool_size, 5, "thread num to do send or recv");
DEFINE_int32(communicator_send_wait_times, 5, DEFINE_int32(communicator_send_wait_times, 5,
...@@ -64,8 +64,8 @@ Communicator::Communicator(const RpcCtxMap &send_varname_to_ctx, ...@@ -64,8 +64,8 @@ Communicator::Communicator(const RpcCtxMap &send_varname_to_ctx,
<< FLAGS_communicator_independent_recv_thread; << FLAGS_communicator_independent_recv_thread;
VLOG(0) << "communicator_send_queue_size: " VLOG(0) << "communicator_send_queue_size: "
<< FLAGS_communicator_send_queue_size; << FLAGS_communicator_send_queue_size;
VLOG(0) << "communicator_max_send_grad_num_before_recv: " VLOG(0) << "communicator_min_send_grad_num_before_recv: "
<< FLAGS_communicator_max_send_grad_num_before_recv; << FLAGS_communicator_min_send_grad_num_before_recv;
VLOG(0) << "communicator_thread_pool_size: " VLOG(0) << "communicator_thread_pool_size: "
<< FLAGS_communicator_thread_pool_size; << FLAGS_communicator_thread_pool_size;
VLOG(0) << "communicator_send_wait_times: " VLOG(0) << "communicator_send_wait_times: "
...@@ -189,7 +189,7 @@ void Communicator::RecvThread() { ...@@ -189,7 +189,7 @@ void Communicator::RecvThread() {
VLOG(3) << "RecvThread start!"; VLOG(3) << "RecvThread start!";
while (running_) { while (running_) {
auto grad_num = grad_num_.load(); auto grad_num = grad_num_.load();
if (grad_num > FLAGS_communicator_max_send_grad_num_before_recv) { if (grad_num > FLAGS_communicator_min_send_grad_num_before_recv) {
VLOG(1) << "current grad num " << grad_num; VLOG(1) << "current grad num " << grad_num;
RecvAll(); RecvAll();
grad_num_.store(0); grad_num_.store(0);
......
...@@ -167,7 +167,7 @@ def __bootstrap__(): ...@@ -167,7 +167,7 @@ def __bootstrap__():
# env for communicator # env for communicator
read_env_flags.append('communicator_independent_recv_thread') read_env_flags.append('communicator_independent_recv_thread')
read_env_flags.append('communicator_send_queue_size') read_env_flags.append('communicator_send_queue_size')
read_env_flags.append('communicator_max_send_grad_num_before_recv') read_env_flags.append('communicator_min_send_grad_num_before_recv')
read_env_flags.append('communicator_thread_pool_size') read_env_flags.append('communicator_thread_pool_size')
read_env_flags.append('communicator_max_merge_var_num') read_env_flags.append('communicator_max_merge_var_num')
read_env_flags.append('communicator_fake_rpc') read_env_flags.append('communicator_fake_rpc')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册