Browse Source

common log optimize

tags/v1.3.0
liyihan2@huawei.com 4 years ago
parent
commit
70ec4a1737
4 changed files with 39 additions and 29 deletions
  1. +2
    -1
      ge/common/model_saver.cc
  2. +10
    -8
      ge/common/profiling/profiling_manager.cc
  3. +6
    -5
      ge/common/util.cc
  4. +21
    -15
      ge/engine_manager/dnnengine_manager.cc

+ 2
- 1
ge/common/model_saver.cc View File

@@ -72,7 +72,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi
ErrorManager::GetInstance().ATCReportErrMessage(
"E19004", {"file", "errmsg"}, {file_path, strerror(errno)});
// Need to both print the error info of mmWrite and mmClose, so return ret after mmClose
GELOGE(FAILED, "[Write][Data]To file %s failed. errno %ld, errmsg %s", file_path, mmpa_ret, strerror(errno));
GELOGE(FAILED, "[Write][Data]To file %s failed. errno %ld, errmsg %s",
file_path, mmpa_ret, strerror(errno));
ret = FAILED;
}
// Close file


+ 10
- 8
ge/common/profiling/profiling_manager.cc View File

@@ -106,7 +106,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ge::Status ProfilingManager::In
static_cast<uint32_t>(MsprofCtrlCallbackType::MSPROF_CTRL_INIT_GE_OPTIONS), cb_ret);
REPORT_CALL_ERROR("E19999", "Call msprofCtrlCallback failed, type %u, return %d",
static_cast<uint32_t>(MsprofCtrlCallbackType::MSPROF_CTRL_INIT_GE_OPTIONS),
cb_ret);
cb_ret);
return FAILED;
}
GELOGI("Profiling init success");
@@ -204,7 +204,7 @@ ge::Status ProfilingManager::ParseOptions(const std::string &options) {
is_training_trace_ = true;
} catch (...) {
GELOGE(FAILED, "[Check][Param]Json prof_conf options is invalid");
REPORT_INNER_ERROR("E19999", "Json prof_conf options is invalid");
REPORT_INNER_ERROR("E19999", "Json prof_conf options is invalid");
return ge::PARAM_INVALID;
}
return ge::SUCCESS;
@@ -234,7 +234,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::StopProf
// stop profiling
if (prof_cb_.msprofCtrlCallback == nullptr) {
GELOGE(ge::PARAM_INVALID, "[Check][Param]MsprofCtrlCallback callback is nullptr");
REPORT_INNER_ERROR("E19999", "MsprofCtrlCallback callback is nullptr");
REPORT_INNER_ERROR("E19999", "MsprofCtrlCallback callback is nullptr");
return;
}
int32_t cb_ret = prof_cb_.msprofCtrlCallback(static_cast<uint32_t>(MsprofCtrlCallbackType::MSPROF_CTRL_FINALIZE),
@@ -299,7 +299,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::Profilin
GELOGE(FAILED, "[Convert][ReportData]Failed to convert json to string, reason %s.",
e.what());
REPORT_CALL_ERROR("E19999", "Failed to convert reported_data from json to string, reason %s",
e.what());
e.what());
return ;
} catch (...) {
GELOGE(FAILED, "[Convert][ReportedData]Failed to convert JSON to string");
@@ -497,7 +497,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfMo
rtError_t rt_ret = rtProfilerStart(module, device_num, device);
if (rt_ret != RT_ERROR_NONE) {
GELOGE(FAILED, "[Start][Profiler]Malloc buffer failed, ret 0x%X", rt_ret);
REPORT_CALL_ERROR("E19999", "Malloc buffer failed when start profiling, ret 0x%X", rt_ret);
REPORT_CALL_ERROR("E19999", "Malloc buffer failed when start profiling, ret 0x%X", rt_ret);
return FAILED;
}
UpdateSubscribeDeviceModuleMap(kProfModelSubscribe, device[0], module);
@@ -533,7 +533,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfMo
rtError_t rt_ret = rtProfilerStop(subs_dev_module_[device[0]].module, dev_num, device);
if (rt_ret != RT_ERROR_NONE) {
GELOGE(FAILED, "[Stop][Profiler]Malloc buffer Failed, ret %d", rt_ret);
REPORT_CALL_ERROR("E19999", "Malloc buffer failed when stop profiling, ret %d", rt_ret);
REPORT_CALL_ERROR("E19999", "Malloc buffer failed when stop profiling, ret %d", rt_ret);
return FAILED;
}
}
@@ -749,7 +749,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfSt

