From bb9ec4b25f708ec2f1003cd1d9a0babbc09725f4 Mon Sep 17 00:00:00 2001 From: velconia Date: Thu, 13 Sep 2018 17:24:06 +0800 Subject: [PATCH] Polish code --- .../distributed/proto_encoder_helper.h | 2 +- paddle/fluid/operators/listen_and_serv_op.cc | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/paddle/fluid/operators/distributed/proto_encoder_helper.h b/paddle/fluid/operators/distributed/proto_encoder_helper.h index 45f9e4a650..d2b0eb6ca6 100644 --- a/paddle/fluid/operators/distributed/proto_encoder_helper.h +++ b/paddle/fluid/operators/distributed/proto_encoder_helper.h @@ -82,8 +82,8 @@ class ProtoEncodeHelper { : base_(buf), p_(buf), limit_(base_ + max_size) {} ~ProtoEncodeHelper() { - // Make sure callers didn't do operations that went over max_size promised #define REPLACE_ENFORCE_GLOG 1 + // Make sure callers didn't do operations that went over max_size promised paddle::platform::throw_on_error(p_ <= limit_); #undef REPLACE_ENFORCE_GLOG } diff --git a/paddle/fluid/operators/listen_and_serv_op.cc b/paddle/fluid/operators/listen_and_serv_op.cc index 13358e5f99..dc008d1697 100644 --- a/paddle/fluid/operators/listen_and_serv_op.cc +++ b/paddle/fluid/operators/listen_and_serv_op.cc @@ -59,17 +59,16 @@ static void ParallelExecuteBlocks( framework::ProgramDesc *program, framework::Scope *scope) { std::vector> fs; for (size_t idx : parallel_blkids) { - fs.push_back( - framework::Async([&executor, &prepared, &scope, idx]() { - int run_block = idx; // thread local - try { - VLOG(3) << "running server block: " << run_block - << "pointer: " << prepared[run_block].get(); - executor->RunPreparedContext(prepared[run_block].get(), scope); - } catch (const std::exception &e) { - LOG(ERROR) << "run sub program error " << e.what(); - } - })); + fs.push_back(framework::Async([&executor, &prepared, &scope, idx]() { + int run_block = idx; // thread local + try { + VLOG(3) << "running server block: " << run_block + << "pointer: " << prepared[run_block].get(); + executor->RunPreparedContext(prepared[run_block].get(), scope); + } catch (const std::exception &e) { + LOG(ERROR) << "run sub program error " << e.what(); + } + })); } for (size_t i = 0; i < fs.size(); ++i) fs[i].wait(); } -- GitLab