diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index 875b5d8ba7acc826e6d657f96f1b26acb06141f6..b5b1e43abfb820dcb9b74de5ce255f8054310814 100644 --- a/paddle/fluid/framework/parallel_executor.cc +++ b/paddle/fluid/framework/parallel_executor.cc @@ -742,26 +742,29 @@ void ParallelExecutor::Run(const std::vector &fetch_tensors, void ParallelExecutor::RunOp( std::unordered_map> &pending_vars, OpHandle *op) const { - std::vector *> ready_buffer; + std::vector *> *ready_buffer = + new std::vector *>(); for (auto *var : op->outputs_) { - ready_buffer.emplace_back(&pending_vars[var]); + ready_buffer->emplace_back(&pending_vars[var]); } auto op_run = [ready_buffer, op, this] { try { VLOG(10) << op->DebugString(); op->Run(); - for (auto *ready : ready_buffer) { + for (auto *ready : *ready_buffer) { ready->store(true, std::memory_order_release); } + delete ready_buffer; } catch (platform::EnforceNotMet ex) { member_->exception_.reset(new platform::EnforceNotMet(ex)); } catch (...) { LOG(FATAL) << "Unknown exception catched"; } }; - + VLOG(3) << "Enqueue"; member_->pool_.enqueue(op_run); + VLOG(3) << "Done"; } } // namespace framework } // namespace paddle