Browse Source

!1619 Only release runtime resource in GRAPH_MODE

Merge pull request !1619 from caifubi/fix-multi-graph-device-resource-bug
tags/v0.5.0-beta
mindspore-ci-bot Gitee 6 years ago
parent
commit
90af5628b3
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      mindspore/ccsrc/session/kernel_graph.cc

+ 9
- 1
mindspore/ccsrc/session/kernel_graph.cc View File

@@ -719,6 +719,14 @@ void KernelGraph::UpdateCallRealInput() {

std::string KernelGraph::ToString() const { return std::string("kernel_graph_").append(std::to_string(graph_id_)); }

KernelGraph::~KernelGraph() { device::KernelRuntimeManager::Instance().ClearGraphResource(graph_id_); }
KernelGraph::~KernelGraph() {
auto context = MsContext::GetInstance();
if (!context) {
return;
}
if (context->execution_mode() == kGraphMode) {
device::KernelRuntimeManager::Instance().ClearGraphResource(graph_id_);
}
}
} // namespace session
} // namespace mindspore

Loading…
Cancel
Save