Skip to content

Commit f00081a

Browse files
authored
Merge pull request #13381 from velconia/make_mac_pass_build
fix redundant args of lambda and remove exception of destructor
2 parents 5fd2ffd + bb9ec4b commit f00081a

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

paddle/fluid/operators/distributed/proto_encoder_helper.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ class ProtoEncodeHelper {
8282
: base_(buf), p_(buf), limit_(base_ + max_size) {}
8383

8484
~ProtoEncodeHelper() {
85+
#define REPLACE_ENFORCE_GLOG 1
8586
// Make sure callers didn't do operations that went over max_size promised
86-
PADDLE_ENFORCE_LE(p_, limit_);
87+
paddle::platform::throw_on_error(p_ <= limit_);
88+
#undef REPLACE_ENFORCE_GLOG
8789
}
8890

8991
const char* data() const { return base_; }

paddle/fluid/operators/listen_and_serv_op.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,16 @@ static void ParallelExecuteBlocks(
5959
framework::ProgramDesc *program, framework::Scope *scope) {
6060
std::vector<std::future<void>> fs;
6161
for (size_t idx : parallel_blkids) {
62-
fs.push_back(
63-
framework::Async([&executor, &prepared, &program, &scope, idx]() {
64-
int run_block = idx; // thread local
65-
try {
66-
VLOG(3) << "running server block: " << run_block
67-
<< "pointer: " << prepared[run_block].get();
68-
executor->RunPreparedContext(prepared[run_block].get(), scope);
69-
} catch (const std::exception &e) {
70-
LOG(ERROR) << "run sub program error " << e.what();
71-
}
72-
}));
62+
fs.push_back(framework::Async([&executor, &prepared, &scope, idx]() {
63+
int run_block = idx; // thread local
64+
try {
65+
VLOG(3) << "running server block: " << run_block
66+
<< "pointer: " << prepared[run_block].get();
67+
executor->RunPreparedContext(prepared[run_block].get(), scope);
68+
} catch (const std::exception &e) {
69+
LOG(ERROR) << "run sub program error " << e.what();
70+
}
71+
}));
7372
}
7473
for (size_t i = 0; i < fs.size(); ++i) fs[i].wait();
7574
}

0 commit comments

Comments
 (0)