提交 0f8bd73c 编写于 作者: Y Yancey1989

cleanup code test=develop

上级 5677c9d4
...@@ -34,6 +34,8 @@ namespace details { ...@@ -34,6 +34,8 @@ namespace details {
static inline bool SeqOnlyAllReduceOps(const BuildStrategy &strategy) { static inline bool SeqOnlyAllReduceOps(const BuildStrategy &strategy) {
// Should fix the allreduce op order if scheduling // Should fix the allreduce op order if scheduling
// them in multiple threads or processes to avoid hang. // them in multiple threads or processes to avoid hang.
// NOTE: ParallelExecutor would execute this pass on each graph, so
// don't need to append it here.
return (!strategy.enable_sequential_execution_ && return (!strategy.enable_sequential_execution_ &&
strategy.num_trainers_ > 1) && strategy.num_trainers_ > 1) &&
!strategy.enable_parallel_graph_; !strategy.enable_parallel_graph_;
...@@ -118,7 +120,7 @@ class ParallelExecutorPassBuilder : public ir::PassBuilder { ...@@ -118,7 +120,7 @@ class ParallelExecutorPassBuilder : public ir::PassBuilder {
} }
// Verify that the graph is correct for multi-device executor. // Verify that the graph is correct for multi-device executor.
auto multi_devices_pass = AppendPass("multi_devices_check_pass"); AppendPass("multi_devices_check_pass");
if (SeqOnlyAllReduceOps(strategy)) { if (SeqOnlyAllReduceOps(strategy)) {
AppendPass("all_reduce_deps_pass"); AppendPass("all_reduce_deps_pass");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册