提交 f82cb635 编写于 作者: Q qiaolongfei

optimize code, add more log

上级 98a2179f
......@@ -336,9 +336,9 @@ void AsyncGRPCServer::HandleRequest(::grpc::ServerCompletionQueue* cq,
switch (base->Status()) {
case PROCESS: {
VLOG(4) << cq_name << " PROCESS status:" << base->Status();
TryToRegisterNewOne();
base->Process();
VLOG(4) << cq_name << " PROCESS status:" << base->Status();
break;
}
case FINISH: {
......
......@@ -188,9 +188,11 @@ void ListenAndServOp::RunSyncLoop(framework::Executor *executor,
}
static void AsyncUpdateThread(
const bool &exit_flag, const std::shared_ptr<detail::ReceivedQueue> &queue,
const std::string &var_name, const bool &exit_flag,
const std::shared_ptr<detail::ReceivedQueue> &queue,
framework::Executor *executor,
framework::ExecutorPrepareContext *prepared) {
VLOG(3) << "update thread for " << var_name << " started";
while (!exit_flag) {
const detail::ReceivedMessage v = queue->Pop();
auto recv_var_name = v.first;
......@@ -206,6 +208,7 @@ static void AsyncUpdateThread(
LOG(ERROR) << "run sub program error " << e.what();
}
}
VLOG(3) << "update thread for " << var_name << " ended";
}
void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
......@@ -246,7 +249,6 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
grad_to_prepared_ctx[id_to_grad[block_list[i]]] = optimize_prepared[i];
}
VLOG(3) << "RunAsyncLoop into while";
bool exit_flag = false;
VLOG(3) << "start async optimize threads";
......@@ -255,11 +257,12 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
std::string grad_name = iter->first;
fs.push_back(framework::Async([grad_name, &exit_flag, &executor,
&grad_to_queue, &grad_to_prepared_ctx]() {
AsyncUpdateThread(exit_flag, grad_to_queue[grad_name], executor,
grad_to_prepared_ctx[grad_name].get());
AsyncUpdateThread(grad_name, exit_flag, grad_to_queue[grad_name],
executor, grad_to_prepared_ctx[grad_name].get());
}));
}
VLOG(3) << "RunAsyncLoop into while";
while (!exit_flag) {
const detail::ReceivedMessage v = rpc_service_->Get();
auto recv_var_name = v.first;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册