diff --git a/mindspore/ccsrc/backend/session/gpu_session.cc b/mindspore/ccsrc/backend/session/gpu_session.cc index fc31313221..32d5474450 100644 --- a/mindspore/ccsrc/backend/session/gpu_session.cc +++ b/mindspore/ccsrc/backend/session/gpu_session.cc @@ -418,14 +418,7 @@ void GPUSession::PostIterationDbg(const std::shared_ptr &kernel_gra } void GPUSession::PreLoadTensor(const std::shared_ptr &kernel_graph) const { - // check the dump_enabled and dataset_sink_mode bool dump_enabled = DumpDataEnabledIteration(); - auto context_ptr = MsContext::GetInstance(); - MS_EXCEPTION_IF_NULL(context_ptr); - if (dump_enabled && ConfigManager::GetInstance().dataset_mode() == DS_SINK_MODE) { - MS_EXCEPTION(NotSupportError) << "Don't support set dataset_sink_mode to True when using e2e_dump"; - } - if (!(debugger_ && (debugger_->debugger_enabled() || dump_enabled))) { return; } diff --git a/mindspore/ccsrc/debug/debugger/debugger.cc b/mindspore/ccsrc/debug/debugger/debugger.cc index 339eb5bade..2d67d62fc5 100644 --- a/mindspore/ccsrc/debug/debugger/debugger.cc +++ b/mindspore/ccsrc/debug/debugger/debugger.cc @@ -32,6 +32,7 @@ #include "runtime/device/kernel_runtime_manager.h" #include "runtime/device/kernel_runtime.h" #include "debug/data_dump/e2e_dump_util.h" +#include "utils/config_manager.h" using debugger::EventReply; using debugger::GraphProto; @@ -71,9 +72,9 @@ Debugger::Debugger() // configure partial memory reuse partial_memory_ = CheckDebuggerPartialMemoryEnabled(); - // switch memory reuse on or off auto context_ptr = MsContext::GetInstance(); MS_EXCEPTION_IF_NULL(context_ptr); + // switch memory reuse on or off context_ptr->set_param(MS_CTX_ENABLE_MEM_REUSE, partial_memory_); // print some message about memory reuse to user if (partial_memory_) { @@ -194,6 +195,18 @@ void Debugger::EnableDebugger() { debug_services_ = std::make_unique(); } +void Debugger::CheckDatasetSinkMode() { + if (CheckDebuggerDumpEnabled() && ConfigManager::GetInstance().dataset_mode() == DS_SINK_MODE) { + MS_EXCEPTION(NotSupportError) + << "e2e_dump not supported on GPU with dataset_sink_mode=True. Please set dataset_sink_mode=False"; + } + + if (CheckDebuggerEnabled() && ConfigManager::GetInstance().dataset_mode() == DS_SINK_MODE) { + MS_EXCEPTION(NotSupportError) + << "Debugger is not supported with dataset_sink_mode=True. Please set dataset_sink_mode=False"; + } +} + bool Debugger::CheckDebuggerDumpEnabled() { // see if dump is enabled if (device_target_ == kGPUDevice) { @@ -247,6 +260,7 @@ void Debugger::Reset() { void Debugger::PreExecute(const KernelGraphPtr &graph_ptr) { // access lock for public method std::lock_guard a_lock(access_lock_); + CheckDatasetSinkMode(); if (debugger_->DebuggerBackendEnabled()) { // check and save graph_ptr, suspend if graph is new CheckGraphPtr(graph_ptr); diff --git a/mindspore/ccsrc/debug/debugger/debugger.h b/mindspore/ccsrc/debug/debugger/debugger.h index b3686fa3de..d092605a17 100644 --- a/mindspore/ccsrc/debug/debugger/debugger.h +++ b/mindspore/ccsrc/debug/debugger/debugger.h @@ -111,6 +111,8 @@ class Debugger : public std::enable_shared_from_this { void LoadGraphOutputs(); + void CheckDatasetSinkMode(); + private: // private constructor for singleton Debugger();