auto device_id_ptr = std::unique_ptr<uint32_t[]>(new (std::nothrow) uint32_t[device_num]);
if (device_id_ptr == nullptr) {
GELOGE(FAILED, "[Start][Profiling]Malloc buffer failed when start profiling, device num %d", device_num);
GELOGE(FAILED, "[Start][Profiling]Malloc buffer failed when start profiling, device num %d",
device_num);
REPORT_CALL_ERROR("E19999", "Malloc buffer failed when start profiling, device num %d",
device_num);
return FAILED;
@@ -799,7 +800,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfSt
}
auto device_id_ptr = std::unique_ptr<uint32_t[]>(new (std::nothrow) uint32_t[device_num]);
if (device_id_ptr == nullptr) {
GELOGE(FAILED, "[Stop][Profiling]Malloc buffer failed when stop profiling, device num %d", device_num);
GELOGE(FAILED, "[Stop][Profiling]Malloc buffer failed when stop profiling, device num %d",
device_num);
REPORT_CALL_ERROR("E19999", "Malloc buffer failed when stop profiling, device num %d",
device_num);
return FAILED;


+ 6
- 5
ge/common/util.cc View File

@@ -288,8 +288,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromText(const ch
google::protobuf::io::IstreamInputStream input(&fs);
bool ret = google::protobuf::TextFormat::Parse(&input, message);
GE_IF_BOOL_EXEC(!ret, ErrorManager::GetInstance().ATCReportErrMessage("E19018", {"protofile"}, {file});
GELOGE(ret, "[Parse][File]Through [google::protobuf::TextFormat::Parse] failed, file %s",
file));
GELOGE(ret, "[Parse][File]Through [google::protobuf::TextFormat::Parse] failed, "
"file %s", file));
fs.close();

return ret;
@@ -554,8 +554,8 @@ FMK_FUNC_HOST_VISIBILITY bool IsValidFile(const char *file_path) {
return false;
}
if (stat.st_size > kMaxConfigFileByte) {
GELOGE(PARAM_INVALID, "[Check][Param]Config file %s size %ld is larger than max config file Bytes %u",
resolved_file_path.c_str(), stat.st_size, kMaxConfigFileByte);
GELOGE(PARAM_INVALID, "[Check][Param]Config file %s size %ld is larger than max config "
"file Bytes %u", resolved_file_path.c_str(), stat.st_size, kMaxConfigFileByte);
REPORT_CALL_ERROR("E19999", "Config file %s size %ld is larger than max config file Bytes %u",
resolved_file_path.c_str(), stat.st_size, kMaxConfigFileByte);
return false;
@@ -586,7 +586,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status CheckPath(const char *pa

INT32 is_dir = mmIsDir(path);
if (is_dir != EN_OK) {
GELOGE(PATH_INVALID, "[Open][Directory]Failed, directory path %s, errmsg %s", path, strerror(errno));
GELOGE(PATH_INVALID, "[Open][Directory]Failed, directory path %s, errmsg %s",
path, strerror(errno));
REPORT_CALL_ERROR("E19999", "Open directory %s failed, errmsg %s", path, strerror(errno));
return PATH_INVALID;
}


+ 21
- 15
ge/engine_manager/dnnengine_manager.cc View File

@@ -107,8 +107,8 @@ Status DNNEngineManager::Initialize(const std::map<std::string, std::string> &op
iter->second->GetAttributes(attrs);
if (attrs.runtime_type == RuntimeType::DEVICE) {
if ((attrs.mem_type.size()) != 1 || (attrs.mem_type[0] != GE_ENGINE_ATTR_MEM_TYPE_HBM)) {
GELOGE(GE_ENG_MEMTYPE_ERROR, "[Check][Param]Engine %s in aicore, but the memory type is not HBM, "
"mem_type_size %d", (iter->first).c_str(), attrs.mem_type.size());
GELOGE(GE_ENG_MEMTYPE_ERROR, "[Check][Param]Engine %s in aicore, but the memory type is "
"not HBM, mem_type_size %d", (iter->first).c_str(), attrs.mem_type.size());
REPORT_CALL_ERROR("E19999", "Engine %s in aicore, but the memory type is not HBM, "
"mem_type_size %d", (iter->first).c_str(), attrs.mem_type.size());
return GE_ENG_MEMTYPE_ERROR;
@@ -246,7 +246,8 @@ std::string DNNEngineManager::GetDNNEngineName(const ge::NodePtr &node_ptr) {
{kernel_name, op_desc->GetType(), op_desc->GetName()});
GELOGE(FAILED,
"[Check][Param]The custom operator registered by the user does not support "
"the logic function delivered by this network, kernel_name %s, op type %s, op name %s",
"the logic function delivered by this network, kernel_name %s, op type %s, "
"op name %s",
kernel_name.c_str(), op_desc->GetType().c_str(), op_desc->GetName().c_str());
std::string error_info = "The custom operator registered by the user does not support the logic function"
"delivered by this network";
@@ -273,8 +274,9 @@ std::string DNNEngineManager::GetDNNEngineName(const ge::NodePtr &node_ptr) {
reason += it.first + ":" + it.second + ";";
ErrorManager::GetInstance().ATCReportErrMessage(
"E13002", {"optype", "opskernel", "reason"}, {op_desc->GetType(), it.first, it.second});
GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED, "[Concat][UnsupportedReasons]Op type %s of ops kernel %s is unsupported, "
"reason %s", op_desc->GetType().c_str(), it.first.c_str(), it.second.c_str());
GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED, "[Concat][UnsupportedReasons]Op type %s of ops kernel %s "
"is unsupported, reason %s",
op_desc->GetType().c_str(), it.first.c_str(), it.second.c_str());
}

analyzer::DataInfo analyze_info{root_graph->GetSessionID(), root_graph->GetGraphID(),
@@ -284,7 +286,8 @@ std::string DNNEngineManager::GetDNNEngineName(const ge::NodePtr &node_ptr) {

ErrorManager::GetInstance().ATCReportErrMessage(
"E13003", {"opname", "optype"}, {op_desc->GetName(), op_desc->GetType()});
GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED, "[Get][DNNEngineName]Can't find any supported ops kernel and engine of %s, type is %s",
GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED, "[Get][DNNEngineName]Can't find any supported ops kernel "
"and engine of %s, type is %s",
op_desc->GetName().c_str(), op_desc->GetType().c_str());
return "";
}
@@ -335,10 +338,10 @@ Status DNNEngineManager::ParserJsonFile() {
return FAILED;
}
if (!scheduler_utils_json.is_array()) {
GELOGE(FAILED, "[Check][Param]The message of kSchedulerUnits is not array and the file path is %s",
json_file_path.c_str());
REPORT_CALL_ERROR("E19999", "The message of kSchedulerUnits is not array and the file path is %s",
json_file_path.c_str());
GELOGE(FAILED, "[Check][Param]The message of kSchedulerUnits is not array and "
"the file path is %s", json_file_path.c_str());
REPORT_CALL_ERROR("E19999", "The message of kSchedulerUnits is not array and "
"the file path is %s", json_file_path.c_str());
return FAILED;
}
auto size = scheduler_json_file[kSchedulerUnits].size();
@@ -362,7 +365,8 @@ Status DNNEngineManager::ParserJsonFile() {
status = ParserEngineMessage(engines_json_map, scheduler_id_temp, engine_conf_map);
if (status != SUCCESS) {
GELOGE(FAILED, "[Parse][EngineMessage]Failed, scheduler_id_temp %s", scheduler_id_temp);
REPORT_CALL_ERROR("E19999", "Parse engine message failed, scheduler_id_temp %s", scheduler_id_temp);
REPORT_CALL_ERROR("E19999", "Parse engine message failed, scheduler_id_temp %s",
scheduler_id_temp);
return FAILED;
}
scheduler_conf.name = scheduler_utils_json[i][kName];
@@ -372,8 +376,8 @@ Status DNNEngineManager::ParserJsonFile() {
if (it != schedulers_.end()) {
GELOGE(FAILED, "[Check][Param]There are the same scheduler ts %s in the json file",
scheduler_id_temp.c_str());
REPORT_CALL_ERROR("E19999", "[Check][Param]There are the same scheduler ts %s in the json file",
scheduler_id_temp.c_str());
REPORT_CALL_ERROR("E19999", "[Check][Param]There are the same scheduler ts %s "
"in the json file", scheduler_id_temp.c_str());
return FAILED;
}
schedulers_.emplace(scheduler_id_temp, scheduler_conf);
@@ -469,8 +473,10 @@ Status DNNEngineManager::ReadJsonFile(const std::string &file_path, JsonHandle h
const char *file = file_path.data();
if ((mmAccess2(file, M_F_OK)) != EN_OK) {
if (engines_map_.size() != 0) {
GELOGE(FAILED, "[Check][Param]The json file %s not exists, err %s", file_path.c_str(), strerror(errno));
REPORT_CALL_ERROR("E19999", "Json file %s not exists, err %s", file_path.c_str(), strerror(errno));
GELOGE(FAILED, "[Check][Param]The json file %s not exists, err %s",
file_path.c_str(), strerror(errno));
REPORT_CALL_ERROR("E19999", "Json file %s not exists, err %s",
file_path.c_str(), strerror(errno));
return FAILED;
} else {
GELOGW("The json file %s is not needed.", file_path.c_str());


Loading…
Cancel
Save