Browse Source

fix bud.

tags/v1.2.0
unknown 3 years ago
parent
commit
4bb75fd308
2 changed files with 9 additions and 13 deletions
  1. +8
    -12
      ge/opskernel_manager/ops_kernel_builder_manager.cc
  2. +1
    -1
      ge/opskernel_manager/ops_kernel_builder_manager.h

+ 8
- 12
ge/opskernel_manager/ops_kernel_builder_manager.cc View File

@@ -33,8 +33,6 @@ const std::vector<std::string> kHcclBuilderLibs = {
"libhvd_opskernel_builder.so", "libhvd_opskernel_builder.so",
"libhcom_gradtune_opskernel_builder.so" "libhcom_gradtune_opskernel_builder.so"
}; };

const std::string kAicoreUtilsLib = "libaicore_utils_runtime.so";
} // namespace } // namespace
OpsKernelBuilderManager::~OpsKernelBuilderManager() { OpsKernelBuilderManager::~OpsKernelBuilderManager() {
// it's OK to call Finalize multiply times // it's OK to call Finalize multiply times
@@ -47,11 +45,13 @@ OpsKernelBuilderManager &OpsKernelBuilderManager::Instance() {
} }


Status OpsKernelBuilderManager::Initialize(const map<std::string, std::string> &options, bool is_train) { Status OpsKernelBuilderManager::Initialize(const map<std::string, std::string> &options, bool is_train) {
std::string lib_paths;
GE_CHK_STATUS_RET_NOLOG(GetLibPaths(options, lib_paths, is_train));
plugin_manager_.reset(new (std::nothrow)PluginManager());
GE_CHECK_NOTNULL(plugin_manager_);
GE_CHK_STATUS_RET(plugin_manager_->LoadSo(lib_paths), "Failed to load libs");
if (is_train) {
std::string lib_paths;
GE_CHK_STATUS_RET_NOLOG(GetLibPaths(options, lib_paths));
plugin_manager_.reset(new (std::nothrow)PluginManager());
GE_CHECK_NOTNULL(plugin_manager_);
GE_CHK_STATUS_RET(plugin_manager_->LoadSo(lib_paths), "Failed to load libs");
}


auto &kernel_builders = OpsKernelBuilderRegistry::GetInstance().GetAll(); auto &kernel_builders = OpsKernelBuilderRegistry::GetInstance().GetAll();
GELOGI("Number of OpBuild = %zu", kernel_builders.size()); GELOGI("Number of OpBuild = %zu", kernel_builders.size());
@@ -100,8 +100,7 @@ OpsKernelBuilderPtr OpsKernelBuilderManager::GetOpsKernelBuilder(const string &n
return nullptr; return nullptr;
} }


Status OpsKernelBuilderManager::GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths,
bool is_train) {
Status OpsKernelBuilderManager::GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths) {
GELOGD("Start to execute GetLibPaths"); GELOGD("Start to execute GetLibPaths");
std::string path_base = PluginManager::GetPath(); std::string path_base = PluginManager::GetPath();
std::string so_path = "plugin/opskernel/"; std::string so_path = "plugin/opskernel/";
@@ -110,9 +109,6 @@ Status OpsKernelBuilderManager::GetLibPaths(const std::map<std::string, std::str
for (const auto &lib_name : kBasicBuilderLibs) { for (const auto &lib_name : kBasicBuilderLibs) {
all_lib_paths += (path + lib_name + ":"); all_lib_paths += (path + lib_name + ":");
} }
if (!is_train) {
all_lib_paths += (path_base + kAicoreUtilsLib + ":");
}


auto iter = options.find(OPTION_EXEC_HCCL_FLAG); auto iter = options.find(OPTION_EXEC_HCCL_FLAG);
if (iter == options.end() || iter->second != "0") { if (iter == options.end() || iter->second != "0") {


+ 1
- 1
ge/opskernel_manager/ops_kernel_builder_manager.h View File

@@ -48,7 +48,7 @@ class OpsKernelBuilderManager {


private: private:
OpsKernelBuilderManager() = default; OpsKernelBuilderManager() = default;
static Status GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths, bool is_train);
static Status GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths);


std::unique_ptr<PluginManager> plugin_manager_; std::unique_ptr<PluginManager> plugin_manager_;
std::map<std::string, OpsKernelBuilderPtr> ops_kernel_builders_{}; std::map<std::string, OpsKernelBuilderPtr> ops_kernel_builders_{};


Loading…
Cancel
Save