OV 2.0 c++ configuration API (#9870)
* New configuration API * Review fix * review coments * fixed device name map * fixed header * code stile * fixed optimization capabilities * flatten properties * dox fix * doc * merge conflicts * fixed merge conflicts * Fixed subobject linkage warning * foramt fix * Fixed unity test build * Merge conflict fixes * Fixed variadic
This commit is contained in:
parent
3bd6eb6dcd
commit
f45991bd64
@ -20,13 +20,13 @@ const std::vector<ov::element::Type_t> netPrecisions = {
|
||||
ov::element::f16,
|
||||
ov::element::f32,
|
||||
};
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
};
|
||||
const std::vector<std::map<std::string, std::string>> multiConfigs = {
|
||||
const std::vector<ov::AnyMap> multiConfigs = {
|
||||
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_TEMPLATE}}};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
|
||||
const std::vector<ov::AnyMap> heteroConfigs = {
|
||||
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
|
||||
|
@ -9,7 +9,7 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
};
|
||||
|
||||
|
@ -10,11 +10,11 @@ using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> HeteroConfigs = {
|
||||
const std::vector<ov::AnyMap> HeteroConfigs = {
|
||||
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestDynamicTests,
|
||||
|
@ -9,11 +9,11 @@ using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> HeteroConfigs = {
|
||||
const std::vector<ov::AnyMap> HeteroConfigs = {
|
||||
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferenceChaining,
|
||||
|
@ -9,7 +9,7 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
@ -38,12 +38,12 @@ std::vector<ov::element::Type> prcs = {
|
||||
ov::element::u64,
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> emptyConfigs = {{}};
|
||||
const std::vector<ov::AnyMap> emptyConfigs = {{}};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> HeteroConfigs = {
|
||||
const std::vector<ov::AnyMap> HeteroConfigs = {
|
||||
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
|
||||
const std::vector<ov::AnyMap> Multiconfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_TEMPLATE}}
|
||||
};
|
||||
|
||||
|
@ -10,7 +10,7 @@ using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -110,7 +110,7 @@ std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesSingleThread = {
|
||||
ngraph::helpers::EltwiseTypes::POWER,
|
||||
};
|
||||
|
||||
std::map<std::string, std::string> additional_config_single_thread = {
|
||||
ov::AnyMap additional_config_single_thread = {
|
||||
{"CPU_THREADS_NUM", "1"}
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,7 @@ const auto params2D_static = testing::Combine(
|
||||
testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputStaticShape2D)),
|
||||
testing::ValuesIn(axis2D),
|
||||
testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
|
||||
testing::Values(std::map<std::string, std::string>())
|
||||
testing::Values(ov::AnyMap())
|
||||
);
|
||||
|
||||
const auto params2D_dynamic = testing::Combine(
|
||||
@ -50,7 +50,7 @@ const auto params2D_dynamic = testing::Combine(
|
||||
testing::ValuesIn(inputDynamicShape2D),
|
||||
testing::ValuesIn(axis2D),
|
||||
testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
|
||||
testing::Values(std::map<std::string, std::string>())
|
||||
testing::Values(ov::AnyMap())
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
@ -88,7 +88,7 @@ const auto params4Dstatic = testing::Combine(
|
||||
testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputStaticShape4D)),
|
||||
testing::ValuesIn(axis4D),
|
||||
testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
|
||||
testing::Values(std::map<std::string, std::string>())
|
||||
testing::Values(ov::AnyMap())
|
||||
);
|
||||
|
||||
const auto params4Ddynamic = testing::Combine(
|
||||
@ -98,7 +98,7 @@ const auto params4Ddynamic = testing::Combine(
|
||||
testing::ValuesIn(inputDynamicShape4D),
|
||||
testing::ValuesIn(axis4D),
|
||||
testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
|
||||
testing::Values(std::map<std::string, std::string>())
|
||||
testing::Values(ov::AnyMap())
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
|
@ -158,8 +158,7 @@ int main(int argc, char* argv[]) {
|
||||
std::map<std::string, std::string> device_nstreams = parse_nstreams_value_per_device(devices, FLAGS_nstreams);
|
||||
|
||||
// Load device config file if specified
|
||||
std::map<std::string, std::map<std::string, std::string>> config;
|
||||
|
||||
std::map<std::string, ov::AnyMap> config;
|
||||
if (!FLAGS_load_config.empty()) {
|
||||
load_config(FLAGS_load_config, config);
|
||||
}
|
||||
@ -187,15 +186,15 @@ int main(int argc, char* argv[]) {
|
||||
config["GPU"][CONFIG_KEY(CONFIG_FILE)] = FLAGS_c;
|
||||
}
|
||||
if (config.count("GPU") && config.at("GPU").count(CONFIG_KEY(CONFIG_FILE))) {
|
||||
auto ext = config.at("GPU").at(CONFIG_KEY(CONFIG_FILE));
|
||||
core.set_config({{CONFIG_KEY(CONFIG_FILE), ext}}, "GPU");
|
||||
auto ext = config.at("GPU").at(CONFIG_KEY(CONFIG_FILE)).as<std::string>();
|
||||
core.set_property("GPU", {{CONFIG_KEY(CONFIG_FILE), ext}});
|
||||
slog::info << "GPU extensions is loaded " << ext << slog::endl;
|
||||
}
|
||||
|
||||
if (FLAGS_hint.empty()) {
|
||||
for (auto& device : devices) {
|
||||
std::vector<std::string> supported_config_keys =
|
||||
core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
core.get_property(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
if (std::find(supported_config_keys.begin(),
|
||||
supported_config_keys.end(),
|
||||
CONFIG_KEY(PERFORMANCE_HINT)) != supported_config_keys.end()) {
|
||||
@ -244,7 +243,7 @@ int main(int argc, char* argv[]) {
|
||||
for (auto& device : devices) {
|
||||
if (!config.count(device))
|
||||
config[device] = {};
|
||||
std::map<std::string, std::string>& device_config = config.at(device);
|
||||
auto& device_config = config.at(device);
|
||||
|
||||
// high-level performance modes
|
||||
if (!ov_perf_hint.empty()) {
|
||||
@ -258,7 +257,7 @@ int main(int argc, char* argv[]) {
|
||||
// set to user defined value
|
||||
device_config[CONFIG_KEY(PERF_COUNT)] = FLAGS_pc ? CONFIG_VALUE(YES) : CONFIG_VALUE(NO);
|
||||
} else if (device_config.count(CONFIG_KEY(PERF_COUNT)) &&
|
||||
(device_config.at(CONFIG_KEY(PERF_COUNT)) == "YES")) {
|
||||
(device_config.at(CONFIG_KEY(PERF_COUNT)).as<std::string>() == "YES")) {
|
||||
slog::warn << "Performance counters for " << device
|
||||
<< " device is turned on. To print results use -pc option." << slog::endl;
|
||||
} else if (FLAGS_report_type == detailedCntReport || FLAGS_report_type == averageCntReport) {
|
||||
@ -273,7 +272,8 @@ int main(int argc, char* argv[]) {
|
||||
// set to default value
|
||||
device_config[CONFIG_KEY(PERF_COUNT)] = FLAGS_pc ? CONFIG_VALUE(YES) : CONFIG_VALUE(NO);
|
||||
}
|
||||
perf_counts = (device_config.at(CONFIG_KEY(PERF_COUNT)) == CONFIG_VALUE(YES)) ? true : perf_counts;
|
||||
perf_counts =
|
||||
(device_config.at(CONFIG_KEY(PERF_COUNT)).as<std::string>() == CONFIG_VALUE(YES)) ? true : perf_counts;
|
||||
|
||||
// the rest are individual per-device settings (overriding the values set with perf modes)
|
||||
auto setThroughputStreams = [&]() {
|
||||
@ -281,7 +281,7 @@ int main(int argc, char* argv[]) {
|
||||
if (device_nstreams.count(device)) {
|
||||
// set to user defined value
|
||||
std::vector<std::string> supported_config_keys =
|
||||
core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
core.get_property(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
if (std::find(supported_config_keys.begin(), supported_config_keys.end(), key) ==
|
||||
supported_config_keys.end()) {
|
||||
throw std::logic_error("Device " + device + " doesn't support config key '" + key + "'! " +
|
||||
@ -303,7 +303,7 @@ int main(int argc, char* argv[]) {
|
||||
device_config[key] = std::string(getDeviceTypeFromName(device) + "_THROUGHPUT_AUTO");
|
||||
}
|
||||
if (device_config.count(key))
|
||||
device_nstreams[device] = device_config.at(key);
|
||||
device_nstreams[device] = device_config.at(key).as<std::string>();
|
||||
};
|
||||
|
||||
if (device.find("CPU") != std::string::npos) { // CPU supports few special performance-oriented keys
|
||||
@ -351,7 +351,7 @@ int main(int argc, char* argv[]) {
|
||||
device_config[GNA_CONFIG_KEY(PRECISION)] = "I16";
|
||||
} else {
|
||||
std::vector<std::string> supported_config_keys =
|
||||
core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
core.get_property(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
auto supported = [&](const std::string& key) {
|
||||
return std::find(std::begin(supported_config_keys), std::end(supported_config_keys), key) !=
|
||||
std::end(supported_config_keys);
|
||||
@ -369,7 +369,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
for (auto&& item : config) {
|
||||
core.set_config(item.second, item.first);
|
||||
core.set_property(item.first, item.second);
|
||||
}
|
||||
|
||||
size_t batchSize = FLAGS_b;
|
||||
@ -380,7 +380,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
// Takes priority over config from file
|
||||
if (!FLAGS_cache_dir.empty()) {
|
||||
core.set_config({{CONFIG_KEY(CACHE_DIR), FLAGS_cache_dir}});
|
||||
core.set_property({{CONFIG_KEY(CACHE_DIR), FLAGS_cache_dir}});
|
||||
}
|
||||
|
||||
bool isDynamicNetwork = false;
|
||||
@ -464,7 +464,7 @@ int main(int argc, char* argv[]) {
|
||||
next_step();
|
||||
auto preproc = ov::preprocess::PrePostProcessor(model);
|
||||
|
||||
ov::ConfigMap user_precisions_map;
|
||||
std::map<std::string, std::string> user_precisions_map;
|
||||
if (!FLAGS_iop.empty()) {
|
||||
user_precisions_map = parseArgMap(FLAGS_iop);
|
||||
}
|
||||
@ -618,11 +618,12 @@ int main(int argc, char* argv[]) {
|
||||
next_step();
|
||||
// output of the actual settings that the device selected
|
||||
for (const auto& device : devices) {
|
||||
std::vector<std::string> supported_config_keys = core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
std::vector<std::string> supported_config_keys =
|
||||
core.get_property(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
slog::info << "Device: " << device << slog::endl;
|
||||
for (const auto& cfg : supported_config_keys) {
|
||||
try {
|
||||
slog::info << " {" << cfg << " , " << compiledModel.get_config(cfg).as<std::string>();
|
||||
slog::info << " {" << cfg << " , " << compiledModel.get_property(cfg).as<std::string>();
|
||||
slog::info << " }" << slog::endl;
|
||||
} catch (...) {
|
||||
};
|
||||
@ -632,7 +633,7 @@ int main(int argc, char* argv[]) {
|
||||
// Update number of streams
|
||||
for (auto&& ds : device_nstreams) {
|
||||
const std::string key = getDeviceTypeFromName(ds.first) + "_THROUGHPUT_STREAMS";
|
||||
device_nstreams[ds.first] = core.get_config(ds.first, key).as<std::string>();
|
||||
device_nstreams[ds.first] = core.get_property(ds.first, key).as<std::string>();
|
||||
}
|
||||
|
||||
// Number of requests
|
||||
@ -643,7 +644,7 @@ int main(int argc, char* argv[]) {
|
||||
} else {
|
||||
std::string key = METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS);
|
||||
try {
|
||||
nireq = compiledModel.get_metric(key).as<unsigned int>();
|
||||
nireq = compiledModel.get_property(key).as<unsigned int>();
|
||||
} catch (const std::exception& ex) {
|
||||
IE_THROW() << "Every device used with the benchmark_app should "
|
||||
<< "support OPTIMAL_NUMBER_OF_INFER_REQUESTS metric. "
|
||||
|
@ -647,7 +647,7 @@ std::vector<benchmark_app::InputsInfo> get_inputs_info(const std::string& shape_
|
||||
}
|
||||
|
||||
#ifdef USE_OPENCV
|
||||
void dump_config(const std::string& filename, const std::map<std::string, std::map<std::string, std::string>>& config) {
|
||||
void dump_config(const std::string& filename, const std::map<std::string, ov::AnyMap>& config) {
|
||||
slog::warn << "YAML and XML formats for config file won't be supported soon." << slog::endl;
|
||||
auto plugin_to_opencv_format = [](const std::string& str) -> std::string {
|
||||
if (str.find("_") != std::string::npos) {
|
||||
@ -668,14 +668,18 @@ void dump_config(const std::string& filename, const std::map<std::string, std::m
|
||||
throw std::runtime_error("Error: Can't open config file : " + filename);
|
||||
for (auto device_it = config.begin(); device_it != config.end(); ++device_it) {
|
||||
fs << plugin_to_opencv_format(device_it->first) << "{:";
|
||||
for (auto param_it = device_it->second.begin(); param_it != device_it->second.end(); ++param_it)
|
||||
fs << param_it->first << param_it->second;
|
||||
std::stringstream strm;
|
||||
for (auto param_it = device_it->second.begin(); param_it != device_it->second.end(); ++param_it) {
|
||||
strm << param_it->first;
|
||||
param_it->second.print(strm);
|
||||
}
|
||||
fs << strm.str();
|
||||
fs << "}";
|
||||
}
|
||||
fs.release();
|
||||
}
|
||||
|
||||
void load_config(const std::string& filename, std::map<std::string, std::map<std::string, std::string>>& config) {
|
||||
void load_config(const std::string& filename, std::map<std::string, ov::AnyMap>& config) {
|
||||
slog::warn << "YAML and XML formats for config file won't be supported soon." << slog::endl;
|
||||
auto opencv_to_plugin_format = [](const std::string& str) -> std::string {
|
||||
std::string new_str(str);
|
||||
@ -701,12 +705,14 @@ void load_config(const std::string& filename, std::map<std::string, std::map<std
|
||||
}
|
||||
}
|
||||
#else
|
||||
void dump_config(const std::string& filename, const std::map<std::string, std::map<std::string, std::string>>& config) {
|
||||
void dump_config(const std::string& filename, const std::map<std::string, ov::AnyMap>& config) {
|
||||
nlohmann::json jsonConfig;
|
||||
for (const auto& item : config) {
|
||||
std::string deviceName = item.first;
|
||||
for (const auto& option : item.second) {
|
||||
jsonConfig[deviceName][option.first] = option.second;
|
||||
std::stringstream strm;
|
||||
option.second.print(strm);
|
||||
jsonConfig[deviceName][option.first] = strm.str();
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,7 +724,7 @@ void dump_config(const std::string& filename, const std::map<std::string, std::m
|
||||
ofs << jsonConfig;
|
||||
}
|
||||
|
||||
void load_config(const std::string& filename, std::map<std::string, std::map<std::string, std::string>>& config) {
|
||||
void load_config(const std::string& filename, std::map<std::string, ov::AnyMap>& config) {
|
||||
std::ifstream ifs(filename);
|
||||
if (!ifs.is_open()) {
|
||||
throw std::runtime_error("Can't load config file \"" + filename + "\".");
|
||||
|
@ -122,8 +122,8 @@ std::vector<benchmark_app::InputsInfo> get_inputs_info(const std::string& shape_
|
||||
const std::string& mean_string,
|
||||
const std::vector<ov::Output<const ov::Node>>& input_info);
|
||||
|
||||
void dump_config(const std::string& filename, const std::map<std::string, std::map<std::string, std::string>>& config);
|
||||
void load_config(const std::string& filename, std::map<std::string, std::map<std::string, std::string>>& config);
|
||||
void dump_config(const std::string& filename, const std::map<std::string, ov::AnyMap>& config);
|
||||
void load_config(const std::string& filename, std::map<std::string, ov::AnyMap>& config);
|
||||
|
||||
extern const std::vector<std::string> supported_image_extensions;
|
||||
extern const std::vector<std::string> supported_binary_extensions;
|
||||
|
@ -979,7 +979,7 @@ std::map<std::string, std::string> parseConfig(const std::string& configName, ch
|
||||
inline std::string getFullDeviceName(ov::Core& core, std::string device) {
|
||||
ov::Any p;
|
||||
try {
|
||||
p = core.get_metric(device, METRIC_KEY(FULL_DEVICE_NAME));
|
||||
p = core.get_property(device, METRIC_KEY(FULL_DEVICE_NAME));
|
||||
return p.as<std::string>();
|
||||
} catch (ov::Exception&) {
|
||||
return "";
|
||||
|
@ -107,11 +107,11 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
// Query supported metrics and print all of them
|
||||
slog::info << "\tSUPPORTED_METRICS: " << slog::endl;
|
||||
std::vector<std::string> supportedMetrics = core.get_metric(device, METRIC_KEY(SUPPORTED_METRICS));
|
||||
std::vector<std::string> supportedMetrics = core.get_property(device, METRIC_KEY(SUPPORTED_METRICS));
|
||||
for (auto&& metricName : supportedMetrics) {
|
||||
if (metricName != METRIC_KEY(SUPPORTED_METRICS) && metricName != METRIC_KEY(SUPPORTED_CONFIG_KEYS)) {
|
||||
slog::info << "\t\t" << metricName << " : " << slog::flush;
|
||||
print_any_value(core.get_metric(device, metricName));
|
||||
print_any_value(core.get_property(device, metricName));
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,10 +120,10 @@ int main(int argc, char* argv[]) {
|
||||
supportedMetrics.end()) {
|
||||
slog::info << "\tSUPPORTED_CONFIG_KEYS (default values): " << slog::endl;
|
||||
std::vector<std::string> supportedConfigKeys =
|
||||
core.get_metric(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
core.get_property(device, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
for (auto&& configKey : supportedConfigKeys) {
|
||||
slog::info << "\t\t" << configKey << " : " << slog::flush;
|
||||
print_any_value(core.get_config(device, configKey));
|
||||
print_any_value(core.get_property(device, configKey));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ int main(int argc, char* argv[]) {
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// --------------------------- Set parameters and scale factors -------------------------------------
|
||||
/** Setting parameter for per layer metrics **/
|
||||
std::map<std::string, std::string> gnaPluginConfig;
|
||||
std::map<std::string, std::string> genericPluginConfig;
|
||||
ov::AnyMap gnaPluginConfig;
|
||||
ov::AnyMap genericPluginConfig;
|
||||
if (useGna) {
|
||||
std::string gnaDevice =
|
||||
useHetero ? FLAGS_d.substr(FLAGS_d.find("GNA"), FLAGS_d.find(",") - FLAGS_d.find("GNA")) : FLAGS_d;
|
||||
|
@ -296,11 +296,11 @@ PyAny from_ov_any(const ov::Any& any) {
|
||||
|
||||
uint32_t get_optimal_number_of_requests(const ov::CompiledModel& actual) {
|
||||
try {
|
||||
auto parameter_value = actual.get_metric(METRIC_KEY(SUPPORTED_METRICS));
|
||||
auto parameter_value = actual.get_property(METRIC_KEY(SUPPORTED_METRICS));
|
||||
auto supported_metrics = parameter_value.as<std::vector<std::string>>();
|
||||
const std::string key = METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS);
|
||||
if (std::find(supported_metrics.begin(), supported_metrics.end(), key) != supported_metrics.end()) {
|
||||
parameter_value = actual.get_metric(key);
|
||||
parameter_value = actual.get_property(key);
|
||||
if (parameter_value.is<unsigned int>())
|
||||
return parameter_value.as<unsigned int>();
|
||||
else
|
||||
|
@ -43,14 +43,14 @@ void regclass_CompiledModel(py::module m) {
|
||||
cls.def(
|
||||
"get_config",
|
||||
[](ov::CompiledModel& self, const std::string& name) -> py::object {
|
||||
return Common::from_ov_any(self.get_config(name)).as<py::object>();
|
||||
return Common::from_ov_any(self.get_property(name)).as<py::object>();
|
||||
},
|
||||
py::arg("name"));
|
||||
|
||||
cls.def(
|
||||
"get_metric",
|
||||
[](ov::CompiledModel& self, const std::string& name) -> py::object {
|
||||
return Common::from_ov_any(self.get_metric(name)).as<py::object>();
|
||||
return Common::from_ov_any(self.get_property(name)).as<py::object>();
|
||||
},
|
||||
py::arg("name"));
|
||||
|
||||
|
@ -27,36 +27,55 @@ void regclass_Core(py::module m) {
|
||||
|
||||
cls.def(py::init<const std::string&>(), py::arg("xml_config_file") = "");
|
||||
|
||||
cls.def("set_config",
|
||||
(void (ov::Core::*)(const ConfigMap&, const std::string&)) & ov::Core::set_config,
|
||||
py::arg("config"),
|
||||
py::arg("device_name") = "");
|
||||
cls.def(
|
||||
"set_config",
|
||||
[](ov::Core& self, const std::map<std::string, std::string>& config, const std::string& device_name) {
|
||||
self.set_property(device_name, {config.begin(), config.end()});
|
||||
},
|
||||
py::arg("config"),
|
||||
py::arg("device_name") = "");
|
||||
|
||||
cls.def("compile_model",
|
||||
(ov::CompiledModel(
|
||||
ov::Core::*)(const std::shared_ptr<const ov::Model>&, const std::string&, const ConfigMap&)) &
|
||||
ov::Core::compile_model,
|
||||
py::arg("model"),
|
||||
py::arg("device_name"),
|
||||
py::arg("config") = py::dict());
|
||||
cls.def(
|
||||
"compile_model",
|
||||
[](ov::Core& self,
|
||||
const std::shared_ptr<const ov::Model>& model,
|
||||
const std::string& device_name,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
return self.compile_model(model, device_name, {config.begin(), config.end()});
|
||||
},
|
||||
py::arg("model"),
|
||||
py::arg("device_name"),
|
||||
py::arg("config") = py::dict());
|
||||
|
||||
cls.def("compile_model",
|
||||
(ov::CompiledModel(ov::Core::*)(const std::shared_ptr<const ov::Model>&, const ConfigMap&)) &
|
||||
ov::Core::compile_model,
|
||||
py::arg("model"),
|
||||
py::arg("config") = py::dict());
|
||||
cls.def(
|
||||
"compile_model",
|
||||
[](ov::Core& self,
|
||||
const std::shared_ptr<const ov::Model>& model,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
return self.compile_model(model, ov::AnyMap{config.begin(), config.end()});
|
||||
},
|
||||
py::arg("model"),
|
||||
py::arg("config") = py::dict());
|
||||
|
||||
cls.def("compile_model",
|
||||
(ov::CompiledModel(ov::Core::*)(const std::string&, const std::string&, const ConfigMap&)) &
|
||||
ov::Core::compile_model,
|
||||
py::arg("model_path"),
|
||||
py::arg("device_name"),
|
||||
py::arg("config") = py::dict());
|
||||
cls.def(
|
||||
"compile_model",
|
||||
[](ov::Core& self,
|
||||
const std::string& model_path,
|
||||
const std::string& device_name,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
return self.compile_model(model_path, device_name, {config.begin(), config.end()});
|
||||
},
|
||||
py::arg("model_path"),
|
||||
py::arg("device_name"),
|
||||
py::arg("config") = py::dict());
|
||||
|
||||
cls.def("compile_model",
|
||||
(ov::CompiledModel(ov::Core::*)(const std::string&, const ConfigMap&)) & ov::Core::compile_model,
|
||||
py::arg("model_path"),
|
||||
py::arg("config") = py::dict());
|
||||
cls.def(
|
||||
"compile_model",
|
||||
[](ov::Core& self, const std::string& model_path, const std::map<std::string, std::string>& config) {
|
||||
return self.compile_model(model_path, ov::AnyMap{config.begin(), config.end()});
|
||||
},
|
||||
py::arg("model_path"),
|
||||
py::arg("config") = py::dict());
|
||||
|
||||
cls.def("get_versions", &ov::Core::get_versions, py::arg("device_name"));
|
||||
|
||||
@ -102,7 +121,12 @@ void regclass_Core(py::module m) {
|
||||
|
||||
cls.def(
|
||||
"import_model",
|
||||
(ov::CompiledModel(ov::Core::*)(std::istream&, const std::string&, const ConfigMap&)) & ov::Core::import_model,
|
||||
[](ov::Core& self,
|
||||
std::istream& model_file,
|
||||
const std::string& device_name,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
return self.import_model(model_file, device_name, {config.begin(), config.end()});
|
||||
},
|
||||
py::arg("model_file"),
|
||||
py::arg("device_name"),
|
||||
py::arg("config") = py::none());
|
||||
@ -110,7 +134,7 @@ void regclass_Core(py::module m) {
|
||||
cls.def(
|
||||
"get_config",
|
||||
[](ov::Core& self, const std::string& device_name, const std::string& name) -> py::object {
|
||||
return Common::from_ov_any(self.get_config(device_name, name)).as<py::object>();
|
||||
return Common::from_ov_any(self.get_property(device_name, name)).as<py::object>();
|
||||
},
|
||||
py::arg("device_name"),
|
||||
py::arg("name"));
|
||||
@ -118,7 +142,7 @@ void regclass_Core(py::module m) {
|
||||
cls.def(
|
||||
"get_metric",
|
||||
[](ov::Core& self, const std::string device_name, const std::string name) -> py::object {
|
||||
return Common::from_ov_any(self.get_metric(device_name, name)).as<py::object>();
|
||||
return Common::from_ov_any(self.get_property(device_name, name)).as<py::object>();
|
||||
},
|
||||
py::arg("device_name"),
|
||||
py::arg("name"));
|
||||
@ -129,13 +153,17 @@ void regclass_Core(py::module m) {
|
||||
|
||||
cls.def("unload_plugin", &ov::Core::unload_plugin, py::arg("device_name"));
|
||||
|
||||
cls.def("query_model",
|
||||
(ov::SupportedOpsMap(
|
||||
ov::Core::*)(const std::shared_ptr<const ov::Model>&, const std::string&, const ConfigMap&)) &
|
||||
ov::Core::query_model,
|
||||
py::arg("model"),
|
||||
py::arg("device_name"),
|
||||
py::arg("config") = py::dict());
|
||||
cls.def(
|
||||
"query_model",
|
||||
[](ov::Core& self,
|
||||
const std::shared_ptr<const ov::Model>& model,
|
||||
const std::string& device_name,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
return self.query_model(model, device_name, {config.begin(), config.end()});
|
||||
},
|
||||
py::arg("model"),
|
||||
py::arg("device_name"),
|
||||
py::arg("config") = py::dict());
|
||||
|
||||
cls.def("add_extension",
|
||||
static_cast<void (ov::Core::*)(const std::string&)>(&ov::Core::add_extension),
|
||||
|
@ -29,6 +29,7 @@ namespace ov {
|
||||
|
||||
class Node;
|
||||
class RuntimeAttribute;
|
||||
|
||||
class CompiledModel;
|
||||
class RemoteContext;
|
||||
class RemoteTensor;
|
||||
@ -59,6 +60,19 @@ class OPENVINO_API Any {
|
||||
constexpr static const auto value = std::is_same<std::true_type, decltype(test<T>(nullptr))>::value;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct Istreamable {
|
||||
template <class U>
|
||||
static auto test(U*) -> decltype(std::declval<std::istream&>() >> std::declval<U&>(), std::true_type()) {
|
||||
return {};
|
||||
}
|
||||
template <typename>
|
||||
static auto test(...) -> std::false_type {
|
||||
return {};
|
||||
}
|
||||
constexpr static const auto value = std::is_same<std::true_type, decltype(test<T>(nullptr))>::value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct EqualityComparable {
|
||||
static void* conv(bool);
|
||||
@ -160,6 +174,7 @@ class OPENVINO_API Any {
|
||||
virtual Base::Ptr copy() const = 0;
|
||||
virtual bool equal(const Base& rhs) const = 0;
|
||||
virtual void print(std::ostream& os) const = 0;
|
||||
virtual void read(std::istream& os) = 0;
|
||||
|
||||
virtual const DiscreteTypeInfo& get_type_info() const = 0;
|
||||
virtual std::shared_ptr<RuntimeAttribute> as_runtime_attribute() const;
|
||||
@ -260,6 +275,10 @@ class OPENVINO_API Any {
|
||||
os << runtime_attribute->to_string();
|
||||
}
|
||||
|
||||
void read(std::istream&) override {
|
||||
throw ov::Exception{"Pointer to runtime attribute is not readable from std::istream"};
|
||||
}
|
||||
|
||||
T runtime_attribute;
|
||||
};
|
||||
|
||||
@ -328,6 +347,20 @@ class OPENVINO_API Any {
|
||||
print_impl(os, value);
|
||||
}
|
||||
|
||||
template <class U>
|
||||
static typename std::enable_if<Istreamable<U>::value>::type read_impl(std::istream& is, U& value) {
|
||||
is >> value;
|
||||
}
|
||||
|
||||
template <class U>
|
||||
static typename std::enable_if<!Istreamable<U>::value>::type read_impl(std::istream&, U&) {
|
||||
throw ov::Exception{"Could print type without std::istream& operator>>(std::istream&, T) defined"};
|
||||
}
|
||||
|
||||
void read(std::istream& is) override {
|
||||
read_impl(is, value);
|
||||
}
|
||||
|
||||
T value;
|
||||
};
|
||||
|
||||
@ -602,6 +635,14 @@ public:
|
||||
throw ov::Exception{std::string{"Bad cast from: "} + _impl->type_info().name() + " to: " + typeid(T).name()};
|
||||
}
|
||||
|
||||
operator bool&() & = delete;
|
||||
|
||||
operator const bool&() const& = delete;
|
||||
|
||||
operator const bool() const& = delete;
|
||||
|
||||
operator const bool &&() && = delete;
|
||||
|
||||
/**
|
||||
* @brief Converts to specified type
|
||||
* @tparam T type
|
||||
@ -689,6 +730,15 @@ public:
|
||||
*/
|
||||
void print(std::ostream& stream) const;
|
||||
|
||||
/**
|
||||
* @brief Read into underlying object from the given input stream.
|
||||
* Uses operator>> if it is defined, leaves stream unchanged otherwise.
|
||||
* In case of empty any or nullptr stream immediately returns.
|
||||
*
|
||||
* @param stream Output stream object will be printed to.
|
||||
*/
|
||||
void read(std::istream& stream);
|
||||
|
||||
/**
|
||||
* @brief Return pointer to underlined interface
|
||||
* @return underlined interface
|
||||
@ -725,7 +775,9 @@ struct AsTypePtr<Any> {
|
||||
};
|
||||
} // namespace util
|
||||
|
||||
using RTMap = std::map<std::string, Any>;
|
||||
using AnyMap = std::map<std::string, Any>;
|
||||
|
||||
using RTMap = AnyMap;
|
||||
|
||||
using AnyVector = std::vector<ov::Any>;
|
||||
|
||||
|
@ -70,6 +70,12 @@ void Any::print(std::ostream& ostream) const {
|
||||
}
|
||||
}
|
||||
|
||||
void Any::read(std::istream& istream) {
|
||||
if (_impl != nullptr) {
|
||||
_impl->read(istream);
|
||||
}
|
||||
}
|
||||
|
||||
bool Any::operator==(const Any& other) const {
|
||||
if (_impl == nullptr && other._impl == nullptr) {
|
||||
return false;
|
||||
|
@ -336,6 +336,16 @@ TEST_F(AnyTests, PrintToIntAny) {
|
||||
ASSERT_EQ(stream.str(), std::to_string(value));
|
||||
}
|
||||
|
||||
TEST_F(AnyTests, ReadToIntAny) {
|
||||
int value = -5;
|
||||
std::stringstream strm;
|
||||
strm << value;
|
||||
Any p = int{};
|
||||
ASSERT_NO_THROW(p.read(strm));
|
||||
ASSERT_FALSE(strm.fail());
|
||||
ASSERT_EQ(value, p.as<int>());
|
||||
}
|
||||
|
||||
TEST_F(AnyTests, PrintToUIntAny) {
|
||||
unsigned int value = 5;
|
||||
Any p = value;
|
||||
|
@ -169,6 +169,15 @@ public:
|
||||
virtual InferenceEngine::RemoteContext::Ptr CreateContext(const std::string& deviceName,
|
||||
const InferenceEngine::ParamMap&) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get only configs that are suppored by device
|
||||
* @param deviceName Name of a device
|
||||
* @param config Map of configs that can contains configs that are not supported by device
|
||||
* @return map of configs that are supported by device
|
||||
*/
|
||||
virtual std::map<std::string, std::string> GetSupportedConfig(const std::string& deviceName,
|
||||
const std::map<std::string, std::string>& config) = 0;
|
||||
|
||||
virtual bool isNewAPI() const = 0;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "ie_blob.h"
|
||||
#include "openvino/runtime/parameter.hpp"
|
||||
#include "openvino/core/any.hpp"
|
||||
#include "openvino/core/except.hpp"
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
@ -28,6 +29,6 @@ namespace InferenceEngine {
|
||||
* @brief Alias for type that can store any value
|
||||
*/
|
||||
using Parameter = ov::Any;
|
||||
using ov::ParamMap;
|
||||
using ParamMap = ov::AnyMap;
|
||||
|
||||
} // namespace InferenceEngine
|
||||
|
@ -9,10 +9,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "openvino/core/any.hpp"
|
||||
#include "openvino/core/visibility.hpp"
|
||||
|
||||
#if defined(OPENVINO_STATIC_LIBRARY) || defined(USE_STATIC_IE)
|
||||
@ -43,10 +43,6 @@ namespace InferenceEngine {}
|
||||
|
||||
namespace ov {
|
||||
namespace ie = InferenceEngine;
|
||||
/**
|
||||
* @brief This type of map is commonly used to pass set of device configuration parameters
|
||||
*/
|
||||
using ConfigMap = std::map<std::string, std::string>;
|
||||
|
||||
/**
|
||||
* @brief This type of map is used for result of Core::query_model
|
||||
@ -56,7 +52,6 @@ using ConfigMap = std::map<std::string, std::string>;
|
||||
using SupportedOpsMap = std::map<std::string, std::string>;
|
||||
|
||||
namespace runtime {
|
||||
using ov::ConfigMap;
|
||||
using ov::SupportedOpsMap;
|
||||
} // namespace runtime
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "openvino/core/model.hpp"
|
||||
#include "openvino/runtime/infer_request.hpp"
|
||||
#include "openvino/runtime/parameter.hpp"
|
||||
#include "openvino/runtime/properties.hpp"
|
||||
#include "openvino/runtime/remote_context.hpp"
|
||||
|
||||
namespace InferenceEngine {
|
||||
@ -50,6 +50,8 @@ class OPENVINO_RUNTIME_API CompiledModel {
|
||||
friend class ov::Core;
|
||||
friend class ov::InferRequest;
|
||||
|
||||
void get_property(const std::string& name, ov::Any& to) const;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief A default constructor.
|
||||
@ -62,7 +64,7 @@ public:
|
||||
~CompiledModel();
|
||||
|
||||
/**
|
||||
* @brief Get executable model information from a device
|
||||
* @brief Get runtime model information from a device
|
||||
* This object represents the internal device specific model which is optimized for particular
|
||||
* accelerator. It contains device specific nodes, runtime information and can be used only
|
||||
* to understand how the source model is optimized and which kernels, element types and layouts
|
||||
@ -159,34 +161,52 @@ public:
|
||||
void export_model(std::ostream& model_stream);
|
||||
|
||||
/**
|
||||
* @brief Sets configuration for current compiled model
|
||||
* @param config Map of pairs: (config parameter name, config parameter value)
|
||||
* @brief Sets properties for current compiled model
|
||||
*
|
||||
* @param properties Map of pairs: (property name, property value)
|
||||
*/
|
||||
void set_config(const ParamMap& config);
|
||||
void set_property(const AnyMap& properties);
|
||||
|
||||
/** @brief Gets configuration for a compiled model.
|
||||
/**
|
||||
* @brief Sets properties for current compiled model
|
||||
*
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param properties Optional pack of pairs: (property name, property value)
|
||||
* @return nothing
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<void, Properties...> set_property(Properties&&... properties) {
|
||||
set_property(AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/** @brief Gets properties for current compiled model
|
||||
*
|
||||
* The method is responsible to extract information
|
||||
* which affects compiled model inference. The list of supported configuration values can be extracted via
|
||||
* CompiledModel::get_metric with the SUPPORTED_CONFIG_KEYS key, but some of these keys cannot be changed
|
||||
* dynamically, e.g. DEVICE_ID cannot changed if a compiled model has already been compiled for particular
|
||||
* CompiledModel::get_property with the ov::supported_properties key, but some of these keys cannot be changed
|
||||
* dynamically, e.g. ov::device::id cannot changed if a compiled model has already been compiled for particular
|
||||
* device.
|
||||
*
|
||||
* @param key_name config key, can be found in ie_plugin_config.hpp
|
||||
* @return Configuration parameter value
|
||||
* @param name property key, can be found in openvino/runtime/properties.hpp
|
||||
* @return Property value
|
||||
*/
|
||||
Any get_config(const std::string& key_name) const;
|
||||
Any get_property(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* @brief Gets general runtime metric for a compiled model.
|
||||
* @brief Gets properties dedicated to device behaviour.
|
||||
*
|
||||
* It can be model name, actual device ID on
|
||||
* which compiled model is running or all other properties which cannot be changed dynamically.
|
||||
* The method is targeted to extract information which can be set via set_property method.
|
||||
*
|
||||
* @param metric_name metric name to request
|
||||
* @return Metric parameter value
|
||||
* @tparam T - type of returned value
|
||||
* @param property - property object.
|
||||
* @return Value of property.
|
||||
*/
|
||||
Any get_metric(const std::string& metric_name) const;
|
||||
template <typename T, PropertyMutability mutability>
|
||||
T get_property(const ov::Property<T, mutability>& property) const {
|
||||
auto to = Any::make<T>();
|
||||
get_property(property.name(), to);
|
||||
return to.template as<T>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns pointer to device-specific shared context
|
||||
|
@ -42,6 +42,8 @@ class OPENVINO_RUNTIME_API Core {
|
||||
class Impl;
|
||||
std::shared_ptr<Impl> _impl;
|
||||
|
||||
void get_property(const std::string& device_name, const std::string& name, ov::Any& to) const;
|
||||
|
||||
public:
|
||||
/** @brief Constructs OpenVINO Core instance using XML configuration file with
|
||||
* devices and their plugins description.
|
||||
@ -116,11 +118,32 @@ public:
|
||||
* them simultaneously (up to the limitation of the hardware resources)
|
||||
*
|
||||
* @param model Model object acquired from Core::read_model
|
||||
* @param config Optional map of pairs: (config parameter name, config parameter value) relevant only for this load
|
||||
* @param properties Optional map of pairs: (property name, property value) relevant only for this load
|
||||
* operation
|
||||
* @return A compiled model
|
||||
*/
|
||||
CompiledModel compile_model(const std::shared_ptr<const ov::Model>& model, const ConfigMap& config = {});
|
||||
CompiledModel compile_model(const std::shared_ptr<const ov::Model>& model, const AnyMap& properties = {});
|
||||
|
||||
/**
|
||||
* @brief Creates and loads a compiled model from a source model to the default OpenVINO device selected by AUTO
|
||||
* plugin.
|
||||
*
|
||||
* Users can create as many compiled models as they need and use
|
||||
* them simultaneously (up to the limitation of the hardware resources)
|
||||
*
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param model Model object acquired from Core::read_model
|
||||
* @param properties Optional pack of pairs: (property name, property value) relevant only for this
|
||||
* load operation
|
||||
*
|
||||
* @return A compiled model
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<CompiledModel, Properties...> compile_model(
|
||||
const std::shared_ptr<const ov::Model>& model,
|
||||
Properties&&... properties) {
|
||||
return compile_model(model, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a compiled model from a source model object.
|
||||
@ -130,13 +153,33 @@ public:
|
||||
*
|
||||
* @param model Model object acquired from Core::read_model
|
||||
* @param device_name Name of device to load model to
|
||||
* @param config Optional map of pairs: (config parameter name, config parameter value) relevant only for this load
|
||||
* @param properties Optional map of pairs: (property name, property value) relevant only for this load
|
||||
* operation
|
||||
* @return A compiled model
|
||||
*/
|
||||
CompiledModel compile_model(const std::shared_ptr<const ov::Model>& model,
|
||||
const std::string& device_name,
|
||||
const ConfigMap& config = {});
|
||||
const AnyMap& properties = {});
|
||||
|
||||
/**
|
||||
* @brief Creates a compiled model from a source model object.
|
||||
*
|
||||
* Users can create as many compiled models as they need and use
|
||||
* them simultaneously (up to the limitation of the hardware resources)
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param model Model object acquired from Core::read_model
|
||||
* @param device_name Name of device to load model to
|
||||
* @param properties Optional pack of pairs: (property name, property value) relevant only for this
|
||||
* load operation
|
||||
* @return A compiled model
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<CompiledModel, Properties...> compile_model(
|
||||
const std::shared_ptr<const ov::Model>& model,
|
||||
const std::string& device_name,
|
||||
Properties&&... properties) {
|
||||
return compile_model(model, device_name, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads and loads a compiled model from IR / ONNX / PDPD file to the default OpenVINI device selected by
|
||||
@ -146,12 +189,32 @@ public:
|
||||
* especially for cases when caching is enabled and cached model is available
|
||||
*
|
||||
* @param model_path path to model
|
||||
* @param config Optional map of pairs: (config parameter name, config parameter value) relevant only for this load
|
||||
* @param properties Optional map of pairs: (property name, property value) relevant only for this load
|
||||
* operation/
|
||||
*
|
||||
* @return A compiled model
|
||||
*/
|
||||
CompiledModel compile_model(const std::string& model_path, const ConfigMap& config = {});
|
||||
CompiledModel compile_model(const std::string& model_path, const AnyMap& properties = {});
|
||||
|
||||
/**
|
||||
* @brief Reads and loads a compiled model from IR / ONNX / PDPD file to the default OpenVINI device selected by
|
||||
* AUTO plugin.
|
||||
*
|
||||
* This can be more efficient than using read_model + compile_model(Model) flow
|
||||
* especially for cases when caching is enabled and cached model is available
|
||||
*
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param model_path path to model
|
||||
* @param properties Optional pack of pairs: (property name, property value) relevant only for this
|
||||
* load operation
|
||||
*
|
||||
* @return A compiled model
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<CompiledModel, Properties...> compile_model(const std::string& model_path,
|
||||
Properties&&... properties) {
|
||||
return compile_model(model_path, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads model and creates a compiled model from IR / ONNX / PDPD file
|
||||
@ -161,26 +224,64 @@ public:
|
||||
*
|
||||
* @param model_path Path to a model
|
||||
* @param device_name Name of device to load a model to
|
||||
* @param config Optional map of pairs: (config parameter name, config parameter value) relevant only for this load
|
||||
* @param properties Optional map of pairs: (property name, property value) relevant only for this load
|
||||
* operation/
|
||||
*
|
||||
* @return A compiled model
|
||||
*/
|
||||
CompiledModel compile_model(const std::string& model_path,
|
||||
const std::string& device_name,
|
||||
const ConfigMap& config = {});
|
||||
const AnyMap& properties = {});
|
||||
|
||||
/**
|
||||
* @brief Reads model and creates a compiled model from IR / ONNX / PDPD file
|
||||
*
|
||||
* This can be more efficient than using read_model + compile_model(Model) flow
|
||||
* especially for cases when caching is enabled and cached model is available
|
||||
*
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param model_path path to model
|
||||
* @param device_name Name of device to load model to
|
||||
* @param properties Optional pack of pairs: (property name, property value) relevant only for this
|
||||
* load operation
|
||||
*
|
||||
* @return A compiled model
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<CompiledModel, Properties...> compile_model(const std::string& model_path,
|
||||
const std::string& device_name,
|
||||
Properties&&... properties) {
|
||||
return compile_model(model_path, device_name, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a compiled model from a source model within a specified remote context.
|
||||
* @param model Model object acquired from Core::read_model
|
||||
* @param context A reference to a RemoteContext object
|
||||
* @param config Optional map of pairs: (config parameter name, config parameter value) relevant only for this load
|
||||
* @param properties Optional map of pairs: (property name, property value) relevant only for this load
|
||||
* operation
|
||||
* @return A compiled model object
|
||||
*/
|
||||
CompiledModel compile_model(const std::shared_ptr<const ov::Model>& model,
|
||||
const RemoteContext& context,
|
||||
const ConfigMap& config = {});
|
||||
const AnyMap& properties = {});
|
||||
|
||||
/**
|
||||
* @brief Creates a compiled model from a source model within a specified remote context.
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param model Model object acquired from Core::read_model
|
||||
* @param context Pointer to RemoteContext object
|
||||
* @param properties Optional pack of pairs: (property name, property value) relevant only for this
|
||||
* load operation
|
||||
* @return A compiled model object
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<CompiledModel, Properties...> compile_model(
|
||||
const std::shared_ptr<const ov::Model>& model,
|
||||
const RemoteContext& context,
|
||||
Properties&&... properties) {
|
||||
return compile_model(model, context, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This method is deprecated. Please use other Core::add_extension methods
|
||||
@ -268,13 +369,30 @@ public:
|
||||
* ov::CompiledModel::export_model method
|
||||
* @param device_name Name of device to import compiled model for. Note, if @p device_name device was not used to
|
||||
* compile the original mode, an exception is thrown
|
||||
* @param config Optional map of pairs: (config parameter name, config parameter value) relevant only for this load
|
||||
* @param properties Optional map of pairs: (property name, property value) relevant only for this load
|
||||
* operation*
|
||||
* @return A compiled model
|
||||
*/
|
||||
CompiledModel import_model(std::istream& model_stream,
|
||||
const std::string& device_name,
|
||||
const ConfigMap& config = {});
|
||||
const AnyMap& properties = {});
|
||||
|
||||
/**
|
||||
* @brief Imports a compiled model from a previously exported one
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param model_stream Model stream
|
||||
* @param device_name Name of device to import compiled model for. Note, if @p device_name device was not used to
|
||||
* compile the original mode, an exception is thrown
|
||||
* @param properties Optional pack of pairs: (property name, property value) relevant only for this
|
||||
* load operation
|
||||
* @return A compiled model
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<CompiledModel, Properties...> import_model(std::istream& model_stream,
|
||||
const std::string& device_name,
|
||||
Properties&&... properties) {
|
||||
return import_model(model_stream, device_name, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Imports a compiled model from a previously exported one with a specified remote context.
|
||||
@ -282,55 +400,130 @@ public:
|
||||
* ov::CompiledModel::export_model
|
||||
* @param context A reference to a RemoteContext object. Note, if the device from @p context was not used to compile
|
||||
* the original mode, an exception is thrown
|
||||
* @param config Optional map of pairs: (config parameter name, config parameter value) relevant only for this load
|
||||
* @param properties Optional map of pairs: (property name, property value) relevant only for this load
|
||||
* operation
|
||||
* @return A compiled model
|
||||
*/
|
||||
CompiledModel import_model(std::istream& model_stream, const RemoteContext& context, const ConfigMap& config = {});
|
||||
CompiledModel import_model(std::istream& model_stream, const RemoteContext& context, const AnyMap& properties = {});
|
||||
|
||||
/**
|
||||
* @brief Query device if it supports specified model with specified configuration
|
||||
* @brief Imports a compiled model from a previously exported one with a specified remote context.
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param model_stream Model stream
|
||||
* @param context Pointer to RemoteContext object
|
||||
* @param properties Optional pack of pairs: (property name, property value) relevant only for this
|
||||
* load operation
|
||||
* @return A compiled model
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<CompiledModel, Properties...> import_model(std::istream& model_stream,
|
||||
const RemoteContext& context,
|
||||
Properties&&... properties) {
|
||||
return import_model(model_stream, context, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Query device if it supports specified model with specified properties
|
||||
*
|
||||
* @param device_name A name of a device to query
|
||||
* @param model Model object to query
|
||||
* @param config Optional map of pairs: (config parameter name, config parameter value)
|
||||
* @param properties Optional map of pairs: (property name, property value)
|
||||
* @return An object containing a map of pairs a operation name -> a device name supporting this operation.
|
||||
*/
|
||||
SupportedOpsMap query_model(const std::shared_ptr<const ov::Model>& model,
|
||||
const std::string& device_name,
|
||||
const ConfigMap& config = {}) const;
|
||||
const AnyMap& properties = {}) const;
|
||||
|
||||
/**
|
||||
* @brief Sets configuration for device, acceptable keys can be found in ie_plugin_config.hpp
|
||||
* @brief Query device if it supports specified model with specified properties
|
||||
*
|
||||
* @param device_name An optional name of a device. If device name is not specified, the config is set for all the
|
||||
* registered devices.
|
||||
*
|
||||
* @param config Map of pairs: (config parameter name, config parameter value)
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param device_name A name of a device to query
|
||||
* @param model Model object to query
|
||||
* @param properties Optional pack of pairs: (property name, property value) relevant only for this
|
||||
* query operation
|
||||
* @return An object containing a map of pairs a operation name -> a device name supporting this operation.
|
||||
*/
|
||||
void set_config(const ConfigMap& config, const std::string& device_name = {});
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<SupportedOpsMap, Properties...> query_model(
|
||||
const std::shared_ptr<const ov::Model>& model,
|
||||
const std::string& device_name,
|
||||
Properties&&... properties) const {
|
||||
return query_model(model, device_name, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets configuration dedicated to device behaviour.
|
||||
* The method is targeted to extract information which can be set via Core::set_config method.
|
||||
* @brief Sets properties for all the
|
||||
* registered devices, acceptable keys can be found in openvino/runtime/properties.hpp
|
||||
*
|
||||
* @param device_name A name of a device to get a configuration value.
|
||||
* @param config_key_name A config key name.
|
||||
* @return Value of config corresponding to config key.
|
||||
* @param properties Map of pairs: (property name, property value)
|
||||
*/
|
||||
Any get_config(const std::string& device_name, const std::string& config_key_name) const;
|
||||
void set_property(const AnyMap& properties);
|
||||
|
||||
/**
|
||||
* @brief Gets general runtime metric for dedicated hardware.
|
||||
* @brief Sets properties for all the
|
||||
* registered devices, acceptable keys can be found in openvino/runtime/properties.hpp
|
||||
*
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param properties Optional pack of pairs: (property name, property value)
|
||||
* @return nothing
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<void, Properties...> set_property(Properties&&... properties) {
|
||||
set_property(AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets properties for device, acceptable keys can be found in openvino/runtime/properties.hpp
|
||||
*
|
||||
* @param device_name An name of a device.
|
||||
*
|
||||
* @param properties Map of pairs: (property name, property value)
|
||||
*/
|
||||
void set_property(const std::string& device_name, const AnyMap& properties);
|
||||
|
||||
/**
|
||||
* @brief Sets properties for device, acceptable keys can be found in openvino/runtime/properties.hpp
|
||||
*
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param device_name An name of a device.
|
||||
* @param properties Optional pack of pairs: (property name, property value)
|
||||
* @return nothing
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<void, Properties...> set_property(const std::string& device_name,
|
||||
Properties&&... properties) {
|
||||
set_property(device_name, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets properties dedicated to device behaviour.
|
||||
*
|
||||
* The method is targeted to extract information which can be set via set_property method.
|
||||
*
|
||||
* @param device_name - A name of a device to get a properties value.
|
||||
* @param name - property name.
|
||||
* @return Value of property corresponding to property name.
|
||||
*/
|
||||
Any get_property(const std::string& device_name, const std::string& name) const;
|
||||
|
||||
/**
|
||||
* @brief Gets properties dedicated to device behaviour.
|
||||
*
|
||||
* The method is needed to request common device or system properties.
|
||||
* It can be device name, temperature, other devices-specific values.
|
||||
*
|
||||
* @param device_name A name of a device to get a metric value.
|
||||
* @param metric_key_name A metric name to request.
|
||||
* @return Metric value corresponding to metric key.
|
||||
* @tparam T - type of returned value
|
||||
* @param deviceName - A name of a device to get a properties value.
|
||||
* @param property - property object.
|
||||
* @return Property value.
|
||||
*/
|
||||
Any get_metric(const std::string& device_name, const std::string& metric_key_name) const;
|
||||
template <typename T, PropertyMutability M>
|
||||
T get_property(const std::string& deviceName, const ov::Property<T, M>& property) const {
|
||||
auto to = Any::make<T>();
|
||||
get_property(deviceName, property.name(), to);
|
||||
return to.template as<T>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns devices available for inference
|
||||
@ -339,7 +532,7 @@ public:
|
||||
* @return A vector of devices. The devices are returned as { CPU, GPU.0, GPU.1, MYRIAD }
|
||||
* If there more than one device of specific type, they are enumerated with .# suffix.
|
||||
* Such enumerated device can later be used as a device name in all Core methods like Core::compile_model,
|
||||
* Core::query_model, Core::set_config and so on.
|
||||
* Core::query_model, Core::set_property and so on.
|
||||
*/
|
||||
std::vector<std::string> get_available_devices() const;
|
||||
|
||||
@ -391,7 +584,7 @@ public:
|
||||
* - `location` specifies absolute path to dynamic library with a plugin.
|
||||
* A path can also be relative to inference engine shared library. It allows to have common config
|
||||
* for different systems with different configurations.
|
||||
* - `properties` are set to a plugin via the ov::Core::set_config method.
|
||||
* - `properties` are set to a plugin via the ov::Core::set_property method.
|
||||
* - `extensions` are set to a plugin via the ov::Core::add_extension method.
|
||||
*
|
||||
* @param xml_config_file A path to .xml file with plugins to register.
|
||||
@ -402,10 +595,24 @@ public:
|
||||
* @brief Create a new remote shared context object on specified accelerator device
|
||||
* using specified plugin-specific low level device API parameters (device handle, pointer, context, etc.)
|
||||
* @param device_name A name of a device to create a new shared context on.
|
||||
* @param params A map of device-specific shared context parameters.
|
||||
* @param properties Map of device-specific shared context properties.
|
||||
* @return A reference to a created remote context.
|
||||
*/
|
||||
RemoteContext create_context(const std::string& device_name, const ParamMap& params);
|
||||
RemoteContext create_context(const std::string& device_name, const AnyMap& properties);
|
||||
|
||||
/**
|
||||
* @brief Create a new shared context object on specified accelerator device
|
||||
* using specified plugin-specific low level device API properties (device handle, pointer, etc.)
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param device_name Name of a device to create new shared context on.
|
||||
* @param properties Pack of device-specific shared context properties.
|
||||
* @return A shared pointer to a created remote context.
|
||||
*/
|
||||
template <typename... Properties>
|
||||
util::EnableIfAllProperties<RemoteContext, Properties...> create_context(const std::string& device_name,
|
||||
Properties&&... properties) {
|
||||
return create_context(device_name, AnyMap{std::forward<Properties>(properties)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a pointer to default (plugin-supplied) shared context object for specified accelerator device.
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
*/
|
||||
D3DContext(Core& core, ID3D11Device* device, int target_tile_id = -1) : ClContext(core, (cl_context) nullptr) {
|
||||
// clang-format off
|
||||
ParamMap context_params = {
|
||||
AnyMap context_params = {
|
||||
{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(VA_SHARED)},
|
||||
{GPU_PARAM_KEY(VA_DEVICE), static_cast<gpu_handle_param>(device)},
|
||||
{GPU_PARAM_KEY(TILE_ID), target_tile_id}
|
||||
@ -149,7 +149,7 @@ public:
|
||||
* @return A pair of remote tensors for each plane
|
||||
*/
|
||||
std::pair<D3DSurface2DTensor, D3DSurface2DTensor> create_tensor_nv12(const size_t height, const size_t width, ID3D11Texture2D* nv12_surf) {
|
||||
ParamMap tensor_params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(VA_SURFACE)},
|
||||
AnyMap tensor_params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(VA_SURFACE)},
|
||||
{GPU_PARAM_KEY(DEV_OBJECT_HANDLE), static_cast<gpu_handle_param>(nv12_surf)},
|
||||
{GPU_PARAM_KEY(VA_PLANE), uint32_t(0)}};
|
||||
auto y_tensor = create_tensor(element::u8, {1, 1, height, width}, tensor_params);
|
||||
@ -167,7 +167,7 @@ public:
|
||||
* @return A remote tensor instance
|
||||
*/
|
||||
D3DBufferTensor create_tensor(const element::Type type, const Shape& shape, ID3D11Buffer* buffer) {
|
||||
ParamMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(DX_BUFFER)},
|
||||
AnyMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(DX_BUFFER)},
|
||||
{GPU_PARAM_KEY(DEV_OBJECT_HANDLE), static_cast<gpu_handle_param>(buffer)}};
|
||||
create_tensor(type, shape, params).as<D3DBufferTensor>();
|
||||
}
|
||||
@ -185,7 +185,7 @@ public:
|
||||
const Shape& shape,
|
||||
ID3D11Texture2D* surface,
|
||||
uint32_t plane = 0) {
|
||||
ParamMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(VA_SURFACE)},
|
||||
AnyMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(VA_SURFACE)},
|
||||
{GPU_PARAM_KEY(DEV_OBJECT_HANDLE), static_cast<gpu_handle_param>(surface)},
|
||||
{GPU_PARAM_KEY(VA_PLANE), plane}};
|
||||
return create_tensor(type, shape, params).as<D3DSurface2DTensor>();
|
||||
|
@ -179,9 +179,9 @@ public:
|
||||
* @param ctx_device_id An ID of device to be used from ctx
|
||||
*/
|
||||
ClContext(Core& core, cl_context ctx, int ctx_device_id = 0) {
|
||||
ParamMap context_params = {{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(OCL)},
|
||||
{GPU_PARAM_KEY(OCL_CONTEXT), static_cast<gpu_handle_param>(ctx)},
|
||||
{GPU_PARAM_KEY(OCL_CONTEXT_DEVICE_ID), ctx_device_id}};
|
||||
AnyMap context_params = {{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(OCL)},
|
||||
{GPU_PARAM_KEY(OCL_CONTEXT), static_cast<gpu_handle_param>(ctx)},
|
||||
{GPU_PARAM_KEY(OCL_CONTEXT_DEVICE_ID), ctx_device_id}};
|
||||
*this = core.create_context(device_name, context_params).as<ClContext>();
|
||||
}
|
||||
|
||||
@ -196,9 +196,9 @@ public:
|
||||
auto res = clGetCommandQueueInfo(queue, CL_QUEUE_CONTEXT, sizeof(cl_context), &ctx, nullptr);
|
||||
if (res != CL_SUCCESS)
|
||||
IE_THROW() << "Can't get context from given opencl queue";
|
||||
ParamMap context_params = {{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(OCL)},
|
||||
{GPU_PARAM_KEY(OCL_CONTEXT), static_cast<gpu_handle_param>(ctx)},
|
||||
{GPU_PARAM_KEY(OCL_QUEUE), static_cast<gpu_handle_param>(queue)}};
|
||||
AnyMap context_params = {{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(OCL)},
|
||||
{GPU_PARAM_KEY(OCL_CONTEXT), static_cast<gpu_handle_param>(ctx)},
|
||||
{GPU_PARAM_KEY(OCL_QUEUE), static_cast<gpu_handle_param>(queue)}};
|
||||
*this = core.create_context(device_name, context_params).as<ClContext>();
|
||||
}
|
||||
|
||||
@ -237,8 +237,8 @@ public:
|
||||
const cl::Image2D& nv12_image_plane_uv) {
|
||||
size_t width = nv12_image_plane_y.getImageInfo<CL_IMAGE_WIDTH>();
|
||||
size_t height = nv12_image_plane_y.getImageInfo<CL_IMAGE_HEIGHT>();
|
||||
ParamMap tensor_params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(OCL_IMAGE2D)},
|
||||
{GPU_PARAM_KEY(MEM_HANDLE), static_cast<gpu_handle_param>(nv12_image_plane_y.get())}};
|
||||
AnyMap tensor_params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(OCL_IMAGE2D)},
|
||||
{GPU_PARAM_KEY(MEM_HANDLE), static_cast<gpu_handle_param>(nv12_image_plane_y.get())}};
|
||||
auto y_tensor = create_tensor(element::u8, {1, 1, height, width}, tensor_params);
|
||||
tensor_params[GPU_PARAM_KEY(MEM_HANDLE)] = static_cast<gpu_handle_param>(nv12_image_plane_uv.get());
|
||||
auto uv_tensor = create_tensor(element::u8, {1, 2, height / 2, width / 2}, tensor_params);
|
||||
@ -253,8 +253,8 @@ public:
|
||||
* @return A remote tensor instance
|
||||
*/
|
||||
ClBufferTensor create_tensor(const element::Type type, const Shape& shape, const cl_mem buffer) {
|
||||
ParamMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(OCL_BUFFER)},
|
||||
{GPU_PARAM_KEY(MEM_HANDLE), static_cast<gpu_handle_param>(buffer)}};
|
||||
AnyMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(OCL_BUFFER)},
|
||||
{GPU_PARAM_KEY(MEM_HANDLE), static_cast<gpu_handle_param>(buffer)}};
|
||||
return create_tensor(type, shape, params).as<ClBufferTensor>();
|
||||
}
|
||||
|
||||
@ -277,8 +277,8 @@ public:
|
||||
* @return A remote tensor instance
|
||||
*/
|
||||
ClImage2DTensor create_tensor(const element::Type type, const Shape& shape, const cl::Image2D& image) {
|
||||
ParamMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(OCL_IMAGE2D)},
|
||||
{GPU_PARAM_KEY(MEM_HANDLE), static_cast<gpu_handle_param>(image.get())}};
|
||||
AnyMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(OCL_IMAGE2D)},
|
||||
{GPU_PARAM_KEY(MEM_HANDLE), static_cast<gpu_handle_param>(image.get())}};
|
||||
return create_tensor(type, shape, params).as<ClImage2DTensor>();
|
||||
}
|
||||
|
||||
@ -290,8 +290,8 @@ public:
|
||||
* @return A remote tensor instance
|
||||
*/
|
||||
USMTensor create_tensor(const element::Type type, const Shape& shape, void* usm_ptr) {
|
||||
ParamMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(USM_USER_BUFFER)},
|
||||
{GPU_PARAM_KEY(MEM_HANDLE), static_cast<gpu_handle_param>(usm_ptr)}};
|
||||
AnyMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(USM_USER_BUFFER)},
|
||||
{GPU_PARAM_KEY(MEM_HANDLE), static_cast<gpu_handle_param>(usm_ptr)}};
|
||||
return create_tensor(type, shape, params).as<USMTensor>();
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ public:
|
||||
* @return A remote tensor instance
|
||||
*/
|
||||
USMTensor create_usm_host_tensor(const element::Type type, const Shape& shape) {
|
||||
ParamMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(USM_HOST_BUFFER)}};
|
||||
AnyMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(USM_HOST_BUFFER)}};
|
||||
return create_tensor(type, shape, params).as<USMTensor>();
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ public:
|
||||
* @return A remote tensor instance
|
||||
*/
|
||||
USMTensor create_usm_device_tensor(const element::Type type, const Shape& shape) {
|
||||
ParamMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(USM_DEVICE_BUFFER)}};
|
||||
AnyMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(USM_DEVICE_BUFFER)}};
|
||||
return create_tensor(type, shape, params).as<USMTensor>();
|
||||
}
|
||||
};
|
||||
|
@ -101,9 +101,9 @@ public:
|
||||
* that root device should be used
|
||||
*/
|
||||
VAContext(Core& core, VADisplay device, int target_tile_id = -1) : ClContext(core, (cl_context) nullptr) {
|
||||
ParamMap context_params = {{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(VA_SHARED)},
|
||||
{GPU_PARAM_KEY(VA_DEVICE), static_cast<gpu_handle_param>(device)},
|
||||
{GPU_PARAM_KEY(TILE_ID), target_tile_id}};
|
||||
AnyMap context_params = {{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(VA_SHARED)},
|
||||
{GPU_PARAM_KEY(VA_DEVICE), static_cast<gpu_handle_param>(device)},
|
||||
{GPU_PARAM_KEY(TILE_ID), target_tile_id}};
|
||||
*this = core.create_context(device_name, context_params).as<VAContext>();
|
||||
}
|
||||
|
||||
@ -118,9 +118,9 @@ public:
|
||||
std::pair<VASurfaceTensor, VASurfaceTensor> create_tensor_nv12(const size_t height,
|
||||
const size_t width,
|
||||
const VASurfaceID nv12_surf) {
|
||||
ParamMap tensor_params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(VA_SURFACE)},
|
||||
{GPU_PARAM_KEY(DEV_OBJECT_HANDLE), nv12_surf},
|
||||
{GPU_PARAM_KEY(VA_PLANE), uint32_t(0)}};
|
||||
AnyMap tensor_params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(VA_SURFACE)},
|
||||
{GPU_PARAM_KEY(DEV_OBJECT_HANDLE), nv12_surf},
|
||||
{GPU_PARAM_KEY(VA_PLANE), uint32_t(0)}};
|
||||
auto y_tensor = create_tensor(element::u8, {1, 1, height, width}, tensor_params);
|
||||
tensor_params[GPU_PARAM_KEY(VA_PLANE)] = uint32_t(1);
|
||||
auto uv_tensor = create_tensor(element::u8, {1, 2, height / 2, width / 2}, tensor_params);
|
||||
@ -139,9 +139,9 @@ public:
|
||||
const Shape& shape,
|
||||
const VASurfaceID surface,
|
||||
const uint32_t plane = 0) {
|
||||
ParamMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(VA_SURFACE)},
|
||||
{GPU_PARAM_KEY(DEV_OBJECT_HANDLE), surface},
|
||||
{GPU_PARAM_KEY(VA_PLANE), plane}};
|
||||
AnyMap params = {{GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(VA_SURFACE)},
|
||||
{GPU_PARAM_KEY(DEV_OBJECT_HANDLE), surface},
|
||||
{GPU_PARAM_KEY(VA_PLANE), plane}};
|
||||
return create_tensor(type, shape, params).as<VASurfaceTensor>();
|
||||
}
|
||||
};
|
||||
|
@ -1,26 +0,0 @@
|
||||
// Copyright (C) 2018-2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief A header file for the Parameter class
|
||||
* @file openvino/runtime/parameter.hpp
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "openvino/core/any.hpp"
|
||||
|
||||
namespace ov {
|
||||
|
||||
/**
|
||||
* @brief An std::map object containing parameters
|
||||
*/
|
||||
using ParamMap = std::map<std::string, Any>;
|
||||
|
||||
namespace runtime {
|
||||
using ov::ParamMap;
|
||||
} // namespace runtime
|
||||
|
||||
} // namespace ov
|
657
src/inference/include/openvino/runtime/properties.hpp
Normal file
657
src/inference/include/openvino/runtime/properties.hpp
Normal file
@ -0,0 +1,657 @@
|
||||
// Copyright (C) 2018-2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief A header for advanced hardware specific properties for OpenVINO runtime devices
|
||||
* To use in set_property, compile_model, import_model, get_property methods
|
||||
*
|
||||
* @file openvino/runtime/properties.hpp
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "ie_precision.hpp"
|
||||
#include "openvino/core/any.hpp"
|
||||
#include "openvino/runtime/common.hpp"
|
||||
|
||||
namespace ov {
|
||||
|
||||
/**
|
||||
* @brief Enum to define property value mutability
|
||||
*/
|
||||
enum class PropertyMutability {
|
||||
RO, //!< Read-only property values can not be passed as input parameter
|
||||
RW, //!< Read/Write property key may change readability in runtime
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class is used to return property name and its mutability attribute
|
||||
*/
|
||||
struct PropertyName : public std::string {
|
||||
using std::string::string;
|
||||
|
||||
/**
|
||||
* @brief Constructs property name object
|
||||
* @param str property name
|
||||
* @param mutability property mutability
|
||||
*/
|
||||
PropertyName(const std::string& str, PropertyMutability mutability = PropertyMutability::RW)
|
||||
: std::string{str},
|
||||
_mutability{mutability} {}
|
||||
|
||||
/**
|
||||
* @brief check property mutability
|
||||
* @return true if property is mutable
|
||||
*/
|
||||
bool is_mutable() const {
|
||||
return _mutability == PropertyMutability::RW;
|
||||
}
|
||||
|
||||
private:
|
||||
PropertyMutability _mutability = PropertyMutability::RW;
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
namespace util {
|
||||
template <typename... Args>
|
||||
struct AllProperties;
|
||||
|
||||
template <typename T, typename... Args>
|
||||
struct AllProperties<T, Args...> {
|
||||
constexpr static const bool value =
|
||||
std::is_convertible<T, std::pair<std::string, ov::Any>>::value && AllProperties<Args...>::value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct AllProperties<T> {
|
||||
constexpr static const bool value = std::is_convertible<T, std::pair<std::string, ov::Any>>::value;
|
||||
};
|
||||
|
||||
template <typename T, typename... Args>
|
||||
using EnableIfAllProperties = typename std::enable_if<AllProperties<Args...>::value, T>::type;
|
||||
|
||||
/**
|
||||
* @brief This class is used to bind property name with property type
|
||||
* @tparam T type of value used to pass or get property
|
||||
*/
|
||||
template <typename T, PropertyMutability mutability_ = PropertyMutability::RW>
|
||||
struct BaseProperty {
|
||||
using value_type = T; //!< Property type
|
||||
constexpr static const auto mutability = mutability_; //!< Property readability
|
||||
|
||||
/**
|
||||
* @brief Constructs property access variable
|
||||
* @param str_ property name
|
||||
*/
|
||||
constexpr BaseProperty(const char* name_) : _name{name_} {}
|
||||
|
||||
/**
|
||||
* @brief return property name
|
||||
* @return Pointer to const string key representation
|
||||
*/
|
||||
const char* name() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief compares property name
|
||||
* @return true if string is the same
|
||||
*/
|
||||
bool operator==(const std::string& str) const {
|
||||
return _name == str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief compares property name
|
||||
* @return true if string is the same
|
||||
*/
|
||||
friend bool operator==(const std::string& str, const BaseProperty<T, mutability_>& property) {
|
||||
return property == str;
|
||||
}
|
||||
|
||||
private:
|
||||
const char* _name = nullptr;
|
||||
};
|
||||
template <typename T, PropertyMutability M>
|
||||
inline std::ostream& operator<<(std::ostream& os, const BaseProperty<T, M>& property) {
|
||||
return os << property.name();
|
||||
}
|
||||
} // namespace util
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief This class is used to bind property name with value type
|
||||
* @tparam T type of value used to set or get property
|
||||
*/
|
||||
template <typename T, PropertyMutability mutability_ = PropertyMutability::RW>
|
||||
struct Property : public util::BaseProperty<T, mutability_> {
|
||||
using util::BaseProperty<T, mutability_>::BaseProperty;
|
||||
/**
|
||||
* @brief Constructs property
|
||||
* @tparam Args property constructor arguments types
|
||||
* @param args property constructor arguments
|
||||
* @return Pair of name and type erased value.
|
||||
*/
|
||||
template <typename... Args>
|
||||
inline std::pair<std::string, Any> operator()(Args&&... args) const {
|
||||
return {this->name(), Any::make<T>(std::forward<Args>(args)...)};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class is used to bind read-only property name with value type
|
||||
* @tparam T type of value used to pass or get property
|
||||
*/
|
||||
template <typename T>
|
||||
struct Property<T, PropertyMutability::RO> : public util::BaseProperty<T, PropertyMutability::RO> {
|
||||
using util::BaseProperty<T, PropertyMutability::RO>::BaseProperty;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to get a std::vector<PropertyName> of supported read-only properies.
|
||||
*
|
||||
* This can be used as a compiled model property as well.
|
||||
*
|
||||
*/
|
||||
static constexpr Property<std::vector<PropertyName>, PropertyMutability::RO> supported_properties{
|
||||
"SUPPORTED_PROPERTIES"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to get a std::vector<std::string> of available device IDs
|
||||
*/
|
||||
static constexpr Property<std::vector<std::string>, PropertyMutability::RO> available_devices{"AVAILABLE_DEVICES"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to get a name of name of a model
|
||||
*/
|
||||
static constexpr Property<std::string, PropertyMutability::RO> model_name{"NETWORK_NAME"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to get an unsigned integer value of optimal number of compiled model infer requests.
|
||||
*/
|
||||
static constexpr Property<uint32_t, PropertyMutability::RO> optimal_number_of_infer_requests{
|
||||
"OPTIMAL_NUMBER_OF_INFER_REQUESTS"};
|
||||
|
||||
namespace hint {
|
||||
|
||||
/**
|
||||
* @brief Hint for device to use specified precision for inference
|
||||
*/
|
||||
static constexpr Property<element::Type, PropertyMutability::RW> inference_precision{"INFERENCE_PRECISION_HINT"};
|
||||
|
||||
/**
|
||||
* @brief Enum to define possible model priorities hints
|
||||
*/
|
||||
enum class ModelPriority {
|
||||
LOW = 0,
|
||||
MEDIUM = 1,
|
||||
HIGH = 2,
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
inline std::ostream& operator<<(std::ostream& os, const ModelPriority& model_priority) {
|
||||
switch (model_priority) {
|
||||
case ModelPriority::LOW:
|
||||
return os << "LOW";
|
||||
case ModelPriority::MEDIUM:
|
||||
return os << "MEDIUM";
|
||||
case ModelPriority::HIGH:
|
||||
return os << "HIGH";
|
||||
default:
|
||||
throw ov::Exception{"Unsupported performance measure hint"};
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, ModelPriority& model_priority) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "LOW") {
|
||||
model_priority = ModelPriority::LOW;
|
||||
} else if (str == "MEDIUM") {
|
||||
model_priority = ModelPriority::MEDIUM;
|
||||
} else if (str == "HIGH") {
|
||||
model_priority = ModelPriority::HIGH;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported model priority: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief High-level OpenVINO model priority hint
|
||||
* Defines what model should be provided with more performant bounded resource first
|
||||
*/
|
||||
static constexpr Property<ModelPriority> model_priority{"MODEL_PRIORITY"};
|
||||
|
||||
/**
|
||||
* @brief Enum to define possible performance mode hints
|
||||
*/
|
||||
enum class PerformanceMode {
|
||||
LATENCY = 0,
|
||||
THROUGHPUT = 1,
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
inline std::ostream& operator<<(std::ostream& os, const PerformanceMode& performance_mode) {
|
||||
switch (performance_mode) {
|
||||
case PerformanceMode::LATENCY:
|
||||
return os << "LATENCY";
|
||||
case PerformanceMode::THROUGHPUT:
|
||||
return os << "THROUGHPUT";
|
||||
default:
|
||||
throw ov::Exception{"Unsupported performance mode hint"};
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, PerformanceMode& performance_mode) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "LATENCY") {
|
||||
performance_mode = PerformanceMode::LATENCY;
|
||||
} else if (str == "THROUGHPUT") {
|
||||
performance_mode = PerformanceMode::THROUGHPUT;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported performance mode: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief High-level OpenVINO Performance Hints
|
||||
* unlike low-level properties that are individual (per-device), the hints are something that every device accepts
|
||||
* and turns into device-specific settings
|
||||
*/
|
||||
static constexpr Property<PerformanceMode> performance_mode{"PERFORMANCE_HINT"};
|
||||
|
||||
/**
|
||||
* @brief (Optional) property that backs the (above) Performance Hints
|
||||
* by giving additional information on how many inference requests the application will be keeping in flight
|
||||
* usually this value comes from the actual use-case (e.g. number of video-cameras, or other sources of inputs)
|
||||
*/
|
||||
static constexpr Property<uint32_t> num_requests{"PERFORMANCE_HINT_NUM_REQUESTS"};
|
||||
} // namespace hint
|
||||
|
||||
/**
|
||||
* @brief The name for setting performance counters option.
|
||||
*
|
||||
* It is passed to Core::set_property()
|
||||
*/
|
||||
static constexpr Property<bool> enable_profiling{"PERF_COUNT"};
|
||||
|
||||
namespace log {
|
||||
|
||||
/**
|
||||
* @brief Enum to define possible log levels
|
||||
*/
|
||||
enum class Level {
|
||||
NO = -1, //!< disable any loging
|
||||
ERR = 0, //!< error events that might still allow the application to continue running
|
||||
WARNING = 1, //!< potentially harmful situations which may further lead to ERROR
|
||||
INFO = 2, //!< informational messages that display the progress of the application at coarse-grained level
|
||||
DEBUG = 3, //!< fine-grained events that are most useful to debug an application.
|
||||
TRACE = 4, //!< finer-grained informational events than the DEBUG
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
inline std::ostream& operator<<(std::ostream& os, const Level& level) {
|
||||
switch (level) {
|
||||
case Level::NO:
|
||||
return os << "NO";
|
||||
case Level::ERR:
|
||||
return os << "LOG_ERROR";
|
||||
case Level::WARNING:
|
||||
return os << "LOG_WARNING";
|
||||
case Level::INFO:
|
||||
return os << "LOG_INFO";
|
||||
case Level::DEBUG:
|
||||
return os << "LOG_DEBUG";
|
||||
case Level::TRACE:
|
||||
return os << "LOG_TRACE";
|
||||
default:
|
||||
throw ov::Exception{"Unsupported log level"};
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, Level& level) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "NO") {
|
||||
level = Level::NO;
|
||||
} else if (str == "LOG_ERROR") {
|
||||
level = Level::ERR;
|
||||
} else if (str == "LOG_WARNING") {
|
||||
level = Level::WARNING;
|
||||
} else if (str == "LOG_INFO") {
|
||||
level = Level::INFO;
|
||||
} else if (str == "LOG_DEBUG") {
|
||||
level = Level::DEBUG;
|
||||
} else if (str == "LOG_TRACE") {
|
||||
level = Level::TRACE;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported log level: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief the property for setting desirable log level.
|
||||
*/
|
||||
static constexpr Property<Level> level{"LOG_LEVEL"};
|
||||
} // namespace log
|
||||
|
||||
/**
|
||||
* @brief This property defines the directory which will be used to store any data cached by plugins.
|
||||
*
|
||||
* The underlying cache structure is not defined and might differ between OpenVINO releases
|
||||
* Cached data might be platform / device specific and might be invalid after OpenVINO version change
|
||||
* If this property is not specified or value is empty string, then caching is disabled.
|
||||
* The property might enable caching for the plugin using the following code:
|
||||
*
|
||||
* @code
|
||||
* ie.set_property("GPU", ov::cache_dir("cache/")); // enables cache for GPU plugin
|
||||
* @endcode
|
||||
*
|
||||
* The following code enables caching of compiled network blobs for devices where import/export is supported
|
||||
*
|
||||
* @code
|
||||
* ie.set_property(ov::cache_dir("cache/")); // enables models cache
|
||||
* @endcode
|
||||
*/
|
||||
static constexpr Property<std::string> cache_dir{"CACHE_DIR"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to provide information about a range for streams on platforms where streams are supported.
|
||||
*
|
||||
* Property returns a value of std::tuple<unsigned int, unsigned int> type, where:
|
||||
* - First value is bottom bound.
|
||||
* - Second value is upper bound.
|
||||
*/
|
||||
static constexpr Property<std::tuple<unsigned int, unsigned int>, PropertyMutability::RO> range_for_streams{
|
||||
"RANGE_FOR_STREAMS"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to query information optimal batch size for the given device and the network
|
||||
*
|
||||
* Property returns a value of unsigned int type,
|
||||
* Returns optimal batch size for a given network on the given device. The returned value is aligned to power of 2.
|
||||
* Also, MODEL_PTR is the required option for this metric since the optimal batch size depends on the model,
|
||||
* so if the MODEL_PTR is not given, the result of the metric is always 1.
|
||||
* For the GPU the metric is queried automatically whenever the OpenVINO performance hint for the throughput is used,
|
||||
* so that the result (>1) governs the automatic batching (transparently to the application).
|
||||
* The automatic batching can be disabled with ALLOW_AUTO_BATCHING set to NO
|
||||
*/
|
||||
static constexpr Property<unsigned int, PropertyMutability::RO> optimal_batch_size{"OPTIMAL_BATCH_SIZE"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to provide a hint for a range for number of async infer requests. If device supports
|
||||
* streams, the metric provides range for number of IRs per stream.
|
||||
*
|
||||
* Property returns a value of std::tuple<unsigned int, unsigned int, unsigned int> type, where:
|
||||
* - First value is bottom bound.
|
||||
* - Second value is upper bound.
|
||||
* - Third value is step inside this range.
|
||||
*/
|
||||
static constexpr Property<std::tuple<unsigned int, unsigned int, unsigned int>, PropertyMutability::RO>
|
||||
range_for_async_infer_requests{"RANGE_FOR_ASYNC_INFER_REQUESTS"};
|
||||
|
||||
namespace device {
|
||||
|
||||
/**
|
||||
* @brief the property for setting of required device to execute on
|
||||
* values: device id starts from "0" - first device, "1" - second device, etc
|
||||
*/
|
||||
static constexpr Property<std::string> id{"DEVICE_ID"};
|
||||
|
||||
/**
|
||||
* @brief Type for device Priorities config option, with comma-separated devices listed in the desired priority
|
||||
*/
|
||||
struct Priorities : public Property<std::string> {
|
||||
private:
|
||||
template <typename H, typename... T>
|
||||
static inline std::string concat(const H& head, T&&... tail) {
|
||||
return head + std::string{','} + concat(std::forward<T>(tail)...);
|
||||
}
|
||||
|
||||
template <typename H>
|
||||
static inline std::string concat(const H& head) {
|
||||
return head;
|
||||
}
|
||||
|
||||
public:
|
||||
using Property<std::string>::Property;
|
||||
|
||||
/**
|
||||
* @brief Constructs device priorities
|
||||
* @tparam Args property constructor arguments types
|
||||
* @param args property constructor arguments
|
||||
* @return Pair of name and type erased value.
|
||||
*/
|
||||
template <typename... Args>
|
||||
inline std::pair<std::string, Any> operator()(Args&&... args) const {
|
||||
return {name(), Any{concat(std::forward<Args>(args)...)}};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Device Priorities config option, with comma-separated devices listed in the desired priority
|
||||
*/
|
||||
static constexpr Priorities priorities{"MULTI_DEVICE_PRIORITIES"};
|
||||
|
||||
/**
|
||||
* @brief Type for property to pass set of properties to specified device
|
||||
*/
|
||||
struct Properties {
|
||||
/**
|
||||
* @brief Constructs property
|
||||
* @param device_name device plugin alias
|
||||
* @param config set of property values with names
|
||||
* @return Pair of string key representation and type erased property value.
|
||||
*/
|
||||
inline std::pair<std::string, Any> operator()(const std::string& device_name, const AnyMap& config) const {
|
||||
return {device_name, config};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructs property
|
||||
* @tparam Properties Should be the pack of `std::pair<std::string, ov::Any>` types
|
||||
* @param device_name device plugin alias
|
||||
* @param configs Optional pack of pairs: (config parameter name, config parameter value)
|
||||
* @return Pair of string key representation and type erased property value.
|
||||
*/
|
||||
template <typename... Properties>
|
||||
inline util::EnableIfAllProperties<std::pair<std::string, Any>, Properties...> operator()(
|
||||
const std::string& device_name,
|
||||
Properties&&... configs) const {
|
||||
return {device_name, AnyMap{std::pair<std::string, Any>{configs}...}};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Property to pass set of property values to specified device
|
||||
* Usage Example:
|
||||
* @code
|
||||
* core.compile_model("HETERO"
|
||||
* ov::target_falLback("GPU", "CPU"),
|
||||
* ov::device::properties("CPU", ov::enable_profiling(true)),
|
||||
* ov::device::properties("GPU", ov::enable_profiling(false)));
|
||||
* @endcode
|
||||
*/
|
||||
static constexpr Properties properties;
|
||||
|
||||
/**
|
||||
* @brief Read-only property to get a std::string value representing a full device name.
|
||||
*/
|
||||
static constexpr Property<std::string, PropertyMutability::RO> full_name{"FULL_DEVICE_NAME"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property which defines the device architecture.
|
||||
*/
|
||||
static constexpr Property<std::string, PropertyMutability::RO> architecture{"DEVICE_ARCHITECTURE"};
|
||||
|
||||
/**
|
||||
* @brief Enum to define possible device types
|
||||
*/
|
||||
enum class Type {
|
||||
INTEGRATED = 0, //!< Device is integrated into host system
|
||||
DISCRETE = 1, //!< Device is not integrated into host system
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
inline std::ostream& operator<<(std::ostream& os, const Type& device_type) {
|
||||
switch (device_type) {
|
||||
case Type::DISCRETE:
|
||||
return os << "discrete";
|
||||
case Type::INTEGRATED:
|
||||
return os << "integrated";
|
||||
default:
|
||||
throw ov::Exception{"Unsupported device type"};
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, Type& device_type) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "discrete") {
|
||||
device_type = Type::DISCRETE;
|
||||
} else if (str == "integrated") {
|
||||
device_type = Type::INTEGRATED;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported device type: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief Read-only property to get a type of device. See Type enum definition for possible return values
|
||||
*/
|
||||
static constexpr Property<Type, PropertyMutability::RO> type{"DEVICE_TYPE"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property which defines Giga OPS per second count (GFLOPS or GIOPS) for a set of precisions supported
|
||||
* by specified device
|
||||
*/
|
||||
static constexpr Property<std::map<element::Type, float>, PropertyMutability::RO> gops{"DEVICE_GOPS"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to get a float of device thermal
|
||||
*/
|
||||
static constexpr Property<float, PropertyMutability::RO> thermal{"DEVICE_THERMAL"};
|
||||
|
||||
/**
|
||||
* @brief Read-only property to get a std::vector<std::string> of capabilities options per device.
|
||||
*/
|
||||
static constexpr Property<std::vector<std::string>, PropertyMutability::RO> capabilities{"OPTIMIZATION_CAPABILITIES"};
|
||||
namespace capability {
|
||||
constexpr static const auto FP32 = "FP32"; //!< Device supports fp32 inference
|
||||
constexpr static const auto BF16 = "BF16"; //!< Device supports bf16 inference
|
||||
constexpr static const auto FP16 = "FP16"; //!< Device supports fp16 inference
|
||||
constexpr static const auto INT8 = "INT8"; //!< Device supports int8 inference
|
||||
constexpr static const auto BIN = "BIN"; //!< Device supports binary inference
|
||||
constexpr static const auto WINOGRAD = "WINOGRAD"; //!< Device supports winograd optimization
|
||||
constexpr static const auto EXPORT_IMPORT = "EXPORT_IMPORT"; //!< Device supports model export and import
|
||||
} // namespace capability
|
||||
} // namespace device
|
||||
|
||||
/**
|
||||
* @brief The key with the list of device targets used to fallback unsupported layers
|
||||
* by HETERO plugin
|
||||
*/
|
||||
static constexpr device::Priorities target_fallback{"TARGET_FALLBACK"};
|
||||
|
||||
/**
|
||||
* @brief The key for enabling of dumping the topology with details of layers and details how
|
||||
* this network would be executed on different devices to the disk in GraphViz format.
|
||||
*/
|
||||
static constexpr Property<bool, PropertyMutability::RW> dump_graph_dot{"HETERO_DUMP_GRAPH_DOT"};
|
||||
|
||||
namespace streams {
|
||||
/**
|
||||
* @brief Special value for ov::execution::streams::num property.
|
||||
* Creates bare minimum of streams to improve the performance
|
||||
*/
|
||||
static constexpr const int32_t AUTO = -1;
|
||||
/**
|
||||
* @brief Special value for ov::execution::streams::num property.
|
||||
* Creates as many streams as needed to accommodate NUMA and avoid associated penalties
|
||||
*/
|
||||
static constexpr const int32_t NUMA = -2;
|
||||
|
||||
/**
|
||||
* @brief The number of executor logical partitions
|
||||
*/
|
||||
static constexpr Property<int32_t, PropertyMutability::RW> num{"NUM_STREAMS"};
|
||||
} // namespace streams
|
||||
|
||||
/**
|
||||
* @brief Maximum number of threads that can be used for inference tasks
|
||||
*/
|
||||
static constexpr Property<int32_t, PropertyMutability::RW> inference_num_threads{"INFERENCE_NUM_THREADS"};
|
||||
|
||||
/**
|
||||
* @brief Maximum number of threads that can be used for compilation tasks
|
||||
*/
|
||||
static constexpr Property<int32_t, PropertyMutability::RW> compilation_num_threads{"COMPILATION_NUM_THREADS"};
|
||||
|
||||
/**
|
||||
* @brief Enum to define possible affinity patterns
|
||||
*/
|
||||
enum class Affinity {
|
||||
NONE = -1, //!< Disable threads affinity pinning
|
||||
CORE = 0, //!< Pin threads to cores, best for static benchmarks
|
||||
NUMA = 1, //!< Pin threads to NUMA nodes, best for real-life, contented cases. On the Windows and MacOS* this
|
||||
//!< option behaves as CORE
|
||||
HYBRID_AWARE = 2, //!< Let the runtime to do pinning to the cores types, e.g. prefer the "big" cores for latency
|
||||
//!< tasks. On the hybrid CPUs this option is default
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
inline std::ostream& operator<<(std::ostream& os, const Affinity& affinity) {
|
||||
switch (affinity) {
|
||||
case Affinity::NONE:
|
||||
return os << "NONE";
|
||||
case Affinity::CORE:
|
||||
return os << "CORE";
|
||||
case Affinity::NUMA:
|
||||
return os << "NUMA";
|
||||
case Affinity::HYBRID_AWARE:
|
||||
return os << "HYBRID_AWARE";
|
||||
default:
|
||||
throw ov::Exception{"Unsupported affinity pattern"};
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, Affinity& affinity) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "NONE") {
|
||||
affinity = Affinity::NONE;
|
||||
} else if (str == "CORE") {
|
||||
affinity = Affinity::CORE;
|
||||
} else if (str == "NUMA") {
|
||||
affinity = Affinity::NUMA;
|
||||
} else if (str == "HYBRID_AWARE") {
|
||||
affinity = Affinity::HYBRID_AWARE;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported affinity pattern: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief The name for setting CPU affinity per thread option.
|
||||
* @note The setting is ignored, if the OpenVINO compiled with OpenMP and any affinity-related OpenMP's
|
||||
* environment variable is set (as affinity is configured explicitly)
|
||||
*/
|
||||
static constexpr Property<Affinity> affinity{"AFFINITY"};
|
||||
} // namespace ov
|
@ -15,7 +15,7 @@
|
||||
#include "openvino/core/shape.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
#include "openvino/runtime/common.hpp"
|
||||
#include "openvino/runtime/parameter.hpp"
|
||||
#include "openvino/runtime/properties.hpp"
|
||||
#include "openvino/runtime/remote_tensor.hpp"
|
||||
|
||||
namespace InferenceEngine {
|
||||
@ -142,7 +142,7 @@ public:
|
||||
* @param params Map of the low-level tensor object parameters.
|
||||
* @return A pointer to plugin object that implements RemoteTensor interface.
|
||||
*/
|
||||
RemoteTensor create_tensor(const element::Type& type, const Shape& shape, const ParamMap& params = {});
|
||||
RemoteTensor create_tensor(const element::Type& type, const Shape& shape, const AnyMap& params = {});
|
||||
|
||||
/**
|
||||
* @brief Returns a map of device-specific parameters required for low-level
|
||||
@ -153,7 +153,7 @@ public:
|
||||
* Abstract method.
|
||||
* @return A map of name/parameter elements.
|
||||
*/
|
||||
ParamMap get_params() const;
|
||||
AnyMap get_params() const;
|
||||
|
||||
/**
|
||||
* @brief This method is used to create host tensor object friendly for the device in current context
|
||||
|
@ -10,7 +10,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "openvino/runtime/common.hpp"
|
||||
#include "openvino/runtime/parameter.hpp"
|
||||
#include "openvino/runtime/tensor.hpp"
|
||||
|
||||
namespace ov {
|
||||
@ -53,7 +52,7 @@ public:
|
||||
* Abstract method.
|
||||
* @return A map of name/parameter elements.
|
||||
*/
|
||||
runtime::ParamMap get_params() const;
|
||||
ov::AnyMap get_params() const;
|
||||
|
||||
/**
|
||||
* @brief Returns name of the device on which underlying object is allocated.
|
||||
|
59
src/inference/src/any_copy.cpp
Normal file
59
src/inference/src/any_copy.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "any_copy.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "openvino/runtime/properties.hpp"
|
||||
|
||||
namespace ov {
|
||||
std::map<std::string, std::string> any_copy(const ov::AnyMap& params) {
|
||||
std::function<std::string(const Any&)> to_config_string = [&](const Any& any) -> std::string {
|
||||
if (any.is<bool>()) {
|
||||
return any.as<bool>() ? "YES" : "NO";
|
||||
} else if (any.is<AnyMap>()) {
|
||||
std::stringstream strm;
|
||||
for (auto&& val : any.as<AnyMap>()) {
|
||||
strm << val.first << " " << to_config_string(val.second) << " ";
|
||||
}
|
||||
return strm.str();
|
||||
} else {
|
||||
std::stringstream strm;
|
||||
any.print(strm);
|
||||
return strm.str();
|
||||
}
|
||||
};
|
||||
std::map<std::string, std::string> result;
|
||||
for (auto&& value : params) {
|
||||
result.emplace(value.first, to_config_string(value.second));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void any_lexical_cast(const ov::Any& from, ov::Any& to) {
|
||||
if (!from.is<std::string>()) {
|
||||
to = from;
|
||||
} else {
|
||||
auto str = from.as<std::string>();
|
||||
if (to.is<std::string>()) {
|
||||
to = from;
|
||||
} else if (to.is<bool>()) {
|
||||
if (str == "YES") {
|
||||
to = true;
|
||||
} else if (str == "NO") {
|
||||
to = false;
|
||||
} else {
|
||||
OPENVINO_UNREACHABLE("Unsupported lexical cast to bool from: ", str);
|
||||
}
|
||||
} else {
|
||||
std::stringstream strm(str);
|
||||
to.read(strm);
|
||||
if (strm.fail()) {
|
||||
OPENVINO_UNREACHABLE("Unsupported lexical cast to ", to.type_info().name(), " from: ", str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace ov
|
21
src/inference/src/any_copy.hpp
Normal file
21
src/inference/src/any_copy.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ie_parameter.hpp>
|
||||
#include <istream>
|
||||
#include <map>
|
||||
#include <openvino/core/any.hpp>
|
||||
#include <openvino/runtime/common.hpp>
|
||||
#include <openvino/runtime/properties.hpp>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace ov {
|
||||
std::map<std::string, std::string> any_copy(const ov::AnyMap& config_map);
|
||||
|
||||
void any_lexical_cast(const Any& any, ov::Any& to);
|
||||
|
||||
} // namespace ov
|
@ -4,10 +4,12 @@
|
||||
|
||||
#include "cpp/ie_executable_network.hpp"
|
||||
|
||||
#include "any_copy.hpp"
|
||||
#include "cpp/exception2status.hpp"
|
||||
#include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp"
|
||||
#include "ie_common.h"
|
||||
#include "ie_executable_network_base.hpp"
|
||||
#include "ie_plugin_config.hpp"
|
||||
#include "ie_remote_context.hpp"
|
||||
#include "openvino/core/except.hpp"
|
||||
#include "openvino/runtime/compiled_model.hpp"
|
||||
@ -206,16 +208,39 @@ void CompiledModel::export_model(std::ostream& networkModel) {
|
||||
OV_EXEC_NET_CALL_STATEMENT(_impl->Export(networkModel));
|
||||
}
|
||||
|
||||
void CompiledModel::set_config(const ie::ParamMap& config) {
|
||||
void CompiledModel::set_property(const AnyMap& config) {
|
||||
OV_EXEC_NET_CALL_STATEMENT(_impl->SetConfig(config));
|
||||
}
|
||||
|
||||
ie::Parameter CompiledModel::get_config(const std::string& name) const {
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_impl->GetConfig(name), _so});
|
||||
Any CompiledModel::get_property(const std::string& name) const {
|
||||
OV_EXEC_NET_CALL_STATEMENT({
|
||||
if (ov::supported_properties == name) {
|
||||
try {
|
||||
return {_impl->GetMetric(name), _so};
|
||||
} catch (ie::Exception&) {
|
||||
auto ro_properties = _impl->GetMetric(METRIC_KEY(SUPPORTED_METRICS)).as<std::vector<std::string>>();
|
||||
auto rw_properties = _impl->GetConfig(METRIC_KEY(SUPPORTED_CONFIG_KEYS)).as<std::vector<std::string>>();
|
||||
std::vector<ov::PropertyName> supported_properties;
|
||||
for (auto&& ro_property : ro_properties) {
|
||||
supported_properties.emplace_back(ro_property, PropertyMutability::RO);
|
||||
}
|
||||
for (auto&& rw_property : rw_properties) {
|
||||
supported_properties.emplace_back(rw_property, PropertyMutability::RW);
|
||||
}
|
||||
supported_properties.emplace_back(ov::supported_properties.name(), PropertyMutability::RO);
|
||||
return supported_properties;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return {_impl->GetMetric(name), _so};
|
||||
} catch (ie::Exception&) {
|
||||
return {_impl->GetConfig(name), _so};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ie::Parameter CompiledModel::get_metric(const std::string& name) const {
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_impl->GetMetric(name), _so});
|
||||
void CompiledModel::get_property(const std::string& name, Any& to) const {
|
||||
any_lexical_cast(get_property(name), to);
|
||||
}
|
||||
|
||||
RemoteContext CompiledModel::get_context() const {
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "cpp_interfaces/interface/ie_iplugin_internal.hpp"
|
||||
#include "so_ptr.hpp"
|
||||
#include "openvino/runtime/common.hpp"
|
||||
#include "any_copy.hpp"
|
||||
|
||||
#if defined __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
@ -174,26 +175,26 @@ public:
|
||||
OV_PLUGIN_CALL_STATEMENT(_ptr->AddExtension(extension));
|
||||
}
|
||||
|
||||
void set_config(const ConfigMap& config) {
|
||||
void set_config(const std::map<std::string, std::string>& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(_ptr->SetConfig(config));
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> compile_model(const ie::CNNNetwork& network, const ConfigMap& config) {
|
||||
SoPtr<ie::IExecutableNetworkInternal> compile_model(const ie::CNNNetwork& network, const std::map<std::string, std::string>& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(network, config), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> compile_model(const ie::CNNNetwork& network,
|
||||
const std::shared_ptr<ie::RemoteContext>& context,
|
||||
const ConfigMap& config) {
|
||||
const std::map<std::string, std::string>& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(network, config, context), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> compile_model(const std::string& modelPath, const ConfigMap& config) {
|
||||
SoPtr<ie::IExecutableNetworkInternal> compile_model(const std::string& modelPath, const std::map<std::string, std::string>& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(modelPath, config), _so});
|
||||
}
|
||||
|
||||
ie::QueryNetworkResult query_model(const ie::CNNNetwork& network,
|
||||
const ConfigMap& config) const {
|
||||
const std::map<std::string, std::string>& config) const {
|
||||
ie::QueryNetworkResult res;
|
||||
OV_PLUGIN_CALL_STATEMENT(res = _ptr->QueryNetwork(network, config));
|
||||
OPENVINO_ASSERT(res.rc == ie::OK, res.resp.msg);
|
||||
@ -201,34 +202,34 @@ public:
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> import_model(const std::string& modelFileName,
|
||||
const ConfigMap& config) {
|
||||
const std::map<std::string, std::string>& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(modelFileName, config), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> import_model(std::istream& networkModel,
|
||||
const ConfigMap& config) {
|
||||
const std::map<std::string, std::string>& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(networkModel, config), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> import_model(std::istream& networkModel,
|
||||
const std::shared_ptr<ie::RemoteContext>& context,
|
||||
const ConfigMap& config) {
|
||||
const std::map<std::string, std::string>& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(networkModel, context, config), _so});
|
||||
}
|
||||
|
||||
ie::Parameter get_metric(const std::string& name, const ie::ParamMap& options) const {
|
||||
Any get_metric(const std::string& name, const AnyMap& options) const {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->GetMetric(name, options), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::RemoteContext> create_context(const ie::ParamMap& params) {
|
||||
SoPtr<ie::RemoteContext> create_context(const AnyMap& params) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->CreateContext(params), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::RemoteContext> get_default_context(const ie::ParamMap& params) {
|
||||
SoPtr<ie::RemoteContext> get_default_context(const AnyMap& params) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->GetDefaultContext(params), _so});
|
||||
}
|
||||
|
||||
ie::Parameter get_config(const std::string& name, const ie::ParamMap& options) const {
|
||||
Any get_config(const std::string& name, const AnyMap& options) const {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->GetConfig(name, options), _so});
|
||||
}
|
||||
};
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <exception>
|
||||
|
||||
#include "any_copy.hpp"
|
||||
#include "ie_ngraph_utils.hpp"
|
||||
#include "ie_remote_blob.hpp"
|
||||
#include "openvino/core/except.hpp"
|
||||
@ -60,12 +61,10 @@ std::string RemoteContext::get_device_name() const {
|
||||
OV_REMOTE_CONTEXT_STATEMENT(return _impl->getDeviceName());
|
||||
}
|
||||
|
||||
RemoteTensor RemoteContext::create_tensor(const element::Type& element_type,
|
||||
const Shape& shape,
|
||||
const ParamMap& params) {
|
||||
RemoteTensor RemoteContext::create_tensor(const element::Type& type, const Shape& shape, const AnyMap& params) {
|
||||
OV_REMOTE_CONTEXT_STATEMENT({
|
||||
auto blob = _impl->CreateBlob(
|
||||
{ie::details::convertPrecision(element_type), shape, ie::TensorDesc::getLayoutByRank(shape.size())},
|
||||
{ie::details::convertPrecision(type), shape, ie::TensorDesc::getLayoutByRank(shape.size())},
|
||||
params);
|
||||
blob->allocate();
|
||||
return {blob, _so};
|
||||
@ -81,8 +80,8 @@ Tensor RemoteContext::create_host_tensor(const element::Type element_type, const
|
||||
});
|
||||
}
|
||||
|
||||
ParamMap RemoteContext::get_params() const {
|
||||
ParamMap paramMap;
|
||||
AnyMap RemoteContext::get_params() const {
|
||||
AnyMap paramMap;
|
||||
OV_REMOTE_CONTEXT_STATEMENT({
|
||||
for (auto&& param : _impl->getParams()) {
|
||||
paramMap.emplace(param.first, Any{param.second, _so});
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "any_copy.hpp"
|
||||
#include "cnn_network_ngraph_impl.hpp"
|
||||
#include "compilation_context.hpp"
|
||||
#include "cpp/ie_cnn_network.h"
|
||||
@ -54,6 +55,12 @@ namespace ov {
|
||||
// Specify the default device when no device name is provided.
|
||||
const std::string DEFAULT_DEVICE_NAME = "DEFAULT_DEVICE";
|
||||
|
||||
template <typename T>
|
||||
struct Parsed {
|
||||
std::string _deviceName;
|
||||
std::map<std::string, T> _config;
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
#ifndef OPENVINO_STATIC_LIBRARY
|
||||
@ -71,12 +78,6 @@ std::string parseXmlConfig(const std::string& xmlFile) {
|
||||
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
struct Parsed {
|
||||
std::string _deviceName;
|
||||
std::map<std::string, T> _config;
|
||||
};
|
||||
|
||||
template <typename T = ie::Parameter>
|
||||
Parsed<T> parseDeviceNameIntoConfig(const std::string& deviceName, const std::map<std::string, T>& config = {}) {
|
||||
auto config_ = config;
|
||||
@ -116,6 +117,21 @@ void allowNotImplemented(F&& f) {
|
||||
}
|
||||
}
|
||||
|
||||
ov::AnyMap flatten_sub_properties(const std::string& device, const ov::AnyMap& properties) {
|
||||
ov::AnyMap result = properties;
|
||||
for (auto&& property : properties) {
|
||||
auto parsed = parseDeviceNameIntoConfig(property.first);
|
||||
if (device.find(parsed._deviceName) != std::string::npos) {
|
||||
if (property.second.is<ov::AnyMap>()) {
|
||||
for (auto&& sub_property : property.second.as<ov::AnyMap>()) {
|
||||
result[sub_property.first] = sub_property.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class CoreImpl : public ie::ICore, public std::enable_shared_from_this<ie::ICore> {
|
||||
@ -203,7 +219,7 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this<ie::ICore
|
||||
}
|
||||
|
||||
bool DeviceSupportsImportExport(const ov::InferencePlugin& plugin) const {
|
||||
std::vector<std::string> supportedMetricKeys = plugin.get_metric(METRIC_KEY(SUPPORTED_METRICS), {});
|
||||
auto supportedMetricKeys = plugin.get_metric(METRIC_KEY(SUPPORTED_METRICS), {}).as<std::vector<std::string>>();
|
||||
auto it = std::find(supportedMetricKeys.begin(), supportedMetricKeys.end(), METRIC_KEY(IMPORT_EXPORT_SUPPORT));
|
||||
auto supported =
|
||||
(it != supportedMetricKeys.end()) && plugin.get_metric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), {}).as<bool>();
|
||||
@ -224,7 +240,7 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this<ie::ICore
|
||||
}
|
||||
auto it = std::find(supportedMetricKeys.begin(), supportedMetricKeys.end(), METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
if (it != supportedMetricKeys.end()) {
|
||||
std::vector<std::string> configKeys = plugin.get_metric(METRIC_KEY(SUPPORTED_CONFIG_KEYS), {});
|
||||
auto configKeys = plugin.get_metric(METRIC_KEY(SUPPORTED_CONFIG_KEYS), {})->as<std::vector<std::string>>();
|
||||
supported = std::find(configKeys.begin(), configKeys.end(), key) != configKeys.end();
|
||||
}
|
||||
return supported;
|
||||
@ -330,13 +346,13 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this<ie::ICore
|
||||
}
|
||||
|
||||
// 2. replace it with DEVICE_ARCHITECTURE value
|
||||
std::vector<std::string> supportedMetricKeys =
|
||||
plugin.get_metric(METRIC_KEY(SUPPORTED_METRICS), getMetricConfig);
|
||||
auto supportedMetricKeys =
|
||||
plugin.get_metric(METRIC_KEY(SUPPORTED_METRICS), getMetricConfig)->as<std::vector<std::string>>();
|
||||
auto archIt =
|
||||
std::find(supportedMetricKeys.begin(), supportedMetricKeys.end(), METRIC_KEY(DEVICE_ARCHITECTURE));
|
||||
if (archIt != supportedMetricKeys.end()) {
|
||||
auto value = plugin.get_metric(METRIC_KEY(DEVICE_ARCHITECTURE), getMetricConfig);
|
||||
compileConfig[METRIC_KEY(DEVICE_ARCHITECTURE)] = value.as<std::string>();
|
||||
compileConfig[METRIC_KEY(DEVICE_ARCHITECTURE)] = value->as<std::string>();
|
||||
} else {
|
||||
// Take device name if device does not support DEVICE_ARCHITECTURE metric
|
||||
compileConfig[METRIC_KEY(DEVICE_ARCHITECTURE)] = deviceFamily;
|
||||
@ -749,9 +765,7 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
ie::Parameter GetMetric(const std::string& deviceName,
|
||||
const std::string& name,
|
||||
const ie::ParamMap& options = {}) const override {
|
||||
Any GetMetric(const std::string& deviceName, const std::string& name, const AnyMap& options = {}) const override {
|
||||
// HETERO case
|
||||
{
|
||||
if (deviceName.find("HETERO:") == 0) {
|
||||
@ -787,7 +801,7 @@ public:
|
||||
return GetCPPPluginByName(parsed._deviceName).get_metric(name, parsed._config);
|
||||
}
|
||||
|
||||
ie::Parameter GetConfig(const std::string& deviceName, const std::string& name) const override {
|
||||
Any GetConfig(const std::string& deviceName, const std::string& name) const override {
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName);
|
||||
return GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config);
|
||||
}
|
||||
@ -1092,6 +1106,55 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get device config it is passed as pair of device_name and `AnyMap`
|
||||
* @param configs All set of configs
|
||||
* @note `device_name` is not allowed in form of MULTI:CPU, HETERO:GPU,CPU, AUTO:CPU
|
||||
* just simple forms like CPU, GPU, MULTI, GPU.0, etc
|
||||
*/
|
||||
void ExtractAndSetDeviceConfig(const ov::AnyMap& configs) {
|
||||
for (auto&& config : configs) {
|
||||
auto parsed = parseDeviceNameIntoConfig(config.first);
|
||||
auto devices = GetListOfDevicesInRegistry();
|
||||
auto config_is_device_name_in_regestry =
|
||||
std::any_of(devices.begin(), devices.end(), [&](const std::string& device) {
|
||||
return device == parsed._deviceName;
|
||||
});
|
||||
if (config_is_device_name_in_regestry) {
|
||||
SetConfigForPlugins(any_copy(config.second.as<ov::AnyMap>()), config.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> GetSupportedConfig(const std::string& deviceName,
|
||||
const std::map<std::string, std::string>& configs) override {
|
||||
std::vector<std::string> supportedConfigKeys = GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
std::map<std::string, std::string> supportedConfig;
|
||||
for (auto&& key : supportedConfigKeys) {
|
||||
auto itKey = configs.find(key);
|
||||
if (configs.end() != itKey) {
|
||||
supportedConfig[key] = itKey->second;
|
||||
}
|
||||
}
|
||||
for (auto&& config : configs) {
|
||||
auto parsed = parseDeviceNameIntoConfig(config.first);
|
||||
if (deviceName.find(parsed._deviceName) != std::string::npos) {
|
||||
std::string key, value;
|
||||
std::stringstream strm(config.second);
|
||||
while (strm >> key >> value) {
|
||||
if (supportedConfigKeys.end() !=
|
||||
std::find(supportedConfigKeys.begin(), supportedConfigKeys.end(), key)) {
|
||||
supportedConfig[key] = value;
|
||||
}
|
||||
}
|
||||
for (auto&& config : parsed._config) {
|
||||
supportedConfig[config.first] = config.second.as<std::string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
return supportedConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Registers the extension in a Core object
|
||||
* Such extensions can be used for both CNNNetwork readers and device plugins
|
||||
@ -1593,37 +1656,37 @@ ie::CNNNetwork toCNN(const std::shared_ptr<const ngraph::Function>& model) {
|
||||
|
||||
} // namespace
|
||||
|
||||
CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model, const ConfigMap& config) {
|
||||
CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model, const AnyMap& config) {
|
||||
return compile_model(model, ov::DEFAULT_DEVICE_NAME, config);
|
||||
}
|
||||
|
||||
CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model,
|
||||
const std::string& deviceName,
|
||||
const ConfigMap& config) {
|
||||
const AnyMap& config) {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->LoadNetwork(toCNN(model), deviceName, config);
|
||||
auto exec = _impl->LoadNetwork(toCNN(model), deviceName, any_copy(flatten_sub_properties(deviceName, config)));
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
|
||||
CompiledModel Core::compile_model(const std::string& modelPath, const ConfigMap& config) {
|
||||
CompiledModel Core::compile_model(const std::string& modelPath, const AnyMap& config) {
|
||||
return compile_model(modelPath, ov::DEFAULT_DEVICE_NAME, config);
|
||||
}
|
||||
|
||||
CompiledModel Core::compile_model(const std::string& modelPath,
|
||||
const std::string& deviceName,
|
||||
const ConfigMap& config) {
|
||||
CompiledModel Core::compile_model(const std::string& modelPath, const std::string& deviceName, const AnyMap& config) {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->LoadNetwork(modelPath, deviceName, config);
|
||||
auto exec = _impl->LoadNetwork(modelPath, deviceName, any_copy(flatten_sub_properties(deviceName, config)));
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
|
||||
CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model,
|
||||
const RemoteContext& context,
|
||||
const ConfigMap& config) {
|
||||
const AnyMap& config) {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->LoadNetwork(toCNN(model), context._impl, config);
|
||||
auto exec = _impl->LoadNetwork(toCNN(model),
|
||||
context._impl,
|
||||
any_copy(flatten_sub_properties(context.get_device_name(), config)));
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
@ -1648,15 +1711,15 @@ void Core::add_extension(const std::vector<std::shared_ptr<ov::Extension>>& exte
|
||||
OV_CORE_CALL_STATEMENT({ _impl->AddOVExtensions(extensions); });
|
||||
}
|
||||
|
||||
CompiledModel Core::import_model(std::istream& modelStream, const std::string& deviceName, const ConfigMap& config) {
|
||||
CompiledModel Core::import_model(std::istream& modelStream, const std::string& deviceName, const AnyMap& config) {
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "Core::import_model");
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->ImportNetwork(modelStream, deviceName, config);
|
||||
auto exec = _impl->ImportNetwork(modelStream, deviceName, any_copy(flatten_sub_properties(deviceName, config)));
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
|
||||
CompiledModel Core::import_model(std::istream& modelStream, const RemoteContext& context, const ConfigMap& config) {
|
||||
CompiledModel Core::import_model(std::istream& modelStream, const RemoteContext& context, const AnyMap& config) {
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "Core::import_model");
|
||||
|
||||
using ExportMagic = std::array<char, 4>;
|
||||
@ -1683,34 +1746,39 @@ CompiledModel Core::import_model(std::istream& modelStream, const RemoteContext&
|
||||
|
||||
SupportedOpsMap Core::query_model(const std::shared_ptr<const ov::Model>& model,
|
||||
const std::string& deviceName,
|
||||
const ConfigMap& config) const {
|
||||
const AnyMap& config) const {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto qnResult = _impl->QueryNetwork(toCNN(model), deviceName, config);
|
||||
auto qnResult =
|
||||
_impl->QueryNetwork(toCNN(model), deviceName, any_copy(flatten_sub_properties(deviceName, config)));
|
||||
return qnResult.supportedLayersMap;
|
||||
});
|
||||
}
|
||||
|
||||
void Core::set_config(const ConfigMap& config, const std::string& deviceName) {
|
||||
OPENVINO_ASSERT(deviceName.find("HETERO:") != 0,
|
||||
"set_config is supported only for HETERO itself (without devices). "
|
||||
"You can configure the devices with set_config before creating the HETERO on top.");
|
||||
OPENVINO_ASSERT(deviceName.find("MULTI:") != 0,
|
||||
"set_config is supported only for MULTI itself (without devices). "
|
||||
"You can configure the devices with set_config before creating the MULTI on top.");
|
||||
OPENVINO_ASSERT(deviceName.find("AUTO:") != 0,
|
||||
"set_config is supported only for AUTO itself (without devices). "
|
||||
"You can configure the devices with set_config before creating the AUTO on top.");
|
||||
|
||||
void Core::set_property(const AnyMap& config) {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
if (deviceName.empty()) {
|
||||
_impl->SetConfigForPlugins(config, std::string());
|
||||
} else {
|
||||
_impl->SetConfigForPlugins(config, deviceName);
|
||||
}
|
||||
_impl->ExtractAndSetDeviceConfig(config);
|
||||
_impl->SetConfigForPlugins(any_copy(config), {});
|
||||
});
|
||||
}
|
||||
|
||||
Any Core::get_config(const std::string& deviceName, const std::string& name) const {
|
||||
void Core::set_property(const std::string& deviceName, const AnyMap& config) {
|
||||
OPENVINO_ASSERT(deviceName.find("HETERO:") != 0,
|
||||
"set_property is supported only for HETERO itself (without devices). "
|
||||
"You can configure the devices with set_property before creating the HETERO on top.");
|
||||
OPENVINO_ASSERT(deviceName.find("MULTI:") != 0,
|
||||
"set_property is supported only for MULTI itself (without devices). "
|
||||
"You can configure the devices with set_property before creating the MULTI on top.");
|
||||
OPENVINO_ASSERT(deviceName.find("AUTO:") != 0,
|
||||
"set_property is supported only for AUTO itself (without devices). "
|
||||
"You can configure the devices with set_property before creating the AUTO on top.");
|
||||
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
_impl->ExtractAndSetDeviceConfig(config);
|
||||
_impl->SetConfigForPlugins(any_copy(config), deviceName);
|
||||
});
|
||||
}
|
||||
|
||||
Any Core::get_property(const std::string& deviceName, const std::string& name) const {
|
||||
OPENVINO_ASSERT(deviceName.find("HETERO:") != 0,
|
||||
"You can only get_config of the HETERO itself (without devices). "
|
||||
"get_config is also possible for the individual devices before creating the HETERO on top.");
|
||||
@ -1723,12 +1791,37 @@ Any Core::get_config(const std::string& deviceName, const std::string& name) con
|
||||
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName);
|
||||
return _impl->GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config);
|
||||
if (ov::supported_properties == name) {
|
||||
try {
|
||||
return _impl->GetCPPPluginByName(parsed._deviceName).get_metric(name, parsed._config);
|
||||
} catch (ie::Exception&) {
|
||||
auto ro_properties = _impl->GetCPPPluginByName(parsed._deviceName)
|
||||
.get_metric(METRIC_KEY(SUPPORTED_METRICS), parsed._config)
|
||||
.as<std::vector<std::string>>();
|
||||
auto rw_properties = _impl->GetCPPPluginByName(parsed._deviceName)
|
||||
.get_metric(METRIC_KEY(SUPPORTED_CONFIG_KEYS), parsed._config)
|
||||
.as<std::vector<std::string>>();
|
||||
std::vector<ov::PropertyName> supported_properties;
|
||||
for (auto&& ro_property : ro_properties) {
|
||||
supported_properties.emplace_back(ro_property, PropertyMutability::RO);
|
||||
}
|
||||
for (auto&& rw_property : rw_properties) {
|
||||
supported_properties.emplace_back(rw_property, PropertyMutability::RW);
|
||||
}
|
||||
supported_properties.emplace_back(ov::supported_properties.name(), PropertyMutability::RO);
|
||||
return supported_properties;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return _impl->GetCPPPluginByName(parsed._deviceName).get_metric(name, parsed._config);
|
||||
} catch (ie::Exception&) {
|
||||
return _impl->GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Any Core::get_metric(const std::string& deviceName, const std::string& name) const {
|
||||
OV_CORE_CALL_STATEMENT(return _impl->GetMetric(deviceName, name););
|
||||
void Core::get_property(const std::string& deviceName, const std::string& name, ov::Any& to) const {
|
||||
any_lexical_cast(get_property(deviceName, name), to);
|
||||
}
|
||||
|
||||
std::vector<std::string> Core::get_available_devices() const {
|
||||
@ -1752,13 +1845,13 @@ void Core::register_plugins(const std::string& xmlConfigFile) {
|
||||
OV_CORE_CALL_STATEMENT(_impl->RegisterPluginsInRegistry(xmlConfigFile););
|
||||
}
|
||||
|
||||
RemoteContext Core::create_context(const std::string& deviceName, const ParamMap& params) {
|
||||
RemoteContext Core::create_context(const std::string& deviceName, const AnyMap& params) {
|
||||
OPENVINO_ASSERT(deviceName.find("HETERO") != 0, "HETERO device does not support remote context");
|
||||
OPENVINO_ASSERT(deviceName.find("MULTI") != 0, "MULTI device does not support remote context");
|
||||
OPENVINO_ASSERT(deviceName.find("AUTO") != 0, "AUTO device does not support remote context");
|
||||
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, params);
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, flatten_sub_properties(deviceName, params));
|
||||
auto remoteContext = _impl->GetCPPPluginByName(parsed._deviceName).create_context(parsed._config);
|
||||
return {remoteContext._ptr, remoteContext._so};
|
||||
});
|
||||
@ -1770,7 +1863,7 @@ RemoteContext Core::get_default_context(const std::string& deviceName) {
|
||||
OPENVINO_ASSERT(deviceName.find("AUTO") != 0, "AUTO device does not support remote context");
|
||||
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, ParamMap());
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, AnyMap{});
|
||||
auto remoteContext = _impl->GetCPPPluginByName(parsed._deviceName).get_default_context(parsed._config);
|
||||
return {remoteContext._ptr, remoteContext._so};
|
||||
});
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "openvino/runtime/remote_tensor.hpp"
|
||||
|
||||
#include "any_copy.hpp"
|
||||
#include "ie_ngraph_utils.hpp"
|
||||
#include "ie_remote_blob.hpp"
|
||||
|
||||
@ -32,12 +33,12 @@ void RemoteTensor::type_check(const Tensor& tensor, const std::map<std::string,
|
||||
}
|
||||
}
|
||||
|
||||
ie::ParamMap RemoteTensor::get_params() const {
|
||||
AnyMap RemoteTensor::get_params() const {
|
||||
OPENVINO_ASSERT(_impl != nullptr, "Remote tensor was not initialized.");
|
||||
type_check(*this);
|
||||
auto remote_impl = static_cast<ie::RemoteBlob*>(_impl.get());
|
||||
try {
|
||||
ParamMap paramMap;
|
||||
AnyMap paramMap;
|
||||
for (auto&& param : remote_impl->getParams()) {
|
||||
paramMap.emplace(param.first, Any{param.second, _so});
|
||||
}
|
||||
@ -51,8 +52,8 @@ ie::ParamMap RemoteTensor::get_params() const {
|
||||
|
||||
std::string RemoteTensor::get_device_name() const {
|
||||
OPENVINO_ASSERT(_impl != nullptr, "Remote tensor was not initialized.");
|
||||
type_check(*this);
|
||||
auto remote_impl = static_cast<ie::RemoteBlob*>(_impl.get());
|
||||
type_check(*this);
|
||||
try {
|
||||
return remote_impl->getDeviceName();
|
||||
} catch (const std::exception& ex) {
|
||||
|
@ -69,19 +69,6 @@ namespace {
|
||||
std::mutex MultiDeviceInferencePlugin::_mtx;
|
||||
std::map<unsigned int, std::list<std::string>> MultiDeviceInferencePlugin::_priorityMap;
|
||||
|
||||
std::map<std::string, std::string> MultiDeviceInferencePlugin::GetSupportedConfig(
|
||||
const std::map<std::string, std::string> & config, const std::string & deviceName) const {
|
||||
std::vector<std::string> supportedConfigKeys = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
std::map<std::string, std::string> supportedConfig;
|
||||
for (auto&& key : supportedConfigKeys) {
|
||||
auto itKey = config.find(key);
|
||||
if (config.end() != itKey) {
|
||||
supportedConfig[key] = itKey->second;
|
||||
}
|
||||
}
|
||||
return supportedConfig;
|
||||
}
|
||||
|
||||
std::vector<DeviceInformation> MultiDeviceInferencePlugin::ParseMetaDevices(const std::string& priorities,
|
||||
const std::map<std::string, std::string> & config) const {
|
||||
std::vector<DeviceInformation> metaDevices;
|
||||
@ -109,13 +96,13 @@ std::vector<DeviceInformation> MultiDeviceInferencePlugin::ParseMetaDevices(cons
|
||||
tconfig[PluginConfigParams::KEY_DEVICE_ID] = deviceIDLocal;
|
||||
}
|
||||
|
||||
return GetSupportedConfig(tconfig, deviceName);
|
||||
return GetCore()->GetSupportedConfig(deviceName, tconfig);
|
||||
};
|
||||
|
||||
auto getDefaultDeviceID = [this](std::string deviceName) -> std::string {
|
||||
std::vector<std::string> supportedMetrics = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_METRICS));
|
||||
auto supportedMetrics = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_METRICS)).as<std::vector<std::string>>();
|
||||
if (std::find(supportedMetrics.begin(), supportedMetrics.end(), METRIC_KEY(SUPPORTED_CONFIG_KEYS)) != supportedMetrics.end()) {
|
||||
std::vector<std::string> supportKeys = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
auto supportKeys = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS)).as<std::vector<std::string>>();
|
||||
|
||||
if (std::find(supportKeys.begin(), supportKeys.end(), CONFIG_KEY(DEVICE_ID)) != supportKeys.end()) {
|
||||
return GetCore()->GetConfig(deviceName, CONFIG_KEY(DEVICE_ID)).as<std::string>();
|
||||
@ -622,9 +609,9 @@ std::vector<DeviceInformation> MultiDeviceInferencePlugin::FilterDevice(const st
|
||||
std::vector<DeviceInformation> filterDevice;
|
||||
for (auto&& item : metaDevices) {
|
||||
bool support = true;
|
||||
std::vector<std::string> supportedMetrics = GetCore()->GetMetric(item.deviceName, METRIC_KEY(SUPPORTED_METRICS));
|
||||
auto supportedMetrics = GetCore()->GetMetric(item.deviceName, METRIC_KEY(SUPPORTED_METRICS)).as<std::vector<std::string>>();
|
||||
if (std::find(supportedMetrics.begin(), supportedMetrics.end(), METRIC_KEY(SUPPORTED_CONFIG_KEYS)) != supportedMetrics.end()) {
|
||||
std::vector<std::string> supportKeys = GetCore()->GetMetric(item.deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
auto supportKeys = GetCore()->GetMetric(item.deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS)).as<std::vector<std::string>>();
|
||||
for (auto&& kvp : config) {
|
||||
auto targetKey = std::find(supportKeys.begin(), supportKeys.end(), kvp.first);
|
||||
// if device have the key, we think the device support it
|
||||
|
@ -516,20 +516,6 @@ std::map<std::string, std::string> mergeConfigs(std::map<std::string, std::strin
|
||||
|
||||
} // namespace
|
||||
|
||||
std::map<std::string, std::string> AutoBatchInferencePlugin::GetSupportedConfig(
|
||||
const std::map<std::string, std::string>& config,
|
||||
const std::string& deviceName) const {
|
||||
std::vector<std::string> supportedConfigKeys = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
std::map<std::string, std::string> supportedConfig;
|
||||
for (auto&& key : supportedConfigKeys) {
|
||||
auto itKey = config.find(key);
|
||||
if (config.end() != itKey) {
|
||||
supportedConfig[key] = itKey->second;
|
||||
}
|
||||
}
|
||||
return supportedConfig;
|
||||
}
|
||||
|
||||
DeviceInformation AutoBatchInferencePlugin::ParseBatchDevice(const std::string& deviceWithBatch) {
|
||||
auto&& d = deviceWithBatch;
|
||||
auto openingBracket = d.find_first_of('(');
|
||||
@ -560,7 +546,7 @@ DeviceInformation AutoBatchInferencePlugin::ParseMetaDevice(const std::string& d
|
||||
tconfig[PluginConfigParams::KEY_DEVICE_ID] = deviceIDLocal;
|
||||
}
|
||||
|
||||
return GetSupportedConfig(tconfig, deviceName);
|
||||
return GetCore()->GetSupportedConfig(deviceName, tconfig);
|
||||
};
|
||||
|
||||
auto metaDevice = ParseBatchDevice(devicesBatchCfg);
|
||||
|
@ -73,18 +73,6 @@ InferenceEngine::IExecutableNetworkInternal::Ptr Engine::ImportNetwork(
|
||||
return std::make_shared<HeteroExecutableNetwork>(heteroModel, mergeConfigs(_config, config), this);
|
||||
}
|
||||
|
||||
Engine::Configs Engine::GetSupportedConfig(const Engine::Configs& config, const std::string& deviceName) const {
|
||||
std::vector<std::string> supportedConfigKeys = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
|
||||
Engine::Configs supportedConfig;
|
||||
for (auto&& key : supportedConfigKeys) {
|
||||
auto itKey = config.find(key);
|
||||
if (config.end() != itKey) {
|
||||
supportedConfig[key] = itKey->second;
|
||||
}
|
||||
}
|
||||
return supportedConfig;
|
||||
}
|
||||
|
||||
Engine::DeviceMetaInformationMap Engine::GetDevicePlugins(const std::string& targetFallback,
|
||||
const Configs& localConfig) const {
|
||||
auto getDeviceConfig = [&](const std::string& deviceWithID) {
|
||||
@ -98,7 +86,7 @@ Engine::DeviceMetaInformationMap Engine::GetDevicePlugins(const std::string& tar
|
||||
tconfig[KEY_DEVICE_ID] = deviceIDLocal;
|
||||
}
|
||||
|
||||
return GetSupportedConfig(tconfig, deviceName);
|
||||
return GetCore()->GetSupportedConfig(deviceName, tconfig);
|
||||
};
|
||||
|
||||
auto fallbackDevices = InferenceEngine::DeviceIDParser::getHeteroDevices(targetFallback);
|
||||
|
@ -269,7 +269,7 @@ IExecutableNetworkInternal::Ptr Plugin::LoadExeNetworkImpl(const InferenceEngine
|
||||
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "Plugin::LoadExeNetworkImpl::CreateContext");
|
||||
std::lock_guard<std::mutex> lock(engine_mutex);
|
||||
if (!canReuseDefaultContext()) {
|
||||
m_defaultContext.reset(new RemoteCLContext(shared_from_this(), ParamMap(), conf));
|
||||
m_defaultContext.reset(new RemoteCLContext(shared_from_this(), AnyMap(), conf));
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ IExecutableNetworkInternal::Ptr Plugin::LoadExeNetworkImpl(const InferenceEngine
|
||||
return std::make_shared<CompiledModel>(transformedNetwork, casted, conf);
|
||||
}
|
||||
|
||||
InferenceEngine::RemoteContext::Ptr Plugin::CreateContext(const ParamMap& params) {
|
||||
InferenceEngine::RemoteContext::Ptr Plugin::CreateContext(const AnyMap& params) {
|
||||
// parameter map is non-empty
|
||||
std::string contextTypeStr = _StrFromParams(params, GPU_PARAM_KEY(CONTEXT_TYPE));
|
||||
|
||||
@ -320,7 +320,7 @@ InferenceEngine::RemoteContext::Ptr Plugin::CreateContext(const ParamMap& params
|
||||
}
|
||||
}
|
||||
|
||||
InferenceEngine::RemoteContext::Ptr Plugin::GetDefaultContext(const ParamMap& params) {
|
||||
InferenceEngine::RemoteContext::Ptr Plugin::GetDefaultContext(const AnyMap& params) {
|
||||
if (nullptr == m_defaultContext) {
|
||||
m_defaultContext.reset(new RemoteCLContext(shared_from_this(), params, _impl->m_configs.GetDefaultDeviceConfig()));
|
||||
}
|
||||
@ -361,7 +361,7 @@ QueryNetworkResult Plugin::QueryNetwork(const CNNNetwork& network,
|
||||
if (m_defaultContext == nullptr) {
|
||||
m_defaultContext.reset(new RemoteCLContext(
|
||||
std::const_pointer_cast<InferenceEngine::IInferencePlugin>(shared_from_this()),
|
||||
ParamMap(), conf));
|
||||
AnyMap(), conf));
|
||||
}
|
||||
Program prog(m_defaultContext->getImpl()->GetEngine(), conf);
|
||||
auto function = network.getFunction();
|
||||
|
@ -43,7 +43,7 @@ RemoteBlobImpl::RemoteBlobImpl(ClContext::Ptr context,
|
||||
}
|
||||
}
|
||||
|
||||
ParamMap RemoteBlobImpl::getParams() const {
|
||||
AnyMap RemoteBlobImpl::getParams() const {
|
||||
assert(m_memObject != nullptr);
|
||||
auto params = m_memObject->get_internal_params();
|
||||
|
||||
@ -264,7 +264,7 @@ void RemoteAllocator::unlock(void* handle) noexcept {
|
||||
}
|
||||
|
||||
ExecutionContextImpl::ExecutionContextImpl(const std::shared_ptr<IInferencePlugin> plugin,
|
||||
const ParamMap& params,
|
||||
const AnyMap& params,
|
||||
const Config& config) :
|
||||
m_plugin(plugin),
|
||||
m_type(ContextType::OCL),
|
||||
@ -330,8 +330,8 @@ ExecutionContextImpl::ExecutionContextImpl(const std::shared_ptr<IInferencePlugi
|
||||
engine_params.task_executor);
|
||||
}
|
||||
|
||||
ParamMap ExecutionContextImpl::getParams() const {
|
||||
ParamMap ret = { { GPU_PARAM_KEY(OCL_CONTEXT), m_engine->get_user_context() } };
|
||||
AnyMap ExecutionContextImpl::getParams() const {
|
||||
AnyMap ret = { { GPU_PARAM_KEY(OCL_CONTEXT), m_engine->get_user_context() } };
|
||||
|
||||
switch (m_type) {
|
||||
case OCL:
|
||||
|
@ -61,17 +61,12 @@ TEST(ExecutableNetworkOVTests, throwsOnUninitializedInputIndex) {
|
||||
|
||||
TEST(ExecutableNetworkOVTests, throwsOnUninitializedSetConfig) {
|
||||
ov::CompiledModel exec;
|
||||
ASSERT_THROW(exec.set_config({{}}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkOVTests, throwsOnUninitializedGetConfig) {
|
||||
ov::CompiledModel exec;
|
||||
ASSERT_THROW(exec.get_config({}), ov::Exception);
|
||||
ASSERT_THROW(exec.set_property({{}}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkOVTests, throwsOnUninitializedGetMetric) {
|
||||
ov::CompiledModel exec;
|
||||
ASSERT_THROW(exec.get_metric({}), ov::Exception);
|
||||
ASSERT_THROW(exec.get_property({}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkOVTests, throwsOnUninitializedGetContext) {
|
||||
|
@ -51,7 +51,7 @@ std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypes = {
|
||||
ngraph::helpers::EltwiseTypes::MOD
|
||||
};
|
||||
|
||||
std::map<std::string, std::string> additionalConfig = {};
|
||||
ov::AnyMap additionalConfig = {};
|
||||
|
||||
const auto elementiwiseParams = ::testing::Combine(
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputShapes)),
|
||||
|
@ -0,0 +1,80 @@
|
||||
// Copyright (C) 2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "conformance.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
// TODO: fix namespaces
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
namespace conformance {
|
||||
|
||||
inline const std::string get_plugin_lib_name_by_device(const std::string& deviceName) {
|
||||
const std::map<std::string, std::string> devices{
|
||||
{ "AUTO", "ov_auto_plugin" },
|
||||
{ "HDDL", "HDDLPlugin" },
|
||||
{ "VPUX", "ov_intel_vpux_plugin" },
|
||||
{ "AUTO", "ov_auto_plugin" },
|
||||
{ "CPU", "ov_intel_cpu_plugin" },
|
||||
{ "GNA", "ov_intel_gna_plugin" },
|
||||
{ "GPU", "ov_intel_gpu_plugin" },
|
||||
{ "HETERO", "ov_hetero_plugin" },
|
||||
{ "MULTI", "ov_multi_plugin" },
|
||||
{ "MYRIAD", "ov_intel_vpu_plugin" },
|
||||
{ "TEMPLATE", "ov_template_plugin" },
|
||||
};
|
||||
if (devices.find(deviceName) == devices.end()) {
|
||||
throw std::runtime_error("Incorrect device name");
|
||||
}
|
||||
return devices.at(deviceName);
|
||||
}
|
||||
|
||||
|
||||
inline const std::vector<ov::AnyMap> generate_configs(const std::string& targetDevice,
|
||||
const std::vector<ov::AnyMap>& config = {}) {
|
||||
std::pair<std::string, std::string> defaultConfig;
|
||||
if (targetDevice == std::string(CommonTestUtils::DEVICE_MULTI) || targetDevice == std::string(CommonTestUtils::DEVICE_AUTO)) {
|
||||
defaultConfig = {MULTI_CONFIG_KEY(DEVICE_PRIORITIES), ov::test::conformance::targetDevice};;
|
||||
} else if (targetDevice == std::string(CommonTestUtils::DEVICE_HETERO)) {
|
||||
defaultConfig = { "TARGET_FALLBACK" , ov::test::conformance::targetDevice };
|
||||
} else if (targetDevice == std::string(CommonTestUtils::DEVICE_BATCH)) {
|
||||
defaultConfig = { CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) , std::string(ov::test::conformance::targetDevice)};
|
||||
} else {
|
||||
throw std::runtime_error("Incorrect target device: " + targetDevice);
|
||||
}
|
||||
|
||||
std::vector<ov::AnyMap> resultConfig;
|
||||
if (config.empty()) {
|
||||
return {{defaultConfig}};
|
||||
}
|
||||
for (auto configItem : config) {
|
||||
configItem.insert(defaultConfig);
|
||||
resultConfig.push_back(configItem);
|
||||
}
|
||||
return resultConfig;
|
||||
}
|
||||
|
||||
inline const std::string generate_complex_device_name(const std::string& deviceName) {
|
||||
return deviceName + ":" + ov::test::conformance::targetDevice;
|
||||
}
|
||||
|
||||
inline const std::vector<std::string> return_all_possible_device_combination() {
|
||||
std::vector<std::string> res{ov::test::conformance::targetDevice};
|
||||
std::vector<std::string> devices{CommonTestUtils::DEVICE_HETERO, CommonTestUtils::DEVICE_AUTO, CommonTestUtils::DEVICE_MULTI};
|
||||
for (const auto& device : devices) {
|
||||
res.emplace_back(generate_complex_device_name(device));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const std::vector<ov::AnyMap> empty_config = {
|
||||
{},
|
||||
};
|
||||
|
||||
} // namespace conformance
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -5,9 +5,9 @@
|
||||
#include "behavior/executable_network/get_metric.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::conformance;
|
||||
using namespace BehaviorTestsDefinitions;
|
||||
using namespace InferenceEngine::PluginConfigParams;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include "api_conformance_helpers.hpp"
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::conformance;
|
||||
using namespace BehaviorTestsDefinitions;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestCallbackTests,
|
||||
::testing::Combine(
|
||||
|
@ -12,6 +12,6 @@ using namespace ov::test::conformance;
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestCancellationTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(std::vector<std::map<std::string, std::string>>{})),
|
||||
InferRequestCancellationTests::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "api_conformance_helpers.hpp"
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::conformance;
|
||||
using namespace BehaviorTestsDefinitions;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestIOBBlobTest,
|
||||
::testing::Combine(
|
||||
|
@ -16,7 +16,7 @@ using namespace BehaviorTestsDefinitions;
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestMultithreadingTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(std::vector<std::map<std::string, std::string>>{})),
|
||||
InferRequestMultithreadingTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, InferRequestMultithreadingTests,
|
||||
|
@ -12,7 +12,7 @@ using namespace BehaviorTestsDefinitions;
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestPerfCountersTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(std::vector<std::map<std::string, std::string>>{})),
|
||||
InferRequestPerfCountersTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, InferRequestPerfCountersTest,
|
||||
|
@ -15,7 +15,7 @@ using namespace BehaviorTestsDefinitions;
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestWaitTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(std::vector<std::map<std::string, std::string>>{})),
|
||||
InferRequestWaitTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, InferRequestWaitTests,
|
||||
|
@ -2,14 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
#include "behavior/ov_executable_network/exec_graph_info.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
#include "ie_plugin_config.hpp"
|
||||
#include <common_test_utils/test_constants.hpp>
|
||||
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
const std::vector<ov::element::Type_t> ovExecGraphInfoElemTypes = {
|
||||
ov::element::i8,
|
||||
@ -29,7 +29,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ovExecGraphInfoElemTypes),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVExecGraphImportExportTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests,
|
||||
@ -37,7 +37,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ovExecGraphInfoElemTypes),
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVExecGraphImportExportTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
|
||||
@ -45,14 +45,14 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ovExecGraphInfoElemTypes),
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVExecGraphImportExportTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests,
|
||||
OVExecGraphImportExportTest,
|
||||
::testing::Combine(::testing::ValuesIn(ovExecGraphInfoElemTypes),
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVExecGraphImportExportTest::getTestCaseName);
|
||||
|
||||
} // namespace
|
@ -4,33 +4,33 @@
|
||||
|
||||
#include "behavior/ov_executable_network/exec_network_base.hpp"
|
||||
#include "ie_plugin_config.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVExecutableNetworkBaseTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVExecutableNetworkBaseTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVExecutableNetworkBaseTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVExecutableNetworkBaseTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVExecutableNetworkBaseTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVExecutableNetworkBaseTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVExecutableNetworkBaseTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVExecutableNetworkBaseTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
#include "behavior/ov_executable_network/get_metric.hpp"
|
||||
#include "openvino/runtime/core.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
using namespace InferenceEngine::PluginConfigParams;
|
||||
|
||||
namespace {
|
||||
//
|
||||
// IE Class Common tests with <pluginName, deviceName params>
|
||||
//
|
||||
@ -19,7 +19,7 @@ namespace {
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassImportExportTestP, OVClassImportExportTestP,
|
||||
::testing::Values(generateComplexDeviceName(CommonTestUtils::DEVICE_HETERO)));
|
||||
::testing::Values(generate_complex_device_name(CommonTestUtils::DEVICE_HETERO)));
|
||||
|
||||
//
|
||||
// Executable Network GetMetric
|
||||
@ -27,23 +27,23 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_NETWORK_NAME,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_ThrowsUnsupported,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
//
|
||||
// Executable Network GetConfig / SetConfig
|
||||
|
@ -5,33 +5,33 @@
|
||||
#include <vector>
|
||||
|
||||
#include "behavior/ov_infer_request/callback.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestCallbackTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestCallbackTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestCallbackTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVInferRequestCallbackTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestCallbackTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVInferRequestCallbackTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestCallbackTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVInferRequestCallbackTests::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -3,15 +3,15 @@
|
||||
//
|
||||
|
||||
#include "behavior/ov_infer_request/cancellation.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestCancellationTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestCancellationTests::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -5,12 +5,12 @@
|
||||
#include <vector>
|
||||
|
||||
#include "behavior/ov_infer_request/infer_request_dynamic.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
std::shared_ptr<ngraph::Function> ovGetFunction1() {
|
||||
const std::vector<size_t> inputShape = {1, 4, 20, 20};
|
||||
@ -61,7 +61,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests_1, OVInferRequestDynamicTests,
|
||||
{{1, 4, 20, 20}, {1, 4, 20, 20}},
|
||||
{{2, 4, 20, 20}, {2, 4, 20, 20}}}),
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestDynamicTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests_2, OVInferRequestDynamicTests,
|
||||
@ -71,7 +71,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests_2, OVInferRequestDynamicTests,
|
||||
{{1, 4, 20, 20}, {1, 2, 20, 40}},
|
||||
{{2, 4, 20, 20}, {2, 2, 20, 40}}}),
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestDynamicTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestDynamicTests,
|
||||
@ -81,7 +81,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestDynamicTests,
|
||||
{{1, 4, 20, 20}, {1, 2, 20, 40}},
|
||||
{{2, 4, 20, 20}, {2, 2, 20, 40}}}),
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVInferRequestDynamicTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestDynamicTests,
|
||||
@ -91,7 +91,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestDynamicTests,
|
||||
{{1, 4, 20, 20}, {1, 2, 20, 40}},
|
||||
{{2, 4, 20, 20}, {2, 2, 20, 40}}}),
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVInferRequestDynamicTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestDynamicTests,
|
||||
@ -101,6 +101,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestDynamicTests,
|
||||
{{1, 4, 20, 20}, {1, 2, 20, 40}},
|
||||
{{2, 4, 20, 20}, {2, 2, 20, 40}}}),
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVInferRequestDynamicTests::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -4,33 +4,33 @@
|
||||
|
||||
#include "behavior/ov_infer_request/inference_chaining.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferenceChaining,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferenceChaining::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferenceChaining,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVInferenceChaining::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferenceChaining,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVInferenceChaining::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferenceChaining,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVInferenceChaining::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "behavior/ov_infer_request/io_tensor.hpp"
|
||||
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
@ -15,25 +15,25 @@ namespace {
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestIOTensorTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestIOTensorTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVInferRequestIOTensorTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestIOTensorTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVInferRequestIOTensorTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestIOTensorTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVInferRequestIOTensorTest::getTestCaseName);
|
||||
|
||||
std::vector<ov::element::Type> ovIOTensorElemTypes = {
|
||||
@ -59,27 +59,27 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorSetPrecision
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ovIOTensorElemTypes),
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestIOTensorSetPrecisionTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestIOTensorSetPrecisionTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ovIOTensorElemTypes),
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVInferRequestIOTensorSetPrecisionTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestIOTensorSetPrecisionTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ovIOTensorElemTypes),
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVInferRequestIOTensorSetPrecisionTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestIOTensorSetPrecisionTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ovIOTensorElemTypes),
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVInferRequestIOTensorSetPrecisionTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "behavior/ov_infer_request/multithreading.hpp"
|
||||
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
@ -15,25 +15,25 @@ namespace {
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestMultithreadingTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestMultithreadingTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestMultithreadingTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVInferRequestMultithreadingTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestMultithreadingTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVInferRequestMultithreadingTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestMultithreadingTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVInferRequestMultithreadingTests::getTestCaseName);
|
||||
|
||||
} // namespace
|
||||
|
@ -3,7 +3,7 @@
|
||||
//
|
||||
|
||||
#include "behavior/ov_infer_request/perf_counters.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
@ -12,24 +12,24 @@ namespace {
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestPerfCountersTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestPerfCountersTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestPerfCountersTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVInferRequestPerfCountersTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestPerfCountersTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVInferRequestPerfCountersTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestPerfCountersTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVInferRequestPerfCountersTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "behavior/ov_infer_request/wait.hpp"
|
||||
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
@ -15,24 +15,24 @@ namespace {
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestWaitTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::conformance::targetDevice),
|
||||
::testing::ValuesIn(emptyConfig)),
|
||||
::testing::ValuesIn(empty_config)),
|
||||
OVInferRequestWaitTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestWaitTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_MULTI))),
|
||||
OVInferRequestWaitTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestWaitTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_AUTO))),
|
||||
OVInferRequestWaitTests::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestWaitTests,
|
||||
::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(generate_configs(CommonTestUtils::DEVICE_HETERO))),
|
||||
OVInferRequestWaitTests::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "behavior/ov_plugin/core_integration.hpp"
|
||||
#include "openvino/runtime/core.hpp"
|
||||
#include "api_conformance_helpers.hpp"
|
||||
#include "ov_api_conformance_helpers.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
using namespace ov::test::conformance;
|
||||
@ -17,7 +17,7 @@ namespace {
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassCommon, OVClassBasicTestP,
|
||||
::testing::Values(std::make_pair(getPluginLibNameByDevice(ov::test::conformance::targetDevice), ov::test::conformance::targetDevice)));
|
||||
::testing::Values(std::make_pair(get_plugin_lib_name_by_device(ov::test::conformance::targetDevice), ov::test::conformance::targetDevice)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassNetworkTestP, OVClassNetworkTestP,
|
||||
@ -25,7 +25,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassImportExportTestP, OVClassImportExportTestP,
|
||||
::testing::Values(generateComplexDeviceName(ov::test::conformance::targetDevice)));
|
||||
::testing::Values(generate_complex_device_name(ov::test::conformance::targetDevice)));
|
||||
|
||||
//
|
||||
// IE Class GetMetric
|
||||
@ -33,11 +33,11 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassGetMetricTest, OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassGetMetricTest, OVClassGetMetricTest_SUPPORTED_METRICS,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassGetMetricTest, OVClassGetMetricTest_AVAILABLE_DEVICES,
|
||||
@ -45,7 +45,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassGetMetricTest, OVClassGetMetricTest_FULL_DEVICE_NAME,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassGetMetricTest, OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
|
||||
@ -61,11 +61,11 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassGetMetricTest, OVClassGetMetricTest_ThrowUnsupported,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassGetConfigTest, OVClassGetConfigTest_ThrowUnsupported,
|
||||
::testing::ValuesIn(returnAllPossibleDeviceCombination()));
|
||||
::testing::ValuesIn(return_all_possible_device_combination()));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassGetAvailableDevices, OVClassGetAvailableDevices,
|
||||
|
@ -10,6 +10,7 @@
|
||||
using namespace BehaviorTestsDefinitions;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
|
||||
namespace {
|
||||
#if (defined(__APPLE__) || defined(_WIN32))
|
||||
auto defaultBindThreadParameter = InferenceEngine::Parameter{[] {
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include "api_conformance_helpers.hpp"
|
||||
|
||||
using namespace BehaviorTestsDefinitions;
|
||||
using namespace ov::test::conformance;
|
||||
using namespace InferenceEngine::PluginConfigParams;
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
//
|
||||
|
@ -5,9 +5,10 @@
|
||||
#include <behavior/plugin/core_threading.hpp>
|
||||
#include "api_conformance_helpers.hpp"
|
||||
|
||||
namespace {
|
||||
using namespace ov::test::conformance;
|
||||
|
||||
namespace {
|
||||
|
||||
const Params coreThreadingParams[] = {
|
||||
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_HETERO, generateConfigs(CommonTestUtils::DEVICE_HETERO).front() },
|
||||
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_MULTI, generateConfigs(CommonTestUtils::DEVICE_MULTI).front() },
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "api_conformance_helpers.hpp"
|
||||
|
||||
using namespace BehaviorTestsDefinitions;
|
||||
using namespace ov::test::conformance;
|
||||
namespace {
|
||||
const std::vector<std::vector<int >> orders = {
|
||||
// 0 - plugin
|
||||
|
@ -30,21 +30,21 @@ INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, InferRequestPreprocessTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(netPrecisionsPreprocess),
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
InferRequestPreprocessTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, InferRequestPreprocessTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(netPrecisionsPreprocess),
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
InferRequestPreprocessTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, InferRequestPreprocessTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(netPrecisionsPreprocess),
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
InferRequestPreprocessTest::getTestCaseName);
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, InferRequestPreprocessConve
|
||||
::testing::Bool(),
|
||||
::testing::Bool(),
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
InferRequestPreprocessConversionTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, InferRequestPreprocessDynamicallyInSetBlobTest,
|
||||
@ -115,7 +115,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, InferRequestPreprocessDynam
|
||||
::testing::Values(true), // only SetBlob
|
||||
::testing::Values(true), // only SetBlob
|
||||
::testing::Values(CommonTestUtils::DEVICE_HETERO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_HETERO))),
|
||||
InferRequestPreprocessDynamicallyInSetBlobTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, InferRequestPreprocessConversionTest,
|
||||
@ -129,7 +129,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, InferRequestPreprocessConver
|
||||
::testing::Bool(),
|
||||
::testing::Bool(),
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
InferRequestPreprocessConversionTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, InferRequestPreprocessDynamicallyInSetBlobTest,
|
||||
@ -143,7 +143,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, InferRequestPreprocessDynami
|
||||
::testing::Values(true), // only SetBlob
|
||||
::testing::Values(true), // only SetBlob
|
||||
::testing::Values(CommonTestUtils::DEVICE_MULTI),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_MULTI))),
|
||||
InferRequestPreprocessDynamicallyInSetBlobTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, InferRequestPreprocessConversionTest,
|
||||
@ -157,7 +157,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, InferRequestPreprocessConvers
|
||||
::testing::Bool(),
|
||||
::testing::Bool(),
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
InferRequestPreprocessConversionTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, InferRequestPreprocessDynamicallyInSetBlobTest,
|
||||
@ -171,6 +171,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, InferRequestPreprocessDynamic
|
||||
::testing::Values(true), // only SetBlob
|
||||
::testing::Values(true), // only SetBlob
|
||||
::testing::Values(CommonTestUtils::DEVICE_AUTO),
|
||||
::testing::ValuesIn(generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
::testing::ValuesIn(ov::test::conformance::generateConfigs(CommonTestUtils::DEVICE_AUTO))),
|
||||
InferRequestPreprocessDynamicallyInSetBlobTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -9,19 +9,20 @@
|
||||
namespace ov {
|
||||
namespace test {
|
||||
namespace conformance {
|
||||
|
||||
extern const char *targetDevice;
|
||||
extern const char* targetDevice;
|
||||
extern const char *targetPluginName;
|
||||
|
||||
extern std::vector<std::string> IRFolderPaths;
|
||||
extern std::vector<std::string> disabledTests;
|
||||
extern std::map<std::string, std::string> pluginConfig;
|
||||
|
||||
inline std::map<std::string, std::string> readPluginConfig(const std::string &configFilePath) {
|
||||
extern ov::AnyMap pluginConfig;
|
||||
|
||||
inline ov::AnyMap readPluginConfig(const std::string &configFilePath) {
|
||||
if (!CommonTestUtils::fileExists(configFilePath)) {
|
||||
std::string msg = "Input directory (" + configFilePath + ") doesn't not exist!";
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
std::map<std::string, std::string> config;
|
||||
ov::AnyMap config;
|
||||
std::ifstream file(configFilePath);
|
||||
if (file.is_open()) {
|
||||
std::string buffer;
|
||||
@ -31,8 +32,7 @@ inline std::map<std::string, std::string> readPluginConfig(const std::string &co
|
||||
if (configElements.size() != 2) {
|
||||
throw std::runtime_error("Incorrect line to get config item: " + buffer + "\n. Example: \"PLUGIN_CONFIG_KEY=PLUGIN_CONFIG_VALUE\"");
|
||||
}
|
||||
std::pair<std::string, std::string> configItem{configElements.front(), configElements.back()};
|
||||
config.insert(configItem);
|
||||
config.emplace(configElements.front(), configElements.back());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -19,7 +19,7 @@ const char *targetPluginName = "";
|
||||
std::vector<std::string> IRFolderPaths = {};
|
||||
std::vector<std::string> disabledTests = {};
|
||||
|
||||
std::map<std::string, std::string> pluginConfig = {};
|
||||
ov::AnyMap pluginConfig = {};
|
||||
|
||||
} // namespace conformance
|
||||
} // namespace test
|
||||
|
@ -19,7 +19,7 @@ INSTANTIATE_TEST_SUITE_P(conformance,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(createFunctions()),
|
||||
::testing::Values(targetDevice),
|
||||
::testing::Values(std::map<std::string, std::string>())),
|
||||
::testing::Values(ov::AnyMap())),
|
||||
OpImplCheckTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
||||
|
@ -20,13 +20,13 @@ const std::vector<ov::element::Type_t> netPrecisions = {
|
||||
ov::element::f16,
|
||||
ov::element::f32,
|
||||
};
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
};
|
||||
const std::vector<std::map<std::string, std::string>> multiConfigs = {
|
||||
const std::vector<ov::AnyMap> multiConfigs = {
|
||||
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_CPU}}};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
|
||||
const std::vector<ov::AnyMap> heteroConfigs = {
|
||||
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU}}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
|
||||
|
@ -8,14 +8,14 @@
|
||||
using namespace ov::test::behavior;
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
};
|
||||
const std::vector<std::map<std::string, std::string>> multiConfigs = {
|
||||
const std::vector<ov::AnyMap> multiConfigs = {
|
||||
{{ InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
|
||||
const std::vector<ov::AnyMap> heteroConfigs = {
|
||||
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU}}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVExecutableNetworkBaseTest,
|
||||
@ -49,16 +49,16 @@ namespace {
|
||||
InferenceEngine::Precision::U16
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configSetPrc = {
|
||||
const std::vector<ov::AnyMap> configSetPrc = {
|
||||
{},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> AutoConfigsSetPrc = {
|
||||
const std::vector<ov::AnyMap> AutoConfigsSetPrc = {
|
||||
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}},
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> MultiConfigsSetPrc = {
|
||||
const std::vector<ov::AnyMap> MultiConfigsSetPrc = {
|
||||
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}},
|
||||
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU},
|
||||
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
|
||||
|
@ -9,13 +9,13 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "0"}, {InferenceEngine::PluginConfigParams::KEY_CPU_THREADS_NUM, "1"}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> multiConfigs = {
|
||||
const std::vector<ov::AnyMap> multiConfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
};
|
||||
|
||||
|
@ -10,15 +10,15 @@ using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> HeteroConfigs = {
|
||||
const std::vector<ov::AnyMap> HeteroConfigs = {
|
||||
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> AutoConfigs = {
|
||||
const std::vector<ov::AnyMap> AutoConfigs = {
|
||||
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
|
@ -9,15 +9,15 @@ using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> HeteroConfigs = {
|
||||
const std::vector<ov::AnyMap> HeteroConfigs = {
|
||||
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> AutoConfigs = {
|
||||
const std::vector<ov::AnyMap> AutoConfigs = {
|
||||
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
|
@ -9,21 +9,21 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "0"}, {InferenceEngine::PluginConfigParams::KEY_CPU_THREADS_NUM, "1"}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
|
||||
const std::vector<ov::AnyMap> Multiconfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> Autoconfigs = {
|
||||
const std::vector<ov::AnyMap> Autoconfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> emptyConfigs = {{}};
|
||||
const std::vector<ov::AnyMap> emptyConfigs = {{}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorTest,
|
||||
::testing::Combine(
|
||||
|
@ -10,13 +10,13 @@ using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "0"}, {InferenceEngine::PluginConfigParams::KEY_CPU_THREADS_NUM, "1"}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
|
||||
const std::vector<ov::AnyMap> Multiconfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
|
@ -27,15 +27,15 @@ TEST_P(OVInferRequestPerfCountersTest, CheckOperationInProfilingInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
|
||||
const std::vector<ov::AnyMap> Multiconfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> Autoconfigs = {
|
||||
const std::vector<ov::AnyMap> Autoconfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
|
@ -10,17 +10,17 @@ using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "0"}, {InferenceEngine::PluginConfigParams::KEY_CPU_THREADS_NUM, "1"}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
|
||||
const std::vector<ov::AnyMap> Multiconfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> Autoconfigs = {
|
||||
const std::vector<ov::AnyMap> Autoconfigs = {
|
||||
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
|
||||
};
|
||||
|
||||
|
@ -83,12 +83,12 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedThrow) {
|
||||
ov::Core ie;
|
||||
std::string value = {};
|
||||
|
||||
ASSERT_NO_THROW(ie.set_config({{KEY_CPU_THREADS_NUM, "1"}}, "CPU"));
|
||||
ASSERT_NO_THROW(value = ie.get_config("CPU", KEY_CPU_THREADS_NUM).as<std::string>());
|
||||
ASSERT_NO_THROW(ie.set_property("CPU", {{KEY_CPU_THREADS_NUM, "1"}}));
|
||||
ASSERT_NO_THROW(value = ie.get_property("CPU", KEY_CPU_THREADS_NUM).as<std::string>());
|
||||
ASSERT_EQ("1", value);
|
||||
|
||||
ASSERT_NO_THROW(ie.set_config({{KEY_CPU_THREADS_NUM, "4"}}, "CPU"));
|
||||
ASSERT_NO_THROW(value = ie.get_config("CPU", KEY_CPU_THREADS_NUM).as<std::string>());
|
||||
ASSERT_NO_THROW(ie.set_property("CPU", {{KEY_CPU_THREADS_NUM, "4"}}));
|
||||
ASSERT_NO_THROW(value = ie.get_property("CPU", KEY_CPU_THREADS_NUM).as<std::string>());
|
||||
ASSERT_EQ("4", value);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesSingleThread = {
|
||||
ngraph::helpers::EltwiseTypes::POWER,
|
||||
};
|
||||
|
||||
std::map<std::string, std::string> additional_config_single_thread = {
|
||||
ov::AnyMap additional_config_single_thread = {
|
||||
{"CPU_THREADS_NUM", "1"}
|
||||
};
|
||||
|
||||
|
@ -39,7 +39,7 @@ const auto params2D_static = testing::Combine(
|
||||
testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputStaticShape2D)),
|
||||
testing::ValuesIn(axis2D),
|
||||
testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
testing::Values(std::map<std::string, std::string>())
|
||||
testing::Values(ov::AnyMap())
|
||||
);
|
||||
|
||||
const auto params2D_dynamic = testing::Combine(
|
||||
@ -49,7 +49,7 @@ const auto params2D_dynamic = testing::Combine(
|
||||
testing::ValuesIn(inputDynamicShape2D),
|
||||
testing::ValuesIn(axis2D),
|
||||
testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
testing::Values(std::map<std::string, std::string>())
|
||||
testing::Values(ov::AnyMap())
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
@ -87,7 +87,7 @@ const auto params4Dstatic = testing::Combine(
|
||||
testing::ValuesIn(ov::test::static_shapes_to_test_representation(inputStaticShape4D)),
|
||||
testing::ValuesIn(axis4D),
|
||||
testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
testing::Values(std::map<std::string, std::string>())
|
||||
testing::Values(ov::AnyMap())
|
||||
);
|
||||
|
||||
const auto params4Ddynamic = testing::Combine(
|
||||
@ -97,7 +97,7 @@ const auto params4Ddynamic = testing::Combine(
|
||||
testing::ValuesIn(inputDynamicShape4D),
|
||||
testing::ValuesIn(axis4D),
|
||||
testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
testing::Values(std::map<std::string, std::string>())
|
||||
testing::Values(ov::AnyMap())
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
|
@ -150,7 +150,7 @@ protected:
|
||||
init_input_shapes({inputShape});
|
||||
|
||||
if (configuration.count(PluginConfigParams::KEY_ENFORCE_BF16) &&
|
||||
PluginConfigParams::YES == configuration[PluginConfigParams::KEY_ENFORCE_BF16]) {
|
||||
PluginConfigParams::YES == configuration[PluginConfigParams::KEY_ENFORCE_BF16].as<std::string>()) {
|
||||
selectedType += "_BF16";
|
||||
rel_threshold = 1e-2f;
|
||||
if (selectedType == "jit_gemm_BF16")
|
||||
|
@ -196,7 +196,7 @@ std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesDiffInp = { // Differen
|
||||
// ngraph::helpers::EltwiseTypes::MOD // Does not execute because of transformations
|
||||
};
|
||||
|
||||
std::map<std::string, std::string> additional_config;
|
||||
ov::AnyMap additional_config;
|
||||
|
||||
std::vector<ElementType> netType = {ElementType::bf16, ElementType::f32};
|
||||
|
||||
|
@ -151,7 +151,7 @@ protected:
|
||||
init_input_shapes({inputShape});
|
||||
|
||||
if (configuration.count(PluginConfigParams::KEY_ENFORCE_BF16) &&
|
||||
PluginConfigParams::YES == configuration[PluginConfigParams::KEY_ENFORCE_BF16]) {
|
||||
PluginConfigParams::YES == configuration[PluginConfigParams::KEY_ENFORCE_BF16].as<std::string>()) {
|
||||
selectedType += "_BF16";
|
||||
rel_threshold = 1e-2f;
|
||||
} else {
|
||||
|
@ -13,7 +13,7 @@ const std::vector<ov::element::Type_t> netPrecisions = {
|
||||
ov::element::u8,
|
||||
ov::element::f32
|
||||
};
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}}
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
};
|
||||
|
||||
|
@ -79,13 +79,13 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
using OVClassExecutableNetworkSetConfigFromFp32Test = OVClassExecutableNetworkGetMetricTestForSpecificConfig;
|
||||
|
||||
TEST_P(OVClassExecutableNetworkSetConfigFromFp32Test, SetConfigFromFp32Throws) {
|
||||
ov::Core ie;
|
||||
ov::Core ie;
|
||||
|
||||
std::map<std::string, std::string> initialConfig;
|
||||
initialConfig[GNA_CONFIG_KEY(DEVICE_MODE)] = InferenceEngine::GNAConfigParams::GNA_SW_FP32;
|
||||
ov::CompiledModel exeNetwork = ie.compile_model(simpleNetwork, deviceName, initialConfig);
|
||||
ov::AnyMap initialConfig;
|
||||
initialConfig[GNA_CONFIG_KEY(DEVICE_MODE)] = InferenceEngine::GNAConfigParams::GNA_SW_FP32;
|
||||
ov::CompiledModel exeNetwork = ie.compile_model(simpleNetwork, deviceName, initialConfig);
|
||||
|
||||
ASSERT_THROW(exeNetwork.set_config({{configKey, configValue}}), ov::Exception);
|
||||
ASSERT_THROW(exeNetwork.set_property({{configKey, configValue}}), ov::Exception);
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
@ -7,11 +7,11 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> multiConfigs = {
|
||||
const std::vector<ov::AnyMap> multiConfigs = {
|
||||
{{MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_GNA}}
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{},
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
using namespace ov::test::behavior;
|
||||
namespace {
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> device_modes {
|
||||
const std::vector<ov::AnyMap> device_modes {
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_FP32"},
|
||||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}}
|
||||
};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"},
|
||||
{"GNA_SCALE_FACTOR_0", "1"},
|
||||
{"GNA_SCALE_FACTOR_1", "1"},
|
||||
|
@ -9,7 +9,7 @@
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
const std::vector<std::map<std::string, std::string>> configs = {
|
||||
const std::vector<ov::AnyMap> configs = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_FP32"},
|
||||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}}
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user