Browse Source

!13068 [MS][MI] Debugger prints log for not supporting CPU

From: @alashkari
Reviewed-by: @john_tzanakakis,@tom__chen
Signed-off-by: @john_tzanakakis
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 5 years ago
parent
commit
07e79dad28
3 changed files with 12 additions and 13 deletions
  1. +1
    -3
      mindspore/ccsrc/backend/session/session_basic.h
  2. +10
    -9
      mindspore/ccsrc/debug/debugger/debugger.cc
  3. +1
    -1
      mindspore/ccsrc/debug/debugger/debugger.h

+ 1
- 3
mindspore/ccsrc/backend/session/session_basic.h View File

@@ -132,9 +132,7 @@ class SessionBasic : public std::enable_shared_from_this<SessionBasic> {
// set debugger
void SetDebugger() {
debugger_ = Debugger::GetInstance();
auto ms_context = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(ms_context);
debugger_->Init(device_id_, ms_context->get_param<std::string>(MS_CTX_DEVICE_TARGET));
debugger_->Init(device_id_);
}
#endif



+ 10
- 9
mindspore/ccsrc/debug/debugger/debugger.cc View File

@@ -73,7 +73,14 @@ Debugger::Debugger()
not_dataset_graph_sum_(0),
version_("") {
CheckDebuggerEnabledParam();
if (CheckDebuggerEnabled()) {
auto ms_context = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(ms_context);
device_target_ = ms_context->get_param<std::string>(MS_CTX_DEVICE_TARGET);
MS_LOG(INFO) << "Debugger got device_target: " << device_target_;
CheckDebuggerEnabledParam();
if (device_target_ == kCPUDevice) {
MS_LOG(WARNING) << "Not enabling debugger. Debugger does not support CPU.";
} else if (CheckDebuggerEnabled()) {
// configure partial memory reuse
partial_memory_ = CheckDebuggerPartialMemoryEnabled();

@@ -94,14 +101,12 @@ Debugger::Debugger()
}
}

void Debugger::Init(const uint32_t device_id, const std::string device_target) {
void Debugger::Init(const uint32_t device_id) {
// access lock for public method
std::lock_guard<std::mutex> a_lock(access_lock_);
// save device_id
MS_LOG(INFO) << "Debugger got device_id: " << device_id;
device_id_ = device_id;
MS_LOG(INFO) << "Debugger got device_target: " << device_target;
device_target_ = device_target;
version_ = "1.2.0";
}

@@ -122,11 +127,7 @@ void Debugger::EnableDebugger() {
MS_LOG(INFO) << "debugger_enabled_ = " << debugger_enabled_;

if (!debugger_enabled_ && !dump_enabled) {
if (device_target_ == kCPUDevice) {
MS_LOG(INFO) << "Not enabling debugger. Debugger does not support CPU.";
} else {
MS_LOG(INFO) << "Not enabling debugger. Set environment variable ENABLE_MS_DEBUGGER=1 to enable debugger.";
}
MS_LOG(INFO) << "Not enabling debugger. Set environment variable ENABLE_MS_DEBUGGER=1 to enable debugger.";
return;
}



+ 1
- 1
mindspore/ccsrc/debug/debugger/debugger.h View File

@@ -67,7 +67,7 @@ class Debugger : public std::enable_shared_from_this<Debugger> {

// init
// only save device_id
void Init(const uint32_t device_id, const std::string device_target);
void Init(const uint32_t device_id);

// reset debugger
void Reset();


Loading…
Cancel
Save