For pkg3 acllib dynamic link.

pull/363/head
unknown 4 years ago
parent 7cde01bf4b
commit 0b666e41b1

@ -33,6 +33,8 @@ 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
@ -45,13 +47,11 @@ 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) {
if (is_train) { std::string lib_paths;
std::string lib_paths; GE_CHK_STATUS_RET_NOLOG(GetLibPaths(options, lib_paths, is_train));
GE_CHK_STATUS_RET_NOLOG(GetLibPaths(options, lib_paths)); plugin_manager_.reset(new (std::nothrow)PluginManager());
plugin_manager_.reset(new (std::nothrow)PluginManager()); GE_CHECK_NOTNULL(plugin_manager_);
GE_CHECK_NOTNULL(plugin_manager_); GE_CHK_STATUS_RET(plugin_manager_->LoadSo(lib_paths), "Failed to load libs");
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,7 +100,8 @@ 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) { Status OpsKernelBuilderManager::GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths,
bool is_train) {
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/";
@ -109,6 +110,9 @@ 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") {

@ -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); 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::unique_ptr<PluginManager> plugin_manager_;
std::map<std::string, OpsKernelBuilderPtr> ops_kernel_builders_{}; std::map<std::string, OpsKernelBuilderPtr> ops_kernel_builders_{};

Loading…
Cancel
Save