Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Add enable_cpu_reservation property in python (#31689)

Sun Xiaoxiab3c74fae04a5
diff --git a/src/bindings/c/src/ov_property.cpp b/src/bindings/c/src/ov_property.cpp
index 4d1e3681734..3938f16f173 100644
--- a/src/bindings/c/src/ov_property.cpp
+++ b/src/bindings/c/src/ov_property.cpp
@@ -24,6 +24,7 @@ const char* ov_property_key_num_streams = "NUM_STREAMS";
const char* ov_property_key_inference_num_threads = "INFERENCE_NUM_THREADS";
const char* ov_property_key_hint_performance_mode = "PERFORMANCE_HINT";
const char* ov_property_key_hint_enable_cpu_pinning = "ENABLE_CPU_PINNING";
+const char* ov_property_key_hint_enable_cpu_reservation = "ENABLE_CPU_RESERVATION";
const char* ov_property_key_hint_scheduling_core_type = "SCHEDULING_CORE_TYPE";
const char* ov_property_key_hint_enable_hyper_threading = "ENABLE_HYPER_THREADING";
const char* ov_property_key_hint_inference_precision = "INFERENCE_PRECISION_HINT";
diff --git a/src/bindings/python/src/openvino/runtime/properties/hint/__init__.py b/src/bindings/python/src/openvino/runtime/properties/hint/__init__.py
index 2b637640019..952e41d27f9 100644
--- a/src/bindings/python/src/openvino/runtime/properties/hint/__init__.py
+++ b/src/bindings/python/src/openvino/runtime/properties/hint/__init__.py
@@ -14,6 +14,7 @@ from openvino._pyopenvino.properties.hint import inference_precision
from openvino._pyopenvino.properties.hint import model_priority
from openvino._pyopenvino.properties.hint import performance_mode
from openvino._pyopenvino.properties.hint import enable_cpu_pinning
+from openvino._pyopenvino.properties.hint import enable_cpu_reservation
from openvino._pyopenvino.properties.hint import scheduling_core_type
from openvino._pyopenvino.properties.hint import model_distribution_policy
from openvino._pyopenvino.properties.hint import enable_hyper_threading
diff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
index 4aadb3dec93..168c8d75913 100644
--- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
@@ -90,6 +90,7 @@ void regmodule_properties(py::module m) {
wrap_property_RW(m_hint, ov::hint::model_priority, "model_priority");
wrap_property_RW(m_hint, ov::hint::performance_mode, "performance_mode");
wrap_property_RW(m_hint, ov::hint::enable_cpu_pinning, "enable_cpu_pinning");
+ wrap_property_RW(m_hint, ov::hint::enable_cpu_reservation, "enable_cpu_reservation");
wrap_property_RW(m_hint, ov::hint::scheduling_core_type, "scheduling_core_type");
wrap_property_RW(m_hint, ov::hint::model_distribution_policy, "model_distribution_policy");
wrap_property_RW(m_hint, ov::hint::enable_hyper_threading, "enable_hyper_threading");
diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.py
index e97779e99d8..83456f4b820 100644
--- a/src/bindings/python/tests/test_runtime/test_properties.py
+++ b/src/bindings/python/tests/test_runtime/test_properties.py
@@ -295,6 +295,16 @@ def test_properties_ro(ov_property_ro, expected_value):
(0, False),
),
),
+ (
+ hints.enable_cpu_reservation,
+ "ENABLE_CPU_RESERVATION",
+ (
+ (True, True),
+ (False, False),
+ (1, True),
+ (0, False),
+ ),
+ ),
(
hints.scheduling_core_type,
"SCHEDULING_CORE_TYPE",