Skip to content

Commit 8a02f9a

Browse files
Gorokhov DmitriyMirceaDan99
authored andcommitted
Removed deprecated ov::affinity property (openvinotoolkit#28247)
### Details: - Removes `ov::affinity` property (deprecated in OV 2024.0), `ov::hint::enable_cpu_pinning` should be used instead. - Updates benchmark_app `-pin` option to be binded with `ov::hint::enable_cpu_pinning` property. ### Tickets: - *[CVS-129093](https://jira.devtools.intel.com/browse/CVS-129093)* ### Dependencies: - openvinotoolkit/openvino.genai#1467 - openvinotoolkit/open_model_zoo#3991
1 parent e208a93 commit 8a02f9a

File tree

30 files changed

+33
-432
lines changed

30 files changed

+33
-432
lines changed

docs/articles_en/learn-openvino/openvino-samples/benchmark-tool.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ following usage message:
349349
[-api {sync,async}] [-nireq NUMBER_INFER_REQUESTS] [-nstreams NUMBER_STREAMS] [-inference_only [INFERENCE_ONLY]]
350350
[-infer_precision INFER_PRECISION] [-ip {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}]
351351
[-op {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}] [-iop INPUT_OUTPUT_PRECISION] [--mean_values [R,G,B]] [--scale_values [R,G,B]]
352-
[-nthreads NUMBER_THREADS] [-pin {YES,NO,NUMA,HYBRID_AWARE}] [-latency_percentile LATENCY_PERCENTILE]
352+
[-nthreads NUMBER_THREADS] [-pin {YES,NO}] [-latency_percentile LATENCY_PERCENTILE]
353353
[-report_type {no_counters,average_counters,detailed_counters}] [-report_folder REPORT_FOLDER] [-pc [PERF_COUNTS]]
354354
[-pcsort {no_sort,sort,simple_sort}] [-pcseq [PCSEQ]] [-exec_graph_path EXEC_GRAPH_PATH] [-dump_config DUMP_CONFIG] [-load_config LOAD_CONFIG]
355355
@@ -462,10 +462,8 @@ following usage message:
462462
-nthreads NUMBER_THREADS, --number_threads NUMBER_THREADS
463463
Number of threads to use for inference on the CPU (including HETERO and MULTI cases).
464464
465-
-pin {YES,NO,NUMA,HYBRID_AWARE}, --infer_threads_pinning {YES,NO,NUMA,HYBRID_AWARE}
466-
Optional. Enable threads->cores ('YES' which is OpenVINO runtime's default for conventional CPUs), threads->(NUMA)nodes ('NUMA'),
467-
threads->appropriate core types ('HYBRID_AWARE', which is OpenVINO runtime's default for Hybrid CPUs) or completely disable ('NO') CPU threads
468-
pinning for CPU-involved inference.
465+
-pin {YES,NO}, --infer_threads_pinning {YES,NO}
466+
Optional. Enable threads->cores pinning for CPU-involved inference.
469467
470468
471469
Statistics dumping options:
@@ -577,11 +575,7 @@ following usage message:
577575
578576
Device-specific performance options:
579577
-nthreads <integer> Optional. Number of threads to use for inference on the CPU (including HETERO and MULTI cases).
580-
-pin <string> ("YES"|"CORE") / "HYBRID_AWARE" / ("NO"|"NONE") / "NUMA" Optional. Explicit inference threads binding options (leave empty to let the OpenVINO make a choice):
581-
enabling threads->cores pinning("YES", which is already default for any conventional CPU),
582-
letting the runtime to decide on the threads->different core types("HYBRID_AWARE", which is default on the hybrid CPUs)
583-
threads->(NUMA)nodes("NUMA") or
584-
completely disable("NO") CPU inference threads pinning
578+
-pin <string> "YES" / "NO" Optional. Explicit threads->cores pinning for CPU inference tasks (leave empty to let the OpenVINO make a choice).
585579
586580
Statistics dumping options:
587581
-latency_percentile Optional. Defines the percentile to be reported in latency metric. The valid range is [1, 100]. The default value is 50 (median).

docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ All parameters must be set before calling ``ov::Core::compile_model()`` in order
357357
- ``ov::hint::enable_hyper_threading``
358358
- ``ov::hint::enable_cpu_pinning``
359359
- ``ov::num_streams``
360-
- ``ov::affinity``
361360
- ``ov::inference_num_threads``
362361
- ``ov::cache_dir``
363362
- ``ov::intel_cpu::denormals_optimization``
@@ -373,8 +372,6 @@ Read-only properties
373372
- ``ov::device::full_name``
374373
- ``ov::device::capabilities``
375374

376-
.. note::
377-
``ov::affinity`` is replaced by ``ov::hint::enable_cpu_pinning``. As such, it is deprecated in the 2024.0 release and will be removed in the 2025 release.
378375

379376
External Dependencies
380377
###########################################################

samples/cpp/benchmark_app/benchmark_app.hpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,8 @@ static const char infer_num_threads_message[] = "Optional. Number of threads to
179179
"(including HETERO and MULTI cases).";
180180

181181
// @brief message for CPU threads pinning option
182-
static const char infer_threads_pinning_message[] =
183-
"Optional. Explicit inference threads binding options (leave empty to let the OpenVINO make a choice):\n"
184-
"\t\t\t\tenabling threads->cores pinning(\"YES\", which is already default for any conventional CPU), \n"
185-
"\t\t\t\tletting the runtime to decide on the threads->different core types(\"HYBRID_AWARE\", which is default on "
186-
"the hybrid CPUs) \n"
187-
"\t\t\t\tthreads->(NUMA)nodes(\"NUMA\") or \n"
188-
"\t\t\t\tcompletely disable(\"NO\") CPU inference threads pinning";
182+
static const char infer_threads_pinning_message[] = "Optional. Explicit threads->cores pinning for CPU inference tasks "
183+
"(leave empty to let the OpenVINO make a choice).";
189184

190185
// @brief message for switching memory allocation type option
191186
static const char use_device_mem_message[] =
@@ -426,8 +421,7 @@ static void show_usage() {
426421
std::cout << std::endl;
427422
std::cout << "Device-specific performance options:" << std::endl;
428423
std::cout << " -nthreads <integer> " << infer_num_threads_message << std::endl;
429-
std::cout << " -pin <string> (\"YES\"|\"CORE\") / \"HYBRID_AWARE\" / (\"NO\"|\"NONE\") / \"NUMA\" "
430-
<< infer_threads_pinning_message << std::endl;
424+
std::cout << " -pin <string> \"YES\" / \"NO\" " << infer_threads_pinning_message << std::endl;
431425
std::cout << " -use_device_mem " << use_device_mem_message << std::endl;
432426
std::cout << std::endl;
433427
std::cout << "Statistics dumping options:" << std::endl;

samples/cpp/benchmark_app/main.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -490,21 +490,11 @@ int main(int argc, char* argv[]) {
490490
}
491491
};
492492

493-
auto fix_pin_option = [](const std::string& str) -> std::string {
494-
if (str == "NO")
495-
return "NONE";
496-
else if (str == "YES")
497-
return "CORE";
498-
else
499-
return str;
500-
};
501-
502493
auto set_nthreads_pin = [&](const std::string& str) {
503-
OPENVINO_SUPPRESS_DEPRECATED_START
504-
auto property_name = str == "nthreads" ? ov::inference_num_threads.name() : ov::affinity.name();
494+
auto property_name =
495+
str == "nthreads" ? ov::inference_num_threads.name() : ov::hint::enable_cpu_pinning.name();
505496
auto property = str == "nthreads" ? ov::inference_num_threads(int(FLAGS_nthreads))
506-
: ov::affinity(fix_pin_option(FLAGS_pin));
507-
OPENVINO_SUPPRESS_DEPRECATED_END
497+
: ov::hint::enable_cpu_pinning(FLAGS_pin);
508498
if (supported(property_name) || device_name == "AUTO") {
509499
// create nthreads/pin primary property for HW device or AUTO if -d is AUTO directly.
510500
device_config[property.first] = property.second;

src/bindings/c/include/openvino/c/ov_property.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,6 @@ ov_property_key_cache_encryption_callbacks;
123123
OPENVINO_C_VAR(const char*)
124124
ov_property_key_num_streams;
125125

126-
/**
127-
* @brief Read-write property to set/get the name for setting CPU affinity per thread option.
128-
* @ingroup ov_property_c_api
129-
*/
130-
OPENVINO_C_VAR(const char*)
131-
ov_property_key_affinity;
132-
133126
/**
134127
* @brief Read-write property<int32_t string> to set/get the maximum number of threads that can be used
135128
* for inference tasks.

src/bindings/c/src/ov_property.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const char* ov_property_key_max_batch_size = "MAX_BATCH_SIZE";
2121
const char* ov_property_key_cache_dir = "CACHE_DIR";
2222
const char* ov_property_key_cache_mode = "CACHE_MODE";
2323
const char* ov_property_key_num_streams = "NUM_STREAMS";
24-
const char* ov_property_key_affinity = "AFFINITY";
2524
const char* ov_property_key_inference_num_threads = "INFERENCE_NUM_THREADS";
2625
const char* ov_property_key_hint_performance_mode = "PERFORMANCE_HINT";
2726
const char* ov_property_key_hint_enable_cpu_pinning = "ENABLE_CPU_PINNING";

src/bindings/js/node/src/helper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,6 @@ Napi::Value any_to_js(const Napi::CallbackInfo& info, ov::Any value) {
414414
else if (value.is<int>()) {
415415
return Napi::Number::New(info.Env(), value.as<int>());
416416
}
417-
// Check for ov::Affinity
418-
else if (value.is<ov::Affinity>()) {
419-
return Napi::String::New(info.Env(), value.as<std::string>());
420-
}
421417
// Check for ov::element::Type
422418
else if (value.is<ov::element::Type>()) {
423419
return Napi::String::New(info.Env(), value.as<std::string>());

src/bindings/python/src/openvino/properties/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
# Enums
6-
from openvino._pyopenvino.properties import Affinity
76
from openvino._pyopenvino.properties import CacheMode
87
from openvino._pyopenvino.properties import WorkloadType
98

src/bindings/python/src/openvino/runtime/properties/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
# Enums
6-
from openvino._pyopenvino.properties import Affinity
76
from openvino._pyopenvino.properties import CacheMode
87
from openvino._pyopenvino.properties import WorkloadType
98

@@ -15,7 +14,6 @@
1514
from openvino._pyopenvino.properties import num_streams
1615
from openvino._pyopenvino.properties import inference_num_threads
1716
from openvino._pyopenvino.properties import compilation_num_threads
18-
from openvino._pyopenvino.properties import affinity
1917
from openvino._pyopenvino.properties import force_tbb_terminate
2018
from openvino._pyopenvino.properties import enable_mmap
2119
from openvino._pyopenvino.properties import supported_properties

src/bindings/python/src/pyopenvino/core/properties/properties.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ void regmodule_properties(py::module m) {
1414
// Top submodule
1515
py::module m_properties = m.def_submodule("properties", "openvino.properties submodule");
1616

17-
// Submodule properties - enums
18-
py::enum_<ov::Affinity>(m_properties, "Affinity", py::arithmetic())
19-
.value("NONE", ov::Affinity::NONE)
20-
.value("CORE", ov::Affinity::CORE)
21-
.value("NUMA", ov::Affinity::NUMA)
22-
.value("HYBRID_AWARE", ov::Affinity::HYBRID_AWARE);
23-
2417
py::enum_<ov::WorkloadType>(m_properties, "WorkloadType", py::arithmetic())
2518
.value("DEFAULT", ov::WorkloadType::DEFAULT)
2619
.value("EFFICIENT", ov::WorkloadType::EFFICIENT);
@@ -38,9 +31,6 @@ void regmodule_properties(py::module m) {
3831
wrap_property_RW(m_properties, ov::num_streams, "num_streams");
3932
wrap_property_RW(m_properties, ov::inference_num_threads, "inference_num_threads");
4033
wrap_property_RW(m_properties, ov::compilation_num_threads, "compilation_num_threads");
41-
OPENVINO_SUPPRESS_DEPRECATED_START
42-
wrap_property_RW(m_properties, ov::affinity, "affinity");
43-
OPENVINO_SUPPRESS_DEPRECATED_END
4434
wrap_property_RW(m_properties, ov::force_tbb_terminate, "force_tbb_terminate");
4535
wrap_property_RW(m_properties, ov::enable_mmap, "enable_mmap");
4636
wrap_property_RW(m_properties, ov::weights_path, "weights_path");

0 commit comments

Comments
 (0)