MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / Init

Method Init

oneflow/core/graph/task_graph.cpp:1051–1084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1049}
1050
1051Maybe<void> GlobalTaskGraph::Init() {
1052 OpGraph* op_graph = Singleton<OpGraph>::Get();
1053 sub_tsk_gph_builder_ctx_.reset(new SubTskGphBuilderCtx(this));
1054 boxing_logger_ = CreateBoxingLogger();
1055 hierarchical_sub_tsk_gph_builder_.reset(new DispatchHierarchicalSubTskGphBuilder());
1056 HashMap<const OpNode*, std::vector<CompTaskNode*>> op_node2sorted_comp_tasks;
1057
1058 op_graph->ForEachNode([&](const OpNode* op_node) {
1059 std::vector<CompTaskNode*>* sorted_comp_tasks = &(op_node2sorted_comp_tasks[op_node]);
1060 GenSortedCompTaskNodes(op_node, sorted_comp_tasks);
1061 for (CompTaskNode* comp_task : *sorted_comp_tasks) { AddAllocatedNode(comp_task); }
1062 });
1063
1064 op_graph->ForEachEdge([&](const OpEdge* op_edge) {
1065 BldSubTskGphMthd method = GetMthdForBldSubTskGph(op_edge);
1066 (this->*method)(op_edge, op_node2sorted_comp_tasks.at(op_edge->src_node()),
1067 op_node2sorted_comp_tasks.at(op_edge->dst_node()));
1068 });
1069
1070 ForEachOpGraphNecessaryCtrlEdge(op_graph, [&](const OpNode* src, const OpNode* dst) {
1071 const auto& src_task_nodes = op_node2sorted_comp_tasks.at(src);
1072 const auto& dst_task_nodes = op_node2sorted_comp_tasks.at(dst);
1073 if (src->op().op_conf().has_src_subset_tick_conf()) {
1074 UNIMPLEMENTED();
1075 } else if (dst->op().op_conf().has_dst_subset_tick_conf()) {
1076 UNIMPLEMENTED();
1077 } else {
1078 ConnectCtrlEdges(src_task_nodes, dst_task_nodes);
1079 }
1080 });
1081
1082 if (Singleton<ResourceDesc, ForSession>::Get()->enable_debug_mode()) { ToDotWithAutoFilePath(); }
1083 return Maybe<void>::Ok();
1084}
1085
1086Maybe<void> BoxingTaskGraph::Init(
1087 const std::function<void(size_t, const std::function<void(size_t i)>&)>& ParallelRunLoop) {

Callers 1

GetProxyNodeMethod · 0.45

Calls 15

GetFunction · 0.85
CreateBoxingLoggerFunction · 0.85
GenSortedCompTaskNodesFunction · 0.85
GetMthdForBldSubTskGphFunction · 0.85
bindFunction · 0.85
ForEachNodeMethod · 0.80
ForEachEdgeMethod · 0.80
src_nodeMethod · 0.80
dst_nodeMethod · 0.80
enable_debug_modeMethod · 0.80
NeedBoxingMethod · 0.80

Tested by

no test coverage detected