Browse Source

modify graph partition dump graph name

tags/v1.1.0
gengchao4@huawei.com 3 years ago
parent
commit
1384a85536
2 changed files with 19 additions and 3 deletions
  1. +17
    -3
      ge/graph/partition/graph_partition.cc
  2. +2
    -0
      ge/graph/partition/graph_partition.h

+ 17
- 3
ge/graph/partition/graph_partition.cc View File

@@ -532,6 +532,7 @@ Status ge::GraphPartitioner::Initialize(ge::ComputeGraphPtr compute_graph) {
} }
const NodeEngineMap *node_engine_map = graph_info_.engine_placer_.GetNodeEngineMap(); const NodeEngineMap *node_engine_map = graph_info_.engine_placer_.GetNodeEngineMap();
size_t temp_index = 0; size_t temp_index = 0;
// travese nodes by topo order one by one
for (const auto &node : compute_graph->GetDirectNode()) { for (const auto &node : compute_graph->GetDirectNode()) {
std::string temp_stream; std::string temp_stream;
// node opdesc has been checked before // node opdesc has been checked before
@@ -556,9 +557,22 @@ Status ge::GraphPartitioner::Initialize(ge::ComputeGraphPtr compute_graph) {
} }
new_cluster->nodes_.push_back(node); new_cluster->nodes_.push_back(node);
if (!HasNoInput(node)) { if (!HasNoInput(node)) {
auto node_id = node->GetOpDesc()->GetId();
for (const auto &parent : node->GetInAllNodes()) { for (const auto &parent : node->GetInAllNodes()) {
new_cluster->in_clu_.insert(graph_info_.node_2_cluster_.at(parent)->index_);
graph_info_.node_2_cluster_.at(parent)->out_clu_.insert(temp_index);
auto parent_id = parent->GetOpDesc()->GetId();
if (parent_id < node_id) {
auto iter = graph_info_.node_2_cluster_.find(parent);
if (iter == graph_info_.node_2_cluster_.end()) {
GELOGE(FAILED,
"[GraphPartitioner]: node[%s]id[%ld]'s parent_node[%s]id[%ld]"
"should make cluster in advance",
node->GetOpDesc()->GetName().c_str(), node_id,
parent->GetOpDesc()->GetName().c_str(), parent_id);
return FAILED;
}
new_cluster->in_clu_.insert(iter->second->index_);
iter->second->out_clu_.insert(temp_index);
}
} }
} }
graph_info_.node_2_cluster_[node] = new_cluster; graph_info_.node_2_cluster_[node] = new_cluster;
@@ -586,7 +600,7 @@ Status ge::GraphPartitioner::AddPartitionsToGraphNode(vector<ge::SubGraphInfoPtr
return FAILED; return FAILED;
} }
auto &engine_name = graph_info_.partitions_.at(sub_graph); auto &engine_name = graph_info_.partitions_.at(sub_graph);
GE_DUMP(sub_graph, sub_graph->GetName());
GE_DUMP(sub_graph, sub_graph->GetName() + "_" + mode_2_str_[graph_info_.mode_]);
if (!session_graph_id.empty()) { if (!session_graph_id.empty()) {
GE_IF_BOOL_EXEC(!AttrUtils::SetStr(sub_graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id), GE_IF_BOOL_EXEC(!AttrUtils::SetStr(sub_graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id),
GELOGW("SetStr ATTR_NAME_SESSION_GRAPH_ID failed");) GELOGW("SetStr ATTR_NAME_SESSION_GRAPH_ID failed");)


+ 2
- 0
ge/graph/partition/graph_partition.h View File

@@ -176,6 +176,8 @@ class GraphPartitioner {
Graph2InputNodesSubGraphInfo graph_2_input_subgraph_; Graph2InputNodesSubGraphInfo graph_2_input_subgraph_;
GraphPartitionInfo graph_info_; GraphPartitionInfo graph_info_;
uint32_t partition_times_; // times of call partition uint32_t partition_times_; // times of call partition
std::map<Mode, std::string> mode_2_str_ = {{kPartitioning, "Partitioning"},
{kSecondPartitioning, "SecondPartitioning"}, {kMerging, "Merging"}};
friend class GraphManager; friend class GraphManager;
}; };
} // namespace ge } // namespace ge


Loading…
Cancel
Save