From 337226256601f73be9d79089b39e6d3dd93940e5 Mon Sep 17 00:00:00 2001 From: dmitrygo Date: Fri, 3 Jan 2025 13:52:23 +0400 Subject: [PATCH 1/2] Remove usage of deprecated ov::affinity property --- demos/common/cpp/utils/src/config_factory.cpp | 2 +- demos/multi_channel_common/cpp/graph.hpp | 2 +- demos/security_barrier_camera_demo/cpp/main.cpp | 2 +- demos/social_distance_demo/cpp/main.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demos/common/cpp/utils/src/config_factory.cpp b/demos/common/cpp/utils/src/config_factory.cpp index 14e88e65c0e..950863a6106 100644 --- a/demos/common/cpp/utils/src/config_factory.cpp +++ b/demos/common/cpp/utils/src/config_factory.cpp @@ -48,7 +48,7 @@ ModelConfig ConfigFactory::getUserConfig(const std::string& flags_d, if (flags_nthreads != 0) config.compiledModelConfig.emplace(ov::inference_num_threads.name(), flags_nthreads); - config.compiledModelConfig.emplace(ov::affinity.name(), ov::Affinity::NONE); + config.compiledModelConfig.emplace(ov::hint::enable_cpu_pinning.name(), "NO"); ov::streams::Num nstreams = deviceNstreams.count(device) > 0 ? ov::streams::Num(deviceNstreams[device]) : ov::streams::AUTO; diff --git a/demos/multi_channel_common/cpp/graph.hpp b/demos/multi_channel_common/cpp/graph.hpp index bc42e02ee1d..01dd99c58c3 100644 --- a/demos/multi_channel_common/cpp/graph.hpp +++ b/demos/multi_channel_common/cpp/graph.hpp @@ -29,7 +29,7 @@ static inline size_t roundUp(size_t enumerator, size_t denominator) { static inline std::queue compile(std::shared_ptr&& model, const std::string& modelPath, const std::string& device, size_t performanceHintNumRequests, ov::Core& core) { - core.set_property("CPU", ov::affinity(ov::Affinity::NONE)); + core.set_property("CPU", ov::hint::enable_cpu_pinning(false)); ov::CompiledModel compiled = core.compile_model(model, device, { {ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)}, {ov::hint::num_requests(performanceHintNumRequests)}}); diff --git a/demos/security_barrier_camera_demo/cpp/main.cpp b/demos/security_barrier_camera_demo/cpp/main.cpp index 02f23a2442c..b27da3508a4 100644 --- a/demos/security_barrier_camera_demo/cpp/main.cpp +++ b/demos/security_barrier_camera_demo/cpp/main.cpp @@ -718,7 +718,7 @@ int main(int argc, char* argv[]) { if (FLAGS_nthreads != 0) { core.set_property("CPU", ov::inference_num_threads(FLAGS_nthreads)); } - core.set_property("CPU", ov::affinity(ov::Affinity::NONE)); + core.set_property("CPU", ov::hint::enable_cpu_pinning(false)); core.set_property("CPU", ov::streams::num((device_nstreams.count("CPU") > 0 ? ov::streams::Num(device_nstreams["CPU"]) : ov::streams::AUTO))); device_nstreams["CPU"] = core.get_property("CPU", ov::streams::num); diff --git a/demos/social_distance_demo/cpp/main.cpp b/demos/social_distance_demo/cpp/main.cpp index bc158a15334..308787e87c3 100644 --- a/demos/social_distance_demo/cpp/main.cpp +++ b/demos/social_distance_demo/cpp/main.cpp @@ -695,7 +695,7 @@ int main(int argc, char* argv[]) { if (FLAGS_nthreads != 0) { core.set_property("CPU", ov::inference_num_threads(FLAGS_nthreads)); } - core.set_property("CPU", ov::affinity(ov::Affinity::NONE)); + core.set_property("CPU", ov::hint::enable_cpu_pinning(false)); core.set_property("CPU", ov::streams::num((deviceNStreams.count("CPU") > 0 ? ov::streams::Num(deviceNStreams["CPU"]) : ov::streams::AUTO))); deviceNStreams["CPU"] = core.get_property("CPU", ov::streams::num); } From 1659f371bd1bf7a65f734dd0ccd30b08433c0fc2 Mon Sep 17 00:00:00 2001 From: dmitrygo Date: Fri, 3 Jan 2025 17:26:32 +0400 Subject: [PATCH 2/2] fixed review comments --- demos/common/cpp/utils/src/config_factory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/common/cpp/utils/src/config_factory.cpp b/demos/common/cpp/utils/src/config_factory.cpp index 950863a6106..087e85e20d7 100644 --- a/demos/common/cpp/utils/src/config_factory.cpp +++ b/demos/common/cpp/utils/src/config_factory.cpp @@ -48,7 +48,7 @@ ModelConfig ConfigFactory::getUserConfig(const std::string& flags_d, if (flags_nthreads != 0) config.compiledModelConfig.emplace(ov::inference_num_threads.name(), flags_nthreads); - config.compiledModelConfig.emplace(ov::hint::enable_cpu_pinning.name(), "NO"); + config.compiledModelConfig.emplace(ov::hint::enable_cpu_pinning.name(), false); ov::streams::Num nstreams = deviceNstreams.count(device) > 0 ? ov::streams::Num(deviceNstreams[device]) : ov::streams::AUTO;