File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed
paddle/fluid/framework/details Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -47,16 +47,7 @@ FastThreadedSSAGraphExecutor::FastThreadedSSAGraphExecutor(
4747 << " Change thread number to 1 because the toposort order is unique" ;
4848 strategy_.num_threads_ = 1 ;
4949 }
50- if (strategy_.num_threads_ > 1 ) {
51- pool_.reset (new ::ThreadPool (strategy.num_threads_ ));
52- } else {
53- auto nodes = ir::TopologySortOperations (*graph_);
54- traced_ops_.clear ();
55- traced_ops_.reserve (nodes.size ());
56- for (auto *node : nodes) {
57- traced_ops_.push_back (&node->Wrapper <OpHandleBase>());
58- }
59- }
50+ pool_.reset (new ::ThreadPool (strategy.num_threads_ ));
6051 for (auto &op : ir::FilterByNodeWrapper<OpHandleBase>(*graph_)) {
6152 int dep = static_cast <int >(op->NotReadyInputSize ());
6253 op_deps_.emplace (op, dep);
@@ -239,7 +230,7 @@ void FastThreadedSSAGraphExecutor::RunOpAsync(
239230 OpHandleBase *op,
240231 const std::shared_ptr<BlockingQueue<size_t >> &complete_q) {
241232 ++remaining_;
242- auto func = [=] {
233+ this -> pool_ -> enqueue ( [=] {
243234 std::deque<OpHandleBase *> op_queue;
244235 op_queue.push_front (op);
245236
@@ -298,12 +289,7 @@ void FastThreadedSSAGraphExecutor::RunOpAsync(
298289 }
299290 --remaining_;
300291 complete_q->Push (complete);
301- };
302- if (pool_) {
303- pool_->enqueue (func);
304- } else {
305- func ();
306- }
292+ });
307293}
308294
309295void FastThreadedSSAGraphExecutor::PrepareAtomicOpDeps () {
You can’t perform that action at this time.
0 commit comments