* Extensibility guide with FE extensions and remove OV_FRAMEWORK_MAP from docs * Rework of Extensibility Intro, adopted examples to missing OPENVINO_FRAMEWORK_MAP * Removed OPENVINO_FRAMEWORK_MAP reference * Frontend extension detailed documentation * Fixed distributed snippets * Fixed snippet inclusion in FE extension document and chapter headers * Fixed wrong name in a snippet reference * Fixed test for template extension due to changed number of loaded extensions * Update docs/Extensibility_UG/frontend_extensions.md Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> * Minor fixes in extension snippets * Small grammar fix Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> * DOCS: transition banner (#10973) * transition banner * minor fix * update transition banner * updates * update custom.js * updates * updates * Documentation fixes (#11044) * Benchmark app usage * Fixed link to the devices * More fixes * Update docs/OV_Runtime_UG/multi_device.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Removed several hardcoded links Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Updated documentation for compile_tool (#11049) * Added deployment guide (#11060) * Added deployment guide * Added local distribution * Updates * Fixed more indentations * Removed obsolete code snippets (#11061) * Removed obsolete code snippets * NCC style * Fixed NCC for BA * Add a troubleshooting issue for PRC installation (#11074) * updates * adding gna to linux * add missing reference * update * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * update * minor updates * add gna item to yum and apt * add gna to get started page * update reference formatting * merge commit * add a troubleshooting issue * update * update * fix CVS-71846 Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * DOCS: fixed hardcoded links (#11100) * Fixes * Use links * applying reviewers comments to the Opt Guide (#11093) * applying reviewrs comments * fixed refs, more structuring (bold, bullets, etc) * refactoring tput/latency sections * next iteration (mostly latency), also brushed the auto-batching and other sections * updates sync/async images * common opts brushed * WIP tput redesigned * minor brushing of common and auto-batching * Tput fully refactored * fixed doc name in the link * moved int8 perf counters to the right section * fixed links * fixed broken quotes * fixed more links * add ref to the internals to the TOC * Added a note on the batch size Co-authored-by: Andrey Zaytsev <andrey.zaytsev@intel.com> * [80085] New images for docs (#11114) * change doc structure * fix manager tools * fix manager tools 3 step * fix manager tools 3 step * new img * new img for OV Runtime * fix steps * steps * fix intendents * change list * fix space * fix space * code snippets fix * change display * Benchmarks 2022 1 (#11130) * Minor fixes * Updates for 2022.1 * Edits according to the review * Edits according to review comments * Edits according to review comments * Edits according to review comments * Fixed table * Edits according to review comments * Removed config for Intel® Core™ i7-11850HE * Removed forward-tacotron-duration-prediction-241 graph * Added resnet-18-pytorch * Add info about Docker images in Deployment guide (#11136) * Renamed user guides (#11137) * fix screenshot (#11140) * More conservative recommendations on dynamic shapes usage in docs (#11161) * More conservative recommendations about using dynamic shapes * Duplicated statement from C++ part to Python part of reshape doc (no semantical changes) * Update ShapeInference.md (#11168) * Benchmarks 2022 1 updates (#11180) * Updated graphs * Quick fix for TODO in Dynamic Shapes article * Anchor link fixes * Fixed DM config (#11199) * DOCS: doxy sphinxtabs (#11027) * initial implementation of doxy sphinxtabs * fixes * fixes * fixes * fixes * fixes * WA for ignored visibility attribute * Fixes Co-authored-by: Sergey Lyalin <sergey.lyalin@intel.com> Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> Co-authored-by: Nikolay Tyukaev <nikolay.tyukaev@intel.com> Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> Co-authored-by: Yuan Xu <yuan1.xu@intel.com> Co-authored-by: Maxim Shevtsov <maxim.y.shevtsov@intel.com> Co-authored-by: Andrey Zaytsev <andrey.zaytsev@intel.com> Co-authored-by: Tatiana Savina <tatiana.savina@intel.com> Co-authored-by: Ilya Naumov <ilya.naumov@intel.com> Co-authored-by: Evgenya Stepyreva <evgenya.stepyreva@intel.com>
7.7 KiB
Query device properties, configuration
Query device properties and devices configuration
The OpenVINO™ toolkit supports inferencing with several types of devices (processors or accelerators). This section provides a high-level description of the process of querying of different device properties and configuration values at runtime.
OpenVINO runtime has two types of properties:
- Read only properties which provides information about the devices (such device name, termal, execution capabilities, etc) and information about ov::CompiledModel to understand what configuration values were used to compile the model with.
- Mutable properties which are primarily used to configure ov::Core::compile_model process and affect final inference on the specific set of devices. Such properties can be set globally per device via ov::Core::set_property or locally for particular model in ov::Core::compile_model and ov::Core::query_model calls.
OpenVINO property is represented as a named constexpr variable with a given string name and type (see ). Example:
static constexpr Property<std::vector<std::string>, PropertyMutability::RO> available_devices{"AVAILABLE_DEVICES"};
represents a read-only property with C++ name ov::available_devices, string name AVAILABLE_DEVICES and type std::vector<std::string>.
Refer to the Hello Query Device С++ Sample sources and the Multi-Device execution documentation for examples of using setting and getting properties in user applications.
Get a set of available devices
Based on read-only property ov::available_devices, OpenVINO Core collects information about currently available devices enabled by OpenVINO plugins and returns information using the ov::Core::get_available_devices method:
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp get_available_devices
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py get_available_devices
@endsphinxtab
@endsphinxtabset
The function returns a list of available devices, for example:
MYRIAD.1.2-ma2480
MYRIAD.1.4-ma2480
CPU
GPU.0
GPU.1
If there are more than one instance of a specific device, the devices are enumerated with .suffix where suffix is a unique string identifier. Each device name can then be passed to:
ov::Core::compile_modelto load the model to a specific device with specific configuration properties.ov::Core::get_propertyto get common or device specific properties.- All other methods of the
ov::Coreclass that acceptdeviceName.
Working with properties in Your Code
The ov::Core class provides the following method to query device information, set or get different device configuration properties:
ov::Core::get_property- Gets the current value of a specific property.ov::Core::set_property- Sets a new value for the property globally for specifieddevice_name.
The ov::CompiledModel class is also extended to support the properties:
ov::CompiledModel::get_propertyov::CompiledModel::set_property
For documentation about OpenVINO common device-independent properties, refer to openvino/runtime/properties.hpp. Device specific configuration keys can be found in corresponding device folders (for example, openvino/runtime/intel_gpu/properties.hpp).
Working with properties via Core
Getting device properties
The code below demonstrates how to query HETERO device priority of devices which will be used to infer the model:
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp hetero_priorities
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py hetero_priorities
@endsphinxtab
@endsphinxtabset
Note
: All properties have a type, which is specified during property declaration. Based on this, actual type under
autois automatically deduced by C++ compiler.
To extract device properties such as available devices (ov::available_devices), device name (ov::device::full_name), supported properties (ov::supported_properties), and others, use the ov::Core::get_property method:
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp cpu_device_name
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py cpu_device_name
@endsphinxtab
@endsphinxtabset
A returned value appears as follows: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz.
Note
: In order to understand a list of supported properties on
ov::Coreorov::CompiledModellevels, useov::supported_propertieswhich contains a vector of supported property names. Properties which can be changed, hasov::PropertyName::is_mutablereturning thetruevalue. Most of the properites which are changable on ov::Core level, cannot be changed once the model is compiled, so it becomes immutable read-only property.
Configure a work with a model
ov::Core methods like:
ov::Core::compile_modelov::Core::import_modelov::Core::query_model
accept variadic list of properties as last arguments. Each property in such parameters lists should be used as function call to pass property value with specified property type.
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp compile_model_with_property
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py compile_model_with_property
@endsphinxtab
@endsphinxtabset
The example below specifies hints that a model should be compiled to be inferenced with multiple inference requests in parallel to achive best throughput while inference should be performed without accuracy loss with FP32 precision.
Setting properties globally
ov::Core::set_property with a given device name should be used to set global configuration properties which are the same accross multiple ov::Core::compile_model, ov::Core::query_model, etc. calls, while setting property on the specific ov::Core::compile_model call applies properties only for current call:
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp core_set_property_then_compile
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py core_set_property_then_compile
@endsphinxtab
@endsphinxtabset
Properties on CompiledModel level
Getting property
The ov::CompiledModel::get_property method is used to get property values the compiled model has been created with or a compiled model level property such as ov::optimal_number_of_infer_requests:
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp optimal_number_of_infer_requests
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py optimal_number_of_infer_requests
@endsphinxtab
@endsphinxtabset
Or the current temperature of the MYRIAD device:
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp device_thermal
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py device_thermal
@endsphinxtab
@endsphinxtabset
Or the number of threads that would be used for inference on CPU device:
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp inference_num_threads
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py inference_num_threads
@endsphinxtab
@endsphinxtabset
Setting properties for compiled model
The only mode that supports this method is Multi-Device execution:
@sphinxtabset
@sphinxtab{C++}
@snippet docs/snippets/ov_properties_api.cpp multi_device
@endsphinxtab
@sphinxtab{Python}
@snippet docs/snippets/ov_properties_api.py multi_device
@endsphinxtab
@endsphinxtabset