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

Method CreateOpNode2TaskIds

oneflow/core/graph/task_graph.cpp:1113–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1111}
1112
1113void BoxingTaskGraph::CreateOpNode2TaskIds(
1114 const std::function<void(size_t, const std::function<void(size_t i)>&)>& ParallelRunLoop) {
1115 const OpGraph* op_graph = Singleton<OpGraph>::Get();
1116 std::vector<const OpNode*> op_nodes;
1117 op_nodes.reserve(op_graph->node_num());
1118 op_graph->ForEachNode([&](OpNode* op_node) {
1119 if (boxing_related_op_node2sorted_comp_tasks_.count(op_node) == 0) {
1120 op_nodes.push_back(op_node);
1121 boxing_unrelated_op_node2sorted_task_ids_[op_node].reserve(
1122 op_node->parallel_desc().parallel_num());
1123 }
1124 });
1125 ParallelRunLoop(op_nodes.size(), [&](size_t i) {
1126 const OpNode* op_node = op_nodes.at(i);
1127 TaskType task_type = TaskType4OpNode(op_node);
1128 const auto& parallel_desc = op_node->parallel_desc();
1129 auto* task_ids = &boxing_unrelated_op_node2sorted_task_ids_[op_node];
1130 for (int parallel_id = 0; parallel_id < parallel_desc.parallel_num(); ++parallel_id) {
1131 const auto& stream_id = GetStreamId(op_node, parallel_id, task_type);
1132 task_ids->push_back(Singleton<IDMgr>::Get()->GetTaskIdGenerator()->Generate(stream_id));
1133 }
1134 });
1135}
1136
1137namespace {
1138

Callers

nothing calls this directly

Calls 12

GetFunction · 0.85
TaskType4OpNodeFunction · 0.85
GetStreamIdFunction · 0.85
node_numMethod · 0.80
ForEachNodeMethod · 0.80
push_backMethod · 0.80
GetTaskIdGeneratorMethod · 0.80
parallel_numMethod · 0.45
parallel_descMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45
GenerateMethod · 0.45

Tested by

no test coverage detected