Browse Source

!22260 Avoid printing meaningless error message

Merge pull request !22260 from tanghuikang/tbe_em
tags/v1.5.0-rc1
i-robot Gitee 4 years ago
parent
commit
f88445dcf0
3 changed files with 8 additions and 8 deletions
  1. +1
    -4
      mindspore/ccsrc/backend/session/ascend_session.cc
  2. +3
    -2
      mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc
  3. +4
    -2
      mindspore/ccsrc/utils/context/context_extends.cc

+ 1
- 4
mindspore/ccsrc/backend/session/ascend_session.cc View File

@@ -1547,10 +1547,7 @@ void AscendSession::ReportWarningMessage() {

void AscendSession::ReportErrorMessage() {
const string &error_message = ErrorManager::GetInstance().GetErrorMessage();
if (error_message.find(kUnknowErrorString) != string::npos) {
return;
}
if (!error_message.empty()) {
if (!error_message.empty() && error_message.find(kUnknowErrorString) == string::npos) {
MS_LOG(ERROR) << "Ascend error occurred, error message:\n" << error_message;
}
}


+ 3
- 2
mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc View File

@@ -80,6 +80,7 @@ constexpr size_t kPathMax = 4096;

namespace mindspore::device::ascend {
static thread_local rtContext_t thread_local_rt_context{nullptr};
constexpr auto kUnknowErrorString = "Unknown error occurred";
namespace {
std::string GetRankIdStr() {
auto context_ptr = MsContext::GetInstance();
@@ -278,7 +279,7 @@ void AscendKernelRuntime::PreInit() {
auto ret = ProfilingManager::GetInstance().StartupProfiling(device_id_);
if (!ret) {
const string &error_message = ErrorManager::GetInstance().GetErrorMessage();
if (!error_message.empty()) {
if (!error_message.empty() && error_message.find(kUnknowErrorString) == string::npos) {
MS_LOG(ERROR) << "Ascend error occurred, error message:\n" << error_message;
}
MS_EXCEPTION(DeviceProcessError) << "StartupProfiling failed.";
@@ -338,7 +339,7 @@ bool AscendKernelRuntime::Init() {
}
} catch (const std::exception &e) {
const string &error_message = ErrorManager::GetInstance().GetErrorMessage();
if (!error_message.empty()) {
if (!error_message.empty() && error_message.find(kUnknowErrorString) == string::npos) {
MS_LOG(ERROR) << "Ascend error occurred, error message:\n" << error_message;
}
throw;


+ 4
- 2
mindspore/ccsrc/utils/context/context_extends.cc View File

@@ -39,6 +39,8 @@ namespace context {
using mindspore::transform::DfGraphManager;
#endif

constexpr auto kUnknowErrorString = "Unknown error occurred";

#ifndef NO_DLIB
// Open tdt dataset
bool OpenTsd(const std::shared_ptr<MsContext> &ms_context_ptr) {
@@ -85,7 +87,7 @@ bool OpenTsd(const std::shared_ptr<MsContext> &ms_context_ptr) {
auto ret = rtSetDevice(static_cast<int32_t>(device_id));
if (ret != RT_ERROR_NONE) {
const std::string &error_message = ErrorManager::GetInstance().GetErrorMessage();
if (!error_message.empty()) {
if (!error_message.empty() && error_message.find(kUnknowErrorString) == std::string::npos) {
MS_LOG(ERROR) << "Ascend error occurred, error message:\n" << error_message;
}
MS_LOG(EXCEPTION) << "Device " << device_id << " call rtSetDevice failed, ret[" << static_cast<int>(ret) << "]";
@@ -119,7 +121,7 @@ bool CloseTsd(const std::shared_ptr<MsContext> &ms_context_ptr, bool force) {
auto ret = rtDeviceReset(static_cast<int32_t>(device_id));
if (ret != RT_ERROR_NONE) {
const std::string &error_message = ErrorManager::GetInstance().GetErrorMessage();
if (!error_message.empty()) {
if (!error_message.empty() && error_message.find(kUnknowErrorString) == std::string::npos) {
MS_LOG(ERROR) << "Ascend error occurred, error message:\n" << error_message;
}
MS_LOG(EXCEPTION) << "Device " << device_id << " call rtDeviceReset failed, ret[" << static_cast<int>(ret) << "]";


Loading…
Cancel
Save