Commit 93aa608f authored by TousakaRin's avatar TousakaRin

Change the position of min_reduce_ratio

parent 34594d97
...@@ -243,6 +243,19 @@ void GradientConcurrencyLimiter::UpdateConcurrency() { ...@@ -243,6 +243,19 @@ void GradientConcurrencyLimiter::UpdateConcurrency() {
next_concurrency = std::ceil( next_concurrency = std::ceil(
(max_concurrency * smooth + next_concurrency * (100 - smooth)) / 100); (max_concurrency * smooth + next_concurrency * (100 - smooth)) / 100);
double min_reduce_ratio = FLAGS_gradient_cl_min_reduce_ratio;
if (min_reduce_ratio <= 0.0 || min_reduce_ratio >= 1.0) {
LOG(INFO)
<< "GFLAG `gradient_cl_min_reduce_ratio' should "
<< "be 0-1, current:" << FLAGS_gradient_cl_min_reduce_ratio
<< " , will compute with the default value(0.5)";
min_reduce_ratio = 50;
}
next_concurrency = std::max(
next_concurrency, int32_t(max_concurrency * min_reduce_ratio));
next_concurrency = std::max(
next_concurrency, int32_t(safe_concurrency * min_reduce_ratio));
if (current_concurrency + reserved_concurrency < max_concurrency && if (current_concurrency + reserved_concurrency < max_concurrency &&
max_concurrency < next_concurrency) { max_concurrency < next_concurrency) {
LOG(INFO) LOG(INFO)
...@@ -258,7 +271,8 @@ void GradientConcurrencyLimiter::UpdateConcurrency() { ...@@ -258,7 +271,8 @@ void GradientConcurrencyLimiter::UpdateConcurrency() {
for (size_t i = 0; i < _ws_queue.size(); ++i) { for (size_t i = 0; i < _ws_queue.size(); ++i) {
const WindowSnap& snap = *(_ws_queue.bottom(i)); const WindowSnap& snap = *(_ws_queue.bottom(i));
if (current_concurrency > snap.actual_concurrency && if (current_concurrency > snap.actual_concurrency &&
total_succ_req < snap.total_succ_req) { total_succ_req < snap.total_succ_req &&
avg_latency > snap.avg_latency_us) {
int32_t fixed_next_concurrency = int32_t fixed_next_concurrency =
std::ceil(snap.actual_concurrency * std::ceil(snap.actual_concurrency *
snap.avg_latency_us / avg_latency); snap.avg_latency_us / avg_latency);
...@@ -268,19 +282,6 @@ void GradientConcurrencyLimiter::UpdateConcurrency() { ...@@ -268,19 +282,6 @@ void GradientConcurrencyLimiter::UpdateConcurrency() {
} }
} }
double min_reduce_ratio = FLAGS_gradient_cl_min_reduce_ratio;
if (min_reduce_ratio <= 0.0 || min_reduce_ratio >= 1.0) {
LOG(INFO)
<< "GFLAG `gradient_cl_min_reduce_ratio' should "
<< "be 0-1, current:" << FLAGS_gradient_cl_min_reduce_ratio
<< " , will compute with the default value(0.5)";
min_reduce_ratio = 50;
}
next_concurrency = std::max(
next_concurrency, int32_t(max_concurrency * min_reduce_ratio));
next_concurrency = std::max(
next_concurrency, int32_t(safe_concurrency * min_reduce_ratio));
LOG(INFO) LOG(INFO)
<< "Update max_concurrency by gradient limiter:" << "Update max_concurrency by gradient limiter:"
<< " pre_max_concurrency:" << max_concurrency << " pre_max_concurrency:" << max_concurrency
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment