!44462 ignore title when content has a formated title

Merge pull request !44462 from xulei/error_log
This commit is contained in:
i-robot 2022-10-27 01:25:04 +00:00 committed by Gitee
commit 45afcca4b1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 21 additions and 8 deletions

View File

@ -37,6 +37,7 @@
"mindspore/mindspore/ccsrc/backend/graph_compiler/backend_base.cc" "knownConditionTrueFalse"
"mindspore/mindspore/ccsrc/backend/graph_compiler/backend_base.cc" "variableScope"
"mindspore/mindspore/core/ops/max_pool.cc" "zerodivcond"
"mindspore/core/utils/log_adapter.cc" "stlIfStrFind"
# MindData
"mindspore/mindspore/ccsrc/minddata/dataset/engine/dataset_iterator.cc" "useStlAlgorithm"

View File

@ -59,7 +59,8 @@ bool AscendMemAdapter::Initialize() {
auto context_ptr = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context_ptr);
unsigned int device_id = context_ptr->get_param<uint32_t>(MS_CTX_DEVICE_ID);
MS_LOG(EXCEPTION) << "Malloc device memory failed, free memory size is less than half of total memory size."
MS_LOG(EXCEPTION) << "#umsg#Framework Error Message:#umsg#Malloc device memory failed, free memory size is less "
"than half of total memory size."
<< "Device " << device_id << " Device HBM total size:" << device_hbm_total_size_
<< " Device HBM free size:" << device_hbm_free_size_
<< " may be other processes occupying this card, check as: ps -ef|grep python";
@ -77,7 +78,8 @@ bool AscendMemAdapter::Initialize() {
} else {
if (user_define_ms_size >= device_hbm_free_size_) {
MS_LOG(EXCEPTION)
<< "The Free Device Memory Size is " << (SizeToFloat(device_hbm_free_size_) / kGBToByte)
<< "#umsg#Framework Error Message:#umsg#The Free Device Memory Size is "
<< (SizeToFloat(device_hbm_free_size_) / kGBToByte)
<< " GB, variable_memory_max_size/max_device_memory should be in range (0-"
<< (SizeToFloat(device_hbm_free_size_) / kMBToByte) << "]MB, but got "
<< (SizeToFloat(user_define_ms_size) / kMBToByte)
@ -146,7 +148,8 @@ uint8_t *AscendMemAdapter::MallocStaticDevMem(size_t size, const std::string &ta
auto new_static_offset = static_mem_offset_ - size;
if (new_static_offset < max_dynamic_mem_offset_) {
MS_LOG(INFO) << DevMemDetailInfo();
MS_LOG(EXCEPTION) << "Out of Memory!!! Request memory size: " << size << ", Memory Statistic:" << DevMemStatistics()
MS_LOG(EXCEPTION) << "#umsg#Framework Error Message:#umsg#Out of Memory!!! Request memory size: " << size
<< ", Memory Statistic:" << DevMemStatistics()
<< "\nPlease try to reduce 'batch_size' or check whether exists extra large shape. For more "
"details, please refer to 'Out of Memory' at https://www.mindspore.cn .";
}
@ -163,7 +166,8 @@ uint8_t *AscendMemAdapter::MallocDynamicDevMem(size_t size, const std::string &t
auto new_dynamic_offset = cur_dynamic_mem_offset_ + size;
if (new_dynamic_offset > static_mem_offset_) {
MS_LOG(INFO) << DevMemDetailInfo();
MS_LOG(EXCEPTION) << "Out of Memory!!! Request memory size: " << size << ", Memory Statistic:" << DevMemStatistics()
MS_LOG(EXCEPTION) << "#umsg#Framework Error Message:#umsg#Out of Memory!!! Request memory size: " << size
<< ", Memory Statistic:" << DevMemStatistics()
<< "\nPlease try to reduce 'batch_size' or check whether exists extra large shape. For more "
"details, please refer to 'Out of Memory' at https://www.mindspore.cn .";
}
@ -259,7 +263,8 @@ uint8_t *AscendMemAdapter::MallocFromRts(size_t size) const {
size_t free = 0;
size_t total = 0;
(void)rtMemGetInfoEx(RT_MEMORYINFO_HBM, &free, &total);
MS_LOG(EXCEPTION) << "Malloc device memory failed, size[" << size << "], ret[" << ret << "], "
MS_LOG(EXCEPTION) << "#umsg#Framework Error Message:#umsg#Malloc device memory failed, size[" << size << "], ret["
<< ret << "], "
<< "Device " << device_id << " Available HBM size:" << total << " free size:" << free
<< " may be other processes occupying this card, check as: ps -ef|grep python";
} else {

View File

@ -81,7 +81,7 @@ uint8_t *AscendMemoryManager::MallocStaticMem(size_t size, bool communication_me
// create protect area [kMemAlignSize -- data -- kMemAlignSize] for communication node memory
return communication_mem ? alloc_address + kMemAlignSize : alloc_address;
}
MS_LOG(EXCEPTION) << "Fail to alloc memory, size: " << align_size
MS_LOG(EXCEPTION) << "#umsg#Framework Error Message:#umsg#Fail to alloc memory, size: " << align_size
<< ", memory statistics:" << AscendMemAdapter::GetInstance().DevMemStatistics();
}
@ -108,7 +108,7 @@ uint8_t *AscendMemoryManager::MallocCommunicationMemFromMemPool(size_t size) {
if (base_ptr != nullptr) {
return base_ptr + kMemAlignSize;
}
MS_LOG(EXCEPTION) << "Fail to alloc memory, size: " << align_size
MS_LOG(EXCEPTION) << "#umsg#Framework Error Message:#umsg#Fail to alloc memory, size: " << align_size
<< ", memory statistics:" << AscendMemAdapter::GetInstance().DevMemStatistics();
}

View File

@ -286,7 +286,8 @@ bool HcclAdapter::GenTask(const AnfNodePtr &node, HcclDataType datatype,
int64_t HcclAdapter::CalcWorkspaceSize(const AnfNodePtr &node, HcclDataType datatype) const {
if (ops_kernel_builder_ == nullptr) {
MS_LOG(EXCEPTION) << "Hccl ops kernel builder is null, may not be inited.";
MS_LOG(EXCEPTION) << "#umsg#Framework Error Message:#umsg#Hccl ops kernel builder is null, may not be inited. "
"Please call HCCL init() first.";
}
MS_LOG(INFO) << "Start calc workspace size for hccl node " << node->DebugString() << " ,dtype is " << datatype;
auto [ge_node, ge_graph] = GenerateStubGeNode(node, datatype);

View File

@ -36,6 +36,7 @@ namespace mindspore {
constexpr int kNameMaxLength = 18;
constexpr size_t kStep = 2;
constexpr auto kSplitLine = "\n----------------------------------------------------\n";
constexpr auto kFrameworkErrorTitle = "Framework Error Message:";
#if defined(__ANDROID__) || defined(ANDROID)
constexpr const char *ANDROID_LOG_TAG = "MS_LITE";
#endif
@ -281,6 +282,11 @@ void CombineExceptionMessageWithSameTitle(std::ostringstream &oss, const std::st
if (title.empty() || content.empty()) {
return;
}
// ignore the passed framework title if content has a formatted title itself
if (title.find(kFrameworkErrorTitle) != std::string::npos && content.find(kSplitLine) == 0) {
oss << '\n' << content;
return;
}
std::string message = oss.str();
size_t position = message.find(title + kSplitLine);
if (position != std::string::npos) {