Remove old API from Core implementation (#18892)

This commit is contained in:
Ilya Churaev
2023-08-01 13:00:55 +04:00
committed by GitHub
parent 4a6282a6f5
commit c8bdefec30
4 changed files with 18 additions and 19 deletions

View File

@@ -12,13 +12,14 @@
#include "openvino/core/so_extension.hpp"
#include "openvino/runtime/device_id_parser.hpp"
#include "openvino/runtime/iremote_context.hpp"
#include "openvino/util/file_util.hpp"
namespace {
std::string resolve_extension_path(const std::string& path) {
std::string retvalue;
try {
const std::string absolute_path = ov::util::get_absolute_file_path(path);
retvalue = FileUtils::fileExist(absolute_path) ? absolute_path : path;
retvalue = ov::util::file_exists(absolute_path) ? absolute_path : path;
} catch (const std::runtime_error&) {
retvalue = path;
}
@@ -29,30 +30,28 @@ std::string resolve_extension_path(const std::string& path) {
namespace ov {
std::string findPluginXML(const std::string& xmlFile) {
std::string xmlConfigFile_ = xmlFile;
if (xmlConfigFile_.empty()) {
const auto ielibraryDir = ie::getInferenceEngineLibraryPath();
std::string find_plugins_xml(const std::string& xml_file) {
if (xml_file.empty()) {
const auto ov_library_path = ov::util::get_ov_lib_path();
// plugins.xml can be found in either:
// 1. openvino-X.Y.Z relative to libopenvino.so folder
std::ostringstream str;
str << "openvino-" << OPENVINO_VERSION_MAJOR << "." << OPENVINO_VERSION_MINOR << "." << OPENVINO_VERSION_PATCH;
const auto subFolder = ov::util::to_file_path(str.str());
const auto sub_folder = str.str();
// register plugins from default openvino-<openvino version>/plugins.xml config
ov::util::FilePath xmlConfigFileDefault =
FileUtils::makePath(FileUtils::makePath(ielibraryDir, subFolder), ov::util::to_file_path("plugins.xml"));
if (FileUtils::fileExist(xmlConfigFileDefault))
return xmlConfigFile_ = ov::util::from_file_path(xmlConfigFileDefault);
auto xmlConfigFileDefault = ov::util::path_join({ov_library_path, sub_folder, "plugins.xml"});
if (ov::util::file_exists(xmlConfigFileDefault))
return xmlConfigFileDefault;
// 2. in folder with libopenvino.so
xmlConfigFileDefault = FileUtils::makePath(ielibraryDir, ov::util::to_file_path("plugins.xml"));
if (FileUtils::fileExist(xmlConfigFileDefault))
return xmlConfigFile_ = ov::util::from_file_path(xmlConfigFileDefault);
xmlConfigFileDefault = ov::util::path_join({ov_library_path, "plugins.xml"});
if (ov::util::file_exists(xmlConfigFileDefault))
return xmlConfigFileDefault;
}
return xmlConfigFile_;
return xml_file;
}
#define OV_CORE_CALL_STATEMENT(...) \
@@ -72,7 +71,7 @@ public:
Core::Core(const std::string& xml_config_file) {
_impl = std::make_shared<Impl>();
std::string xmlConfigFile = ov::findPluginXML(xml_config_file);
std::string xmlConfigFile = ov::find_plugins_xml(xml_config_file);
if (!xmlConfigFile.empty())
OV_CORE_CALL_STATEMENT(
// If XML is default, load default plugins by absolute paths

View File

@@ -52,7 +52,7 @@ Parsed parseDeviceNameIntoConfig(const std::string& deviceName,
*/
bool is_config_applicable(const std::string& device_name, const std::string& device_name_to_parse);
std::string findPluginXML(const std::string& xmlFile);
std::string find_plugins_xml(const std::string& xmlFile);
class CoreImpl : public InferenceEngine::ICore, public std::enable_shared_from_this<InferenceEngine::ICore> {
private:

View File

@@ -86,7 +86,7 @@ public:
Core::Core(const std::string& xmlConfigFile) {
_impl = std::make_shared<Impl>();
std::string xmlConfigFile_ = ov::findPluginXML(xmlConfigFile);
std::string xmlConfigFile_ = ov::find_plugins_xml(xmlConfigFile);
if (!xmlConfigFile_.empty())
// If XML is default, load default plugins by absolute paths
_impl->register_plugins_in_registry(xmlConfigFile_, xmlConfigFile.empty());

View File

@@ -27,5 +27,5 @@
#include <utility>
#include <vector>
#include "ngraph/ngraph.hpp"
#include "ngraph/ops.hpp"
#include "openvino/op/ops.hpp"
#include "openvino/openvino.hpp"