Browse Source

!186 fix hcom parrelle sc

Merge pull request !186 from 王笑天/development
tags/v1.1.0
王涛 Gitee 3 years ago
parent
commit
f72d32a01d
2 changed files with 9 additions and 2 deletions
  1. +7
    -2
      ge/graph/build/logical_stream_allocator.cc
  2. +2
    -0
      ge/graph/build/logical_stream_allocator.h

+ 7
- 2
ge/graph/build/logical_stream_allocator.cc View File

@@ -462,7 +462,7 @@ Status AllReduceParallelPass::Run(ComputeGraphPtr graph, const vector<SubgraphPt
set<NodePtr> all_reduce_succs;

for (const NodePtr &node : graph->GetDirectNode()) {
if ((node->GetType() != HCOMALLREDUCE && node->GetType() != HVDCALLBACKALLREDUCE) ||
if (!IsHcomNode(node->GetType()) ||
node->GetInDataNodes().size() <= 1) {
continue;
}
@@ -507,7 +507,7 @@ Status AllReduceParallelPass::Run(ComputeGraphPtr graph, const vector<SubgraphPt
old_stream_to_new.emplace(old_stream, new_stream);
}

if ((node->GetType() != HCOMALLREDUCE && node->GetType() != HVDCALLBACKALLREDUCE)) {
if (!IsHcomNode(node->GetType())) {
GELOGI("Stream of node %s has been updated from %ld to %ld.", node->GetName().c_str(), old_stream, new_stream);
node->GetOpDesc()->SetStreamId(new_stream);
}
@@ -517,6 +517,11 @@ Status AllReduceParallelPass::Run(ComputeGraphPtr graph, const vector<SubgraphPt
return !all_reduce_succs.empty() ? SUCCESS : NOT_CHANGED;
}

bool AllReduceParallelPass::IsHcomNode(const std::string& node_type) {
return (node_type == HCOMALLREDUCE || node_type == HVDCALLBACKALLREDUCE);
}


LogicalStreamAllocator::LogicalStreamAllocator(const map<string, SchedulerConf> &scheduler_confs,
const map<string, int> &max_parallel_num)
: scheduler_confs_(scheduler_confs), max_parallel_num_(max_parallel_num) {}


+ 2
- 0
ge/graph/build/logical_stream_allocator.h View File

@@ -166,6 +166,8 @@ class AllReduceParallelPass : public LogicalStreamPass {
public:
STREAM_PASS_DEFAULT_FUNC(AllReduceParallelPass);
Status Run(ComputeGraphPtr graph, const std::vector<SubgraphPtr> &subgraphs, Context &context) override;
private:
bool IsHcomNode(const std::string& node_type);
};

// Assign logical streams which is not limited by the number of tasks.


Loading…
Cancel
Save