From 8c9cd369dc2280ec9c212586b804de9c10adb600 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Fri, 16 Mar 2018 14:47:56 +0800 Subject: [PATCH] Polish code style --- paddle/fluid/framework/parallel_executor.cc | 22 ++++++++++++--------- paddle/fluid/framework/parallel_executor.h | 2 ++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index 930be7fab3..40de26bdd0 100644 --- a/paddle/fluid/framework/parallel_executor.cc +++ b/paddle/fluid/framework/parallel_executor.cc @@ -379,17 +379,21 @@ void ParallelExecutor::ConstructDependencyGraph( } } - /** - * Dependency graph has been constructed. However, there are still data - * harzaeds need to be handled. - * - * We only handle write after read(WAR), since it should not have a write - * after write in program. If there are write after write operators, we need - * prune them. - * - * https://en.wikipedia.org/wiki/Hazard_(computer_architecture)#Write_after_read_(WAR) + /* + Dependency graph has been constructed. However, there are still data + harzaeds need to be handled. */ + PolishGraphToSupportDataHarzaeds(); +} +/** + * We only handle write after read(WAR), since it should not have a write + * after write in program. If there are write after write operators, we need + * prune them. + * + * https://en.wikipedia.org/wiki/Hazard_(computer_architecture)#Write_after_read_(WAR) + */ +void ParallelExecutor::PolishGraphToSupportDataHarzaeds() const { for (auto &place_pair : member_->vars_) { for (auto &name_pair : place_pair.second) { if (name_pair.second.size() <= 1) { diff --git a/paddle/fluid/framework/parallel_executor.h b/paddle/fluid/framework/parallel_executor.h index 1e4c5c48f2..30416563f8 100644 --- a/paddle/fluid/framework/parallel_executor.h +++ b/paddle/fluid/framework/parallel_executor.h @@ -61,6 +61,8 @@ class ParallelExecutor { void RunOp(std::unordered_map& pending_vars, OpHandle* op) const; + + void PolishGraphToSupportDataHarzaeds() const; }; } // namespace framework -- GitLab