!20689 [MS][RDR] Release resources reference in RDR after pipeline running finished

Merge pull request !20689 from louie5/clearRes
This commit is contained in:
i-robot 2021-07-23 01:40:00 +00:00 committed by Gitee
commit 0dd1087418
5 changed files with 11 additions and 8 deletions

View File

@ -52,7 +52,7 @@ class BaseRecorder {
}
}
}
~BaseRecorder() {}
virtual ~BaseRecorder() {}
std::string GetModule() const { return module_; }
std::string GetName() const { return name_; }

View File

@ -105,7 +105,7 @@ void RecorderManager::TriggerAll() {
if (!trigger) {
MS_LOG(WARNING) << "There is no recorder to export.";
} else {
MS_LOG(INFO) << "RDR export all recorders' info.";
MS_LOG(INFO) << "RDR export all recorders.";
}
}
@ -116,6 +116,6 @@ void RecorderManager::ClearAll() {
std::lock_guard<std::mutex> lock(mtx_);
recorder_container_.clear();
rdr_has_record_mem_ = false;
MS_LOG(INFO) << "RDR clear all recorders' info.";
MS_LOG(INFO) << "RDR clear all recorders.";
}
} // namespace mindspore

View File

@ -118,7 +118,7 @@ bool UpdateGPUMemAddressInfo(const SubModuleId module, const std::string &name,
void TriggerAll() { mindspore::RecorderManager::Instance().TriggerAll(); }
void ClearAll() { mindspore::RecorderManager::Instance().ClearAll(); }
void ResetRecorder() { mindspore::RecorderManager::Instance().ClearAll(); }
void ClearGPUMemAddressInfo() {
if (!mindspore::RecorderManager::Instance().RdrEnable()) {

View File

@ -60,7 +60,7 @@ bool RecordTaskDebugInfo(SubModuleId module, const std::string &name,
const std::vector<TaskDebugInfoPtr> &task_debug_info_list);
#endif // ENABLE_D
void TriggerAll();
void ClearAll();
void ResetRecorder();
void ClearGPUMemAddressInfo();
} // namespace RDR
} // namespace mindspore

View File

@ -445,9 +445,6 @@ void ExecutorPy::DelNetRes(const std::string &id) {
#endif
}
nested_called = false;
#ifdef ENABLE_DUMP_IR
mindspore::RDR::ClearAll();
#endif
}
void ExecutorPy::ClearRes() {
@ -1132,6 +1129,9 @@ bool InitExecDatasetVm(const std::string &queue_name, int64_t size, int64_t batc
app_init->set_abstract(abstract_none);
// Before the graph compiling, need reset the iter num.
ConfigManager::GetInstance().ResetIterNum();
#ifdef ENABLE_DUMP_IR
mindspore::RDR::ResetRecorder();
#endif
compile::SetMindRTEnable();
auto backend = compile::CreateBackend();
@ -1298,6 +1298,9 @@ void ClearResAtexit() {
ps::Worker::GetInstance().Finalize();
}
}
#endif
#ifdef ENABLE_DUMP_IR
mindspore::RDR::ResetRecorder();
#endif
session::ExecutorManager::Instance().Clear();
device::KernelRuntimeManager::Instance().ClearRuntimeResource();