Skip to content

Commit 97ac78c

Browse files
adopt to OV2.0 properties (#3193)
1 parent 9f0cb05 commit 97ac78c

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

demos/common/cpp/utils/include/utils/common.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,11 @@ void logCompiledModelInfo(
296296
for (const auto& device : devices) {
297297
try {
298298
slog::info << "\tDevice: " << device << slog::endl;
299-
std::string nstreams = compiledModel.get_property(device + "_THROUGHPUT_STREAMS").as<std::string>();
299+
int32_t nstreams = compiledModel.get_property(ov::streams::num);
300300
slog::info << "\t\tNumber of streams: " << nstreams << slog::endl;
301301
if (device == "CPU") {
302-
std::string nthreads = compiledModel.get_property("CPU_THREADS_NUM").as<std::string>();
303-
slog::info << "\t\tNumber of threads: " << (nthreads == "0" ? "AUTO" : nthreads) << slog::endl;
302+
int32_t nthreads = compiledModel.get_property(ov::inference_num_threads);
303+
slog::info << "\t\tNumber of threads: " << (nthreads == 0 ? "AUTO" : std::to_string(nthreads)) << slog::endl;
304304
}
305305
}
306306
catch (const ov::Exception&) {}

demos/social_distance_demo/cpp/main.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#include <string>
1616

1717
#include "openvino/openvino.hpp"
18+
#include "openvino/runtime/intel_gpu/properties.hpp"
19+
#include "openvino/runtime/intel_myriad/hddl_properties.hpp"
1820

19-
#include "gpu/gpu_config.hpp"
20-
#include "vpu/hddl_config.hpp"
2121
#include "monitors/presenter.h"
2222
#include "utils/args_helper.hpp"
2323
#include "utils/grid_mat.hpp"
@@ -694,24 +694,23 @@ int main(int argc, char* argv[]) {
694694
for (const std::string& device : devices) {
695695
if ("CPU" == device) {
696696
if (FLAGS_nthreads != 0) {
697-
core.set_property("CPU", { { CONFIG_KEY(CPU_THREADS_NUM), std::to_string(FLAGS_nthreads) }});
697+
core.set_property("CPU", ov::inference_num_threads(FLAGS_nthreads));
698698
}
699-
core.set_property("CPU", { { CONFIG_KEY(CPU_BIND_THREAD), CONFIG_VALUE(NO) }});
699+
core.set_property("CPU", ov::affinity(ov::Affinity::NONE));
700700
core.set_property("CPU", { { CONFIG_KEY(CPU_THROUGHPUT_STREAMS),
701701
(deviceNStreams.count("CPU") > 0 ? std::to_string(deviceNStreams.at("CPU")) :
702702
CONFIG_VALUE(CPU_THROUGHPUT_AUTO)) }});
703-
deviceNStreams["CPU"] = std::stoi(core.get_property("CPU", CONFIG_KEY(CPU_THROUGHPUT_STREAMS)).as<std::string>());
703+
deviceNStreams["CPU"] = core.get_property("CPU", ov::streams::num);
704704
}
705705

706706
if ("GPU" == device) {
707-
core.set_property("GPU", { { CONFIG_KEY(GPU_THROUGHPUT_STREAMS),
708-
(deviceNStreams.count("GPU") > 0 ? std::to_string(deviceNStreams.at("GPU")) :
709-
CONFIG_VALUE(GPU_THROUGHPUT_AUTO)) }});
710-
deviceNStreams["GPU"] = std::stoi(core.get_property("GPU", CONFIG_KEY(GPU_THROUGHPUT_STREAMS)).as<std::string>());
707+
core.set_property("GPU", ov::streams::num(deviceNStreams.count("GPU") > 0 ? deviceNStreams.at("GPU") : ov::streams::AUTO));
708+
709+
deviceNStreams["GPU"] = core.get_property("GPU", ov::streams::num);
711710
if (devices.end() != devices.find("CPU")) {
712711
// multi-device execution with the CPU + GPU performs best with GPU trottling hint,
713712
// which releases another CPU thread (that is otherwise used by the GPU driver for active polling)
714-
core.set_property("GPU", { { GPU_CONFIG_KEY(PLUGIN_THROTTLE), "1" }});
713+
core.set_property("GPU", ov::intel_gpu::hint::queue_throttle(ov::intel_gpu::hint::ThrottleLevel(1)));
715714
}
716715
}
717716
}
@@ -720,7 +719,7 @@ int main(int argc, char* argv[]) {
720719
auto makeTagConfig = [&](const std::string& deviceName, const std::string& suffix) {
721720
ov::AnyMap config;
722721
if (FLAGS_tag && deviceName == "HDDL") {
723-
config[InferenceEngine::HDDL_GRAPH_TAG] = "tag" + suffix;
722+
config["HDDL"] = ov::intel_myriad::hddl::graph_tag("tag" + suffix);
724723
}
725724
return config;
726725
};

0 commit comments

Comments
 (0)