Fix ascend init error

This commit is contained in:
sjtujayyyy 2023-03-06 19:55:01 +08:00
parent d1a4199d05
commit d5cbb8aa11
2 changed files with 10 additions and 0 deletions

View File

@ -62,6 +62,11 @@ Status AscendKernelPlugin::TryRegisterInner() {
Dl_info dl_info; Dl_info dl_info;
dladdr(reinterpret_cast<void *>(this), &dl_info); dladdr(reinterpret_cast<void *>(this), &dl_info);
std::string cur_so_path = dl_info.dli_fname; std::string cur_so_path = dl_info.dli_fname;
auto converter_pos = cur_so_path.find("libmindspore_converter.so");
if (converter_pos != std::string::npos) {
MS_LOG(INFO) << "libmindspore_converter.so does not need to register";
return kSuccess;
}
auto pos = cur_so_path.find("libmindspore-lite.so"); auto pos = cur_so_path.find("libmindspore-lite.so");
if (pos == std::string::npos) { if (pos == std::string::npos) {
MS_LOG(DEBUG) << "Could not find libmindspore-lite so, cur so path: " << cur_so_path; MS_LOG(DEBUG) << "Could not find libmindspore-lite so, cur so path: " << cur_so_path;

View File

@ -38,6 +38,11 @@ int AscendKernelPlugin::Register() {
Dl_info dl_info; Dl_info dl_info;
dladdr(reinterpret_cast<void *>(this), &dl_info); dladdr(reinterpret_cast<void *>(this), &dl_info);
std::string cur_so_path = dl_info.dli_fname; std::string cur_so_path = dl_info.dli_fname;
auto converter_pos = cur_so_path.find("libmindspore_converter.so");
if (converter_pos != std::string::npos) {
MS_LOG(INFO) << "libmindspore_converter.so does not need to register";
return lite::RET_OK;
}
auto pos = cur_so_path.find("libmindspore-lite.so"); auto pos = cur_so_path.find("libmindspore-lite.so");
if (pos == std::string::npos) { if (pos == std::string::npos) {
MS_LOG(DEBUG) << "Could not find libmindspore-lite so, cur so path: " << cur_so_path; MS_LOG(DEBUG) << "Could not find libmindspore-lite so, cur so path: " << cur_so_path;