Browse Source

For pkg3 acllib dynamic link.

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

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

@@ -33,6 +33,8 @@ const std::vector<std::string> 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
@@ -45,13 +47,11 @@ OpsKernelBuilderManager &OpsKernelBuilderManager::Instance() {
}

Status OpsKernelBuilderManager::Initialize(const map<std::string, std::string> &options, bool is_train) {
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");
}
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");

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

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

auto iter = options.find(OPTION_EXEC_HCCL_FLAG);
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:
OpsKernelBuilderManager() = default;
static Status GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths);
static Status GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths, bool is_train);

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


Loading…
Cancel
Save