!1223 analyzer log optimize

From: @liyihan123
Reviewed-by: @wangxiaotian22,@wqtshg,@ji_chen
Signed-off-by: @ji_chen
pull/1223/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 7d4f374692

@ -103,7 +103,7 @@ ge::Status Analyzer::Initialize() {
// Initialize file // Initialize file
string real_path = RealPath(kFilePath.c_str()); string real_path = RealPath(kFilePath.c_str());
if (real_path.empty()) { if (real_path.empty()) {
GELOGE(FAILED, "File path is invalid."); GELOGE(FAILED, "[Check][AnalyzeFilePath]File path is empty, Path invalid.");
return FAILED; return FAILED;
} }
json_file_name_ = real_path + "/" + kAnalyzeFile; json_file_name_ = real_path + "/" + kAnalyzeFile;
@ -155,12 +155,12 @@ std::shared_ptr<GraphInfo> Analyzer::GetJsonObject(uint64_t session_id, uint64_t
std::lock_guard<std::recursive_mutex> lg(mutex_); std::lock_guard<std::recursive_mutex> lg(mutex_);
auto iter = graph_infos_.find(session_id); auto iter = graph_infos_.find(session_id);
if (iter == graph_infos_.end()) { if (iter == graph_infos_.end()) {
GELOGE(PARAM_INVALID, "session_id:%lu does not exist!", session_id); GELOGE(PARAM_INVALID, "[Check][Session_id]session_id:%lu does not exist! graph_id:%lu.", session_id, graph_id);
return nullptr; return nullptr;
} else { } else {
auto iter1 = (iter->second).find(graph_id); auto iter1 = (iter->second).find(graph_id);
if (iter1 == (iter->second).end()) { if (iter1 == (iter->second).end()) {
GELOGE(PARAM_INVALID, "graph_id:%lu does not exist!", graph_id); GELOGE(PARAM_INVALID, "[Check][Graph_id]graph_id:%lu does not exist! session_id:%lu.", graph_id, session_id);
return nullptr; return nullptr;
} }
GELOGI("GetJsonObject Success!session_id:%lu graph_id:%lu", session_id, graph_id); GELOGI("GetJsonObject Success!session_id:%lu graph_id:%lu", session_id, graph_id);
@ -186,11 +186,11 @@ ge::Status Analyzer::CreateAnalyzerFile() {
std::lock_guard<std::mutex> lg(file_mutex_); std::lock_guard<std::mutex> lg(file_mutex_);
int fd = open(json_file_name_.c_str(), O_WRONLY | O_CREAT | O_TRUNC, kFileAuthority); int fd = open(json_file_name_.c_str(), O_WRONLY | O_CREAT | O_TRUNC, kFileAuthority);
if (fd < 0) { if (fd < 0) {
GELOGE(INTERNAL_ERROR, "Fail to open the file: %s.", json_file_name_.c_str()); GELOGE(INTERNAL_ERROR, "[FileOpen][AnalyzeFile]Fail to open the analyze file: %s.", json_file_name_.c_str());
return INTERNAL_ERROR; return INTERNAL_ERROR;
} }
if (close(fd) != 0) { if (close(fd) != 0) {
GELOGE(INTERNAL_ERROR, "Fail to close the file: %s.", json_file_name_.c_str()); GELOGE(INTERNAL_ERROR, "[FileClose][AnalyzeFile]Fail to close the analyze file: %s.", json_file_name_.c_str());
return INTERNAL_ERROR; return INTERNAL_ERROR;
} }
is_json_file_create_ = true; is_json_file_create_ = true;
@ -200,7 +200,7 @@ ge::Status Analyzer::CreateAnalyzerFile() {
} }
ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_id) { ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_id) {
GELOGD("start to save analyze file!"); GELOGD("start to save analyze file.");
auto graph_info = GetJsonObject(session_id, graph_id); auto graph_info = GetJsonObject(session_id, graph_id);
GE_CHECK_NOTNULL(graph_info); GE_CHECK_NOTNULL(graph_info);
@ -211,7 +211,7 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_
std::lock_guard<std::mutex> lg(file_mutex_); std::lock_guard<std::mutex> lg(file_mutex_);
json_file_.open(json_file_name_, std::ios::app); json_file_.open(json_file_name_, std::ios::app);
if (!json_file_.is_open()) { if (!json_file_.is_open()) {
GELOGE(FAILED, "analyzer file does not exist[%s]", json_file_name_.c_str()); GELOGE(FAILED, "[Check][AnalyzeFile]analyze file does not exist[%s]", json_file_name_.c_str());
return PARAM_INVALID; return PARAM_INVALID;
} }
@ -221,7 +221,7 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_
try { try {
json_file_ << jsn.dump(kJsonDumpLevel) << std::endl; json_file_ << jsn.dump(kJsonDumpLevel) << std::endl;
} catch (nlohmann::detail::type_error &e) { } catch (nlohmann::detail::type_error &e) {
GELOGE(FAILED, "analyzer file [%s] failed because [%s]", json_file_name_.c_str(), e.what()); GELOGE(FAILED, "[Json.dump][GraphInfo]json.dump to analyze file [%s] failed because [%s], session_id:%lu, graph_id:%lu", json_file_name_.c_str(), e.what(), session_id, graph_id);
ret_failed = true; ret_failed = true;
} }
json_file_.close(); json_file_.close();
@ -229,7 +229,7 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_
} }
ge::Status Analyzer::DoAnalyze(DataInfo &data_info) { ge::Status Analyzer::DoAnalyze(DataInfo &data_info) {
GELOGD("start to do analyzer!"); GELOGD("start to do analyzer process!");
auto pnode = data_info.node_ptr; auto pnode = data_info.node_ptr;
GE_CHECK_NOTNULL(pnode); GE_CHECK_NOTNULL(pnode);
@ -241,7 +241,7 @@ ge::Status Analyzer::DoAnalyze(DataInfo &data_info) {
GE_CHECK_NOTNULL(graph_info); GE_CHECK_NOTNULL(graph_info);
auto status = SaveOpInfo(desc, data_info, graph_info); auto status = SaveOpInfo(desc, data_info, graph_info);
if (status != SUCCESS) { if (status != SUCCESS) {
GELOGE(status, "save op info failed!"); GELOGE(status, "[Check][SaveOpInfo]save op info: desc_name [%s] desc_type [%s] failed!", desc->GetName().c_str(), desc->GetType().c_str());
return FAILED; return FAILED;
} }
// create json file // create json file

@ -25,7 +25,7 @@ void CustAICPUKernelStore::AddCustAICPUKernel(const CustAICPUKernelPtr &kernel)
} }
void CustAICPUKernelStore::LoadCustAICPUKernelBinToOpDesc(const std::shared_ptr<ge::OpDesc> &op_desc) const { void CustAICPUKernelStore::LoadCustAICPUKernelBinToOpDesc(const std::shared_ptr<ge::OpDesc> &op_desc) const {
GELOGD("LoadCustAICPUKernelBinToOpDesc in"); GELOGD("LoadCustAICPUKernelBinToOpDesc in.");
if (op_desc != nullptr) { if (op_desc != nullptr) {
auto kernel_bin = FindKernel(op_desc->GetName()); auto kernel_bin = FindKernel(op_desc->GetName());
if (kernel_bin != nullptr) { if (kernel_bin != nullptr) {
@ -34,6 +34,6 @@ void CustAICPUKernelStore::LoadCustAICPUKernelBinToOpDesc(const std::shared_ptr<
GELOGI("Load cust aicpu kernel:%s, %zu", kernel_bin->GetName().c_str(), kernel_bin->GetBinDataSize()); GELOGI("Load cust aicpu kernel:%s, %zu", kernel_bin->GetName().c_str(), kernel_bin->GetBinDataSize());
} }
} }
GELOGD("LoadCustAICPUKernelBinToOpDesc success"); GELOGD("LoadCustAICPUKernelBinToOpDesc success.");
} }
} // namespace ge } // namespace ge

@ -53,7 +53,7 @@ Status CheckArgsForC1hwncoc0ToHwcn(const TransArgs &args) {
return ACL_ERROR_GE_SHAPE_INVALID; return ACL_ERROR_GE_SHAPE_INVALID;
} }
if (!CheckShapeValid(dst_shape, kHwcnDimsNum)) { if (!CheckShapeValid(dst_shape, kHwcnDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(dst_shape).c_str()); GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s.", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID; return ACL_ERROR_GE_SHAPE_INVALID;
} }
auto cube_size = GetCubeSizeByDataType(args.src_data_type); auto cube_size = GetCubeSizeByDataType(args.src_data_type);
@ -144,11 +144,11 @@ Status FormatTransferC1hwncoc0Hwcn::TransFormat(const TransArgs &args, TransResu
result.length = static_cast<size_t>(total_size); result.length = static_cast<size_t>(total_size);
return SUCCESS; return SUCCESS;
} }
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size, GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Get %ld total size from dst shape %s, src shape %s.", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str()); ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID; return ACL_ERROR_GE_SHAPE_INVALID;
} }
GELOGD("Begin to trans format from C1HWNCoC0 to HWCN, src shape %s, data type %s, dst shape %s, memory size %ld", GELOGD("Begin to trans format from C1HWNCoC0 to HWCN, src shape %s, data type %s, dst shape %s, memory size %ld.",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(), ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size); ShapeToString(args.dst_shape).c_str(), total_size);
ret = GetDstDataAfterTrans(args, result, size, total_size); ret = GetDstDataAfterTrans(args, result, size, total_size);
@ -163,7 +163,7 @@ Status FormatTransferC1hwncoc0Hwcn::TransFormat(const TransArgs &args, TransResu
Status FormatTransferC1hwncoc0Hwcn::TransShape(Format src_format, const std::vector<int64_t> &src_shape, Status FormatTransferC1hwncoc0Hwcn::TransShape(Format src_format, const std::vector<int64_t> &src_shape,
DataType data_type, Format dst_format, std::vector<int64_t> &dst_shape) { DataType data_type, Format dst_format, std::vector<int64_t> &dst_shape) {
GELOGD("The shape derivation from C1HWNCoC0 to HWCN is not unique. Trans shape in this direction is not supported"); GELOGD("The shape derivation from C1HWNCoC0 to HWCN is not unique. Trans shape in this direction is not supported.");
return ACL_ERROR_GE_FORMAT_INVALID; return ACL_ERROR_GE_FORMAT_INVALID;
} }

Loading…
Cancel
Save