!19424 Fixing CPU dump issue

Merge pull request !19424 from parastooashtari/cpu_dump
This commit is contained in:
i-robot 2021-07-06 03:58:32 +00:00 committed by Gitee
commit d9b8429631
1 changed files with 3 additions and 0 deletions

View File

@ -325,6 +325,7 @@ void DumpJsonParser::ParseNetName(const nlohmann::json &content) {
void DumpJsonParser::ParseIteration(const nlohmann::json &content) {
CheckJsonStringType(content, kIteration);
auto context = MsContext::GetInstance();
if (e2e_dump_enabled_ || async_dump_enabled_) {
iteration_ = content;
if (iteration_.empty() || (!std::all_of(iteration_.begin(), iteration_.end(), [](char c) {
@ -332,6 +333,8 @@ void DumpJsonParser::ParseIteration(const nlohmann::json &content) {
}) && iteration_ != "all")) {
MS_LOG(EXCEPTION) << "iteration only supports digits, {'-', '|'}, or just \"all\" but got: " << iteration_;
}
} else if (context->get_param<std::string>(MS_CTX_DEVICE_TARGET) == kCPUDevice) {
MS_LOG(WARNING) << "Dump not enabled. ";
} else {
MS_LOG(EXCEPTION) << "Dump Json Parse Failed. Async or E2E should be enabled. ";
}