Browse Source

generate appropriate error when debugger is used with dataset_sink_mode=True

tags/v1.1.0
Harshvardhan Gupta 5 years ago
parent
commit
e6451adc50
3 changed files with 17 additions and 8 deletions
  1. +0
    -7
      mindspore/ccsrc/backend/session/gpu_session.cc
  2. +15
    -1
      mindspore/ccsrc/debug/debugger/debugger.cc
  3. +2
    -0
      mindspore/ccsrc/debug/debugger/debugger.h

+ 0
- 7
mindspore/ccsrc/backend/session/gpu_session.cc View File

@@ -418,14 +418,7 @@ void GPUSession::PostIterationDbg(const std::shared_ptr<KernelGraph> &kernel_gra
} }


void GPUSession::PreLoadTensor(const std::shared_ptr<KernelGraph> &kernel_graph) const { void GPUSession::PreLoadTensor(const std::shared_ptr<KernelGraph> &kernel_graph) const {
// check the dump_enabled and dataset_sink_mode
bool dump_enabled = DumpDataEnabledIteration(); 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))) { if (!(debugger_ && (debugger_->debugger_enabled() || dump_enabled))) {
return; return;
} }


+ 15
- 1
mindspore/ccsrc/debug/debugger/debugger.cc View File

@@ -32,6 +32,7 @@
#include "runtime/device/kernel_runtime_manager.h" #include "runtime/device/kernel_runtime_manager.h"
#include "runtime/device/kernel_runtime.h" #include "runtime/device/kernel_runtime.h"
#include "debug/data_dump/e2e_dump_util.h" #include "debug/data_dump/e2e_dump_util.h"
#include "utils/config_manager.h"


using debugger::EventReply; using debugger::EventReply;
using debugger::GraphProto; using debugger::GraphProto;
@@ -71,9 +72,9 @@ Debugger::Debugger()
// configure partial memory reuse // configure partial memory reuse
partial_memory_ = CheckDebuggerPartialMemoryEnabled(); partial_memory_ = CheckDebuggerPartialMemoryEnabled();


// switch memory reuse on or off
auto context_ptr = MsContext::GetInstance(); auto context_ptr = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context_ptr); MS_EXCEPTION_IF_NULL(context_ptr);
// switch memory reuse on or off
context_ptr->set_param<bool>(MS_CTX_ENABLE_MEM_REUSE, partial_memory_); context_ptr->set_param<bool>(MS_CTX_ENABLE_MEM_REUSE, partial_memory_);
// print some message about memory reuse to user // print some message about memory reuse to user
if (partial_memory_) { if (partial_memory_) {
@@ -194,6 +195,18 @@ void Debugger::EnableDebugger() {
debug_services_ = std::make_unique<DebugServices>(); debug_services_ = std::make_unique<DebugServices>();
} }


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() { bool Debugger::CheckDebuggerDumpEnabled() {
// see if dump is enabled // see if dump is enabled
if (device_target_ == kGPUDevice) { if (device_target_ == kGPUDevice) {
@@ -247,6 +260,7 @@ void Debugger::Reset() {
void Debugger::PreExecute(const KernelGraphPtr &graph_ptr) { void Debugger::PreExecute(const KernelGraphPtr &graph_ptr) {
// access lock for public method // access lock for public method
std::lock_guard<std::mutex> a_lock(access_lock_); std::lock_guard<std::mutex> a_lock(access_lock_);
CheckDatasetSinkMode();
if (debugger_->DebuggerBackendEnabled()) { if (debugger_->DebuggerBackendEnabled()) {
// check and save graph_ptr, suspend if graph is new // check and save graph_ptr, suspend if graph is new
CheckGraphPtr(graph_ptr); CheckGraphPtr(graph_ptr);


+ 2
- 0
mindspore/ccsrc/debug/debugger/debugger.h View File

@@ -111,6 +111,8 @@ class Debugger : public std::enable_shared_from_this<Debugger> {


void LoadGraphOutputs(); void LoadGraphOutputs();


void CheckDatasetSinkMode();

private: private:
// private constructor for singleton // private constructor for singleton
Debugger(); Debugger();


Loading…
Cancel
Save