From 4bb75fd3081409a8701219b1503bf80bec36e5e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Dec 2020 10:57:38 +0800 Subject: [PATCH] fix bud. --- .../ops_kernel_builder_manager.cc | 20 ++++++++----------- .../ops_kernel_builder_manager.h | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ge/opskernel_manager/ops_kernel_builder_manager.cc b/ge/opskernel_manager/ops_kernel_builder_manager.cc index 167be47b..e0001fcd 100644 --- a/ge/opskernel_manager/ops_kernel_builder_manager.cc +++ b/ge/opskernel_manager/ops_kernel_builder_manager.cc @@ -33,8 +33,6 @@ const std::vector kHcclBuilderLibs = { "libhvd_opskernel_builder.so", "libhcom_gradtune_opskernel_builder.so" }; - -const std::string kAicoreUtilsLib = "libaicore_utils_runtime.so"; } // namespace OpsKernelBuilderManager::~OpsKernelBuilderManager() { // it's OK to call Finalize multiply times @@ -47,11 +45,13 @@ OpsKernelBuilderManager &OpsKernelBuilderManager::Instance() { } Status OpsKernelBuilderManager::Initialize(const map &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(); GELOGI("Number of OpBuild = %zu", kernel_builders.size()); @@ -100,8 +100,7 @@ OpsKernelBuilderPtr OpsKernelBuilderManager::GetOpsKernelBuilder(const string &n return nullptr; } -Status OpsKernelBuilderManager::GetLibPaths(const std::map &options, std::string &lib_paths, - bool is_train) { +Status OpsKernelBuilderManager::GetLibPaths(const std::map &options, std::string &lib_paths) { GELOGD("Start to execute GetLibPaths"); std::string path_base = PluginManager::GetPath(); std::string so_path = "plugin/opskernel/"; @@ -110,9 +109,6 @@ Status OpsKernelBuilderManager::GetLibPaths(const std::mapsecond != "0") { diff --git a/ge/opskernel_manager/ops_kernel_builder_manager.h b/ge/opskernel_manager/ops_kernel_builder_manager.h index 207ebc79..7a95ddfa 100644 --- a/ge/opskernel_manager/ops_kernel_builder_manager.h +++ b/ge/opskernel_manager/ops_kernel_builder_manager.h @@ -48,7 +48,7 @@ class OpsKernelBuilderManager { private: OpsKernelBuilderManager() = default; - static Status GetLibPaths(const std::map &options, std::string &lib_paths, bool is_train); + static Status GetLibPaths(const std::map &options, std::string &lib_paths); std::unique_ptr plugin_manager_; std::map ops_kernel_builders_{};