This commit is contained in:
hwjiaorui 2021-04-01 19:39:45 +08:00
parent 7f86b94be6
commit 178d2fc6af
5 changed files with 16 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#include <unistd.h>
#include <fstream>
#include <thread>
#include "nlohmann/json.hpp"
#include "securec/include/securec.h"
#include "utils/log_adapter.h"
@ -212,7 +213,7 @@ bool KernelPack::LoadKernelMeta(const std::string &json_f, const std::string &pr
} catch (std::exception &e) {
MS_LOG(WARNING) << "Parse json file error: " << json_f << ", sleep 500ms and retry again.";
kernel_json.close();
usleep(500000);
std::this_thread::sleep_for(std::chrono::microseconds(500000));
std::ifstream retry_tmp(json_f);
if (!retry_tmp.is_open()) {
MS_LOG(INFO) << "Open json file: " << json_f << " error, please check kernel_meta.";

View File

@ -164,6 +164,10 @@ bool OpLib::RegOpFromLocalInfo() {
MS_LOG(ERROR) << "Op info path is invalid: " << dir;
return false;
}
if (strlen(real_path) >= PATH_MAX) {
MS_LOG(ERROR) << "Op info path is invalid, the absolute path length is greater than PATH_MAX";
return false;
}
#endif
MS_LOG(INFO) << "Start to read op info from local file.";
std::ifstream file(real_path);

View File

@ -29,6 +29,7 @@
#include "utils/ms_context.h"
#include "runtime/dev.h"
#include "utils/trace_base.h"
#include "utils/ms_utils.h"
namespace mindspore {
namespace kernel {
@ -523,7 +524,11 @@ string TbeKernelJsonCreator::GetSocVersion() {
MS_LOG(EXCEPTION) << "GetSocVersion failed.";
}
// Get soc version from env value.
const char *soc_version_env = getenv(kSOC_VERSION);
const char *soc_version_env = nullptr;
std::string str_soc_version_env = common::GetEnv(kSOC_VERSION);
if (!str_soc_version_env.empty()) {
soc_version_env = common::SafeCStr(str_soc_version_env);
}
if (soc_version_env != nullptr) {
if (std::strcmp(soc_version, soc_version_env) != 0) {
MS_LOG(WARNING) << "SocVerison will be change.";

View File

@ -51,6 +51,9 @@ size_t GetSmallSplitSize(const AnfNodePtr &split_node, int64_t split_dim, int64_
if (LongToSize(split_dim) >= input_shape.size()) {
MS_LOG(EXCEPTION) << "The split_dim value should be less than the shape size of input 0";
}
if (num_split == 0) {
MS_LOG(EXCEPTION) << "Divisor 'num_split' should not be 0.";
}
return input_shape[split_dim] / num_split;
}

View File

@ -1380,7 +1380,7 @@ vector<CNodePtr> AscendStreamAssign::GetLastInputCnode(const NotNull<KernelGraph
}
vector<CNodePtr> final_inputs;
uint32_t max = 0;
const uint32_t max = 0;
CNodePtr max_common_cnode = nullptr;
for (const auto &item : result) {
if (IsHcom(item.second.first)) {