未验证 提交 faa8c703 编写于 作者: A Aurelius84 提交者: GitHub

Polish ParallelExectuor constructor into small functions (#32191)

* Refine Constructor logic of ParallelExecutor

* refine function name

* refine code comment
上级 39a59dcf
......@@ -24,6 +24,7 @@ limitations under the License. */
#include "paddle/fluid/framework/details/build_strategy.h"
#include "paddle/fluid/framework/details/execution_strategy.h"
#include "paddle/fluid/framework/details/op_handle_base.h"
#include "paddle/fluid/framework/details/scope_buffered_ssa_graph_executor.h"
#include "paddle/fluid/framework/executor.h"
#include "paddle/fluid/framework/feed_fetch_type.h"
#include "paddle/fluid/framework/op_info.h"
......@@ -41,6 +42,7 @@ namespace framework {
class ParallelExecutorPrivate;
using details::VariableInfo;
using details::BuildStrategy;
using details::ExecutionStrategy;
namespace p = paddle::platform;
......@@ -93,6 +95,40 @@ class ParallelExecutor {
const ExecutionStrategy &exec_strategy,
const BuildStrategy &build_strategy) const;
void InitExecutorPrivateMemberInfo(const ExecutionStrategy &exec_strategy,
const BuildStrategy &build_strategy,
size_t device_count,
const ir::Graph &graph);
void CreateLocalScopes(Scope *global_scope,
const std::vector<Scope *> &local_scopes,
bool create_new);
std::unordered_map<Scope *, Scope *> CreateLocalExecScopes(
const std::vector<Scope *> &local_scopes, bool create_new);
std::vector<ir::Graph *> CloneGraphToMultiDevices(ir::Graph *graph);
void PrepareNCCLCommunicator(Scope *global_scope);
std::vector<ir::Graph *> CompileGraphWithBuildStrategy(
ir::Graph *graph, std::vector<ir::Graph *> *graphs,
const std::string &loss_var_name);
void CreateVariableInfos(std::vector<VariableInfo> *var_infos,
ir::Graph *graph);
std::vector<ir::Graph *> CreateSSAGraphExecutor(
const ExecutionStrategy &exec_strategy,
std::vector<ir::Graph *> *async_graphs, ir::Graph *graph);
void ResetOpHandleScopeMapOfGraphs(
const std::vector<ir::Graph *> &final_graphs,
const std::unordered_map<Scope *, Scope *> &scope_map);
void SetReaderOpDeviceInfoOfGraphs(
const std::vector<ir::Graph *> &final_graphs);
ParallelExecutorPrivate *member_;
std::vector<std::unique_ptr<ir::Graph>> async_graphs_;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册