Browse Source

!24874 Code clean of mc

Merge pull request !24874 from chenfei_mindspore/code_clean_1012
tags/v1.6.0
i-robot Gitee 4 years ago
parent
commit
7ef95c4df9
3 changed files with 15 additions and 32 deletions
  1. +1
    -13
      mindspore/ccsrc/debug/anf_ir_dump.cc
  2. +13
    -18
      mindspore/ccsrc/debug/data_dump/dump_json_parser.cc
  3. +1
    -1
      mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.h

+ 1
- 13
mindspore/ccsrc/debug/anf_ir_dump.cc View File

@@ -375,21 +375,9 @@ void DumpCNodePrimalAttrs(const CNodePtr &op, const std::shared_ptr<SubGraphIRIn
gsub->buffer << std::endl;
return;
}

auto primal_attrs = op->primal_attrs();
gsub->buffer << " cnode_primal_attrs: {";
int i = 0;
for (const auto &attr : primal_attrs) {
if (i++ != 0) {
gsub->buffer << ", ";
}
gsub->buffer << attr.first << ": ";
if (attr.second == nullptr) {
gsub->buffer << "null";
} else {
gsub->buffer << attr.second->ToString();
}
}
DumpAttrs(primal_attrs, gsub);
gsub->buffer << "}";
gsub->buffer << std::endl;
}


+ 13
- 18
mindspore/ccsrc/debug/data_dump/dump_json_parser.cc View File

@@ -123,6 +123,17 @@ void DumpJsonParser::Parse() {
JudgeDumpEnabled();
}

void WriteJsonFile(const std::string &file_path, const std::ifstream &json_file) {
ChangeFileMode(file_path, S_IWUSR);
std::ofstream json_copy(file_path);
if (!json_copy.is_open()) {
MS_LOG(EXCEPTION) << "Json file " << file_path << "open failed!";
}
json_copy << json_file.rdbuf();
json_copy.close();
ChangeFileMode(file_path, S_IRUSR);
}

void DumpJsonParser::CopyJsonToDir(uint32_t rank_id) {
this->Parse();
if (!IsDumpEnabled()) {
@@ -139,15 +150,7 @@ void DumpJsonParser::CopyJsonToDir(uint32_t rank_id) {
if (!realpath.has_value()) {
MS_LOG(ERROR) << "Get real path failed in CopyJsonDir.";
} else {
const std::string file_path = realpath.value();
ChangeFileMode(file_path, S_IWUSR);
std::ofstream json_copy(file_path);
if (!json_copy.is_open()) {
MS_LOG(EXCEPTION) << "Json file " << file_path << "open failed!";
}
json_copy << json_file.rdbuf();
json_copy.close();
ChangeFileMode(file_path, S_IRUSR);
WriteJsonFile(realpath.value(), json_file);
}
}
}
@@ -169,15 +172,7 @@ void DumpJsonParser::CopyHcclJsonToDir(uint32_t rank_id) {
if (!realpath.has_value()) {
MS_LOG(ERROR) << "Get real path failed in CopyHcclJsonToDir.";
} else {
const std::string file_path = realpath.value();
ChangeFileMode(file_path, S_IWUSR);
std::ofstream json_copy(file_path);
if (!json_copy.is_open()) {
MS_LOG(EXCEPTION) << "Json file " << file_path << "open failed!";
}
json_copy << json_file.rdbuf();
json_copy.close();
ChangeFileMode(file_path, S_IRUSR);
WriteJsonFile(realpath.value(), json_file);
}
}



+ 1
- 1
mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.h View File

@@ -342,7 +342,7 @@ class AsyncInferTask {
AsyncAbstractPtr abstract_ptr_;
std::mutex lock_;
std::condition_variable condition_var_;
int ready_{0}; // 0: not ready, bit 1 = 1: ready, bit 2 = 1: exception, bit 3 = 1: endless loop
size_t ready_{0}; // 0: not ready, bit 1 = 1: ready, bit 2 = 1: exception, bit 3 = 1: endless loop
};

using EvaluatorCacheMap =


Loading…
Cancel
Save