diff --git a/mindspore/ccsrc/pipeline/jit/pipeline.cc b/mindspore/ccsrc/pipeline/jit/pipeline.cc index 44128e55d300540c8f956d719dda3aeb84f18df3..bbd8db1e1b27310a93cd201deef34b2cbfca3092 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline.cc +++ b/mindspore/ccsrc/pipeline/jit/pipeline.cc @@ -257,6 +257,8 @@ py::dict ExecutorPy::GetAllreduceFusion(const std::string &phase) { void ExecutorPy::DelNetRes(const std::string &id) { #ifdef ENABLE_GE FinalizeBackend(); +#else + ConfigManager::GetInstance().ResetIterNum(); #endif if (executor_ != nullptr) { bool flag = false; @@ -1043,6 +1045,8 @@ void ClearResAtexit() { #ifdef ENABLE_GE transform::DfGraphManager::GetInstance().ClearGraph(); transform::OpAdapterMap::get().clear(); +#else + ConfigManager::GetInstance().ResetIterNum(); #endif ReleaseGeTsd(); parse::python_adapter::ResetPythonScope(); diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index b05ed420f86ae370a22fdd7e2058acda81a78a12..e9ac967ba1c5dbc0f12288e878ad10063f2fc4c3 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -29,6 +29,7 @@ #include "utils/utils.h" #include "utils/ms_context.h" #include "utils/context/context_extends.h" +#include "utils/config_manager.h" #include "frontend/operator/ops.h" #include "frontend/operator/composite/composite.h" #include "frontend/operator/composite/do_signature.h" @@ -1260,6 +1261,7 @@ void PynativeExecutor::Clear(const std::string &flag) { if (ms_context != nullptr) { ms_context->set_enable_pynative_infer(false); } + ConfigManager::GetInstance().ResetIterNum(); return; } @@ -1272,6 +1274,7 @@ void PynativeExecutor::Clear(const std::string &flag) { op_id_map_.clear(); // node_abs_map_.clear(); std::stack().swap(graph_p_); + ConfigManager::GetInstance().ResetIterNum(); } void PynativeExecutor::Clean() { diff --git a/mindspore/ccsrc/utils/config_manager.cc b/mindspore/ccsrc/utils/config_manager.cc index 7dc559b20e899152af68cc453e6d0fdf73eefcf9..d8b0245e23becf81dd4d6b9f28880607b2a1e0cd 100644 --- a/mindspore/ccsrc/utils/config_manager.cc +++ b/mindspore/ccsrc/utils/config_manager.cc @@ -43,4 +43,6 @@ void ConfigManager::ResetConfig() noexcept { iter_num_ = 1; } +void ConfigManager::ResetIterNum() noexcept { iter_num_ = 1; } + } // namespace mindspore diff --git a/mindspore/ccsrc/utils/config_manager.h b/mindspore/ccsrc/utils/config_manager.h index a561b7d641e730aa41614731501fde3b4b182c8e..1960797f6f3b448c5efd705ab1504b806c6e3265 100644 --- a/mindspore/ccsrc/utils/config_manager.h +++ b/mindspore/ccsrc/utils/config_manager.h @@ -102,6 +102,8 @@ class ConfigManager { void ResetConfig() noexcept; + void ResetIterNum() noexcept; + std::map ge_initialize_options_; private: