Browse Source

set prof_handle_ to nullptr after release

tags/v0.5.0-beta
caifubi 5 years ago
parent
commit
6e12fb1644
2 changed files with 4 additions and 2 deletions
  1. +3
    -1
      mindspore/ccsrc/device/ascend/profiling/profiling_manager.cc
  2. +1
    -1
      mindspore/ccsrc/device/ascend/profiling/profiling_manager.h

+ 3
- 1
mindspore/ccsrc/device/ascend/profiling/profiling_manager.cc View File

@@ -169,7 +169,7 @@ bool ProfilingManager::StartupProfiling(uint32_t device_id) {
return true; return true;
} }


bool ProfilingManager::StopProfiling() const {
bool ProfilingManager::StopProfiling() {
MS_LOG(INFO) << "StopProfiling"; MS_LOG(INFO) << "StopProfiling";
if (!IsProfiling()) { if (!IsProfiling()) {
MS_LOG(INFO) << "No need profiling. please export PROFILING_MODE and in train mode."; MS_LOG(INFO) << "No need profiling. please export PROFILING_MODE and in train mode.";
@@ -184,8 +184,10 @@ bool ProfilingManager::StopProfiling() const {
int result = ProfMgrStop(prof_handle_); int result = ProfMgrStop(prof_handle_);
if (result != 0) { if (result != 0) {
MS_LOG(ERROR) << "ProfMgr stop return fail:" << result << "."; MS_LOG(ERROR) << "ProfMgr stop return fail:" << result << ".";
prof_handle_ = nullptr;
return false; return false;
} }
prof_handle_ = nullptr;
} }


return true; return true;


+ 1
- 1
mindspore/ccsrc/device/ascend/profiling/profiling_manager.h View File

@@ -39,7 +39,7 @@ class ProfilingManager {
uint64_t GetJobId() const; uint64_t GetJobId() const;
bool ReportProfilingData(const map<uint32_t, string> &op_taskId_map) const; bool ReportProfilingData(const map<uint32_t, string> &op_taskId_map) const;
bool StartupProfiling(uint32_t device_id); bool StartupProfiling(uint32_t device_id);
bool StopProfiling() const;
bool StopProfiling();


inline bool IsProfiling() const { inline bool IsProfiling() const {
auto context = MsContext::GetInstance(); auto context = MsContext::GetInstance();


Loading…
Cancel
Save