forked from mindspore-Ecosystem/mindspore
parent
643a25e03b
commit
ed5b69179c
|
@ -397,7 +397,14 @@ py::dict ExecutorPy::GetAllreduceFusion(const std::string &phase) {
|
||||||
return mindspore::parallel::GetAllreduceFusion(graph);
|
return mindspore::parallel::GetAllreduceFusion(graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not support multi thread, not support nested call too.
|
||||||
|
// Here using nested_called flg to avoid nested call.
|
||||||
void ExecutorPy::DelNetRes(const std::string &id) {
|
void ExecutorPy::DelNetRes(const std::string &id) {
|
||||||
|
static bool nested_called = false;
|
||||||
|
if (nested_called) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nested_called = true;
|
||||||
#ifdef ENABLE_GE
|
#ifdef ENABLE_GE
|
||||||
FinalizeBackend();
|
FinalizeBackend();
|
||||||
#else
|
#else
|
||||||
|
@ -425,6 +432,7 @@ void ExecutorPy::DelNetRes(const std::string &id) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
nested_called = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutorPy::ClearRes() {
|
void ExecutorPy::ClearRes() {
|
||||||
|
|
|
@ -58,7 +58,7 @@ void CalcNodeRefCount(const FuncGraphPtr &graph, std::map<AnfNodePtr, size_t> *n
|
||||||
queue.push(graph->get_return());
|
queue.push(graph->get_return());
|
||||||
std::set<AnfNodePtr> visited;
|
std::set<AnfNodePtr> visited;
|
||||||
while (!queue.empty()) {
|
while (!queue.empty()) {
|
||||||
auto &node = queue.front();
|
auto node = queue.front();
|
||||||
queue.pop();
|
queue.pop();
|
||||||
MS_EXCEPTION_IF_NULL(node);
|
MS_EXCEPTION_IF_NULL(node);
|
||||||
if (!node->isa<CNode>()) {
|
if (!node->isa<CNode>()) {
|
||||||
|
|
Loading…
Reference in New Issue