Core

Overview

The definitions & operations about core. More…

// structs

struct ov_available_devices_t;
struct ov_core_t;
struct ov_core_version;
struct ov_core_version_list;
struct ov_version;

// global functions

ov_get_openvino_version(ov_version_t \* version);
ov_version_free(ov_version_t \* version);
ov_core_create(ov_core_t \*\* core);
ov_core_create_with_config(const char \* xml_config_file, ov_core_t \*\* core);
ov_core_free(ov_core_t \* core);

ov_core_read_model(
    const ov_core_t \* core,
    const char \* model_path,
    const char \* bin_path,
    ov_model_t \*\* model
    );

ov_core_read_model_from_memory(
    const ov_core_t \* core,
    const char \* model_str,
    const ov_tensor_t \* weights,
    ov_model_t \*\* model
    );

ov_core_compile_model(
    const ov_core_t \* core,
    const ov_model_t \* model,
    const char \* device_name,
    const size_t property_args_size,
    ov_compiled_model_t \*\* compiled_model,
    ...
    );

ov_core_compile_model_from_file(
    const ov_core_t \* core,
    const char \* model_path,
    const char \* device_name,
    const size_t property_args_size,
    ov_compiled_model_t \*\* compiled_model,
    ...
    );

ov_core_set_property(const ov_core_t \* core, const char \* device_name, ...);

ov_core_get_property(
    const ov_core_t \* core,
    const char \* device_name,
    const char \* property_key,
    char \*\* property_value
    );

ov_core_get_available_devices(
    const ov_core_t \* core,
    ov_available_devices_t \* devices
    );

ov_available_devices_free(ov_available_devices_t \* devices);

ov_core_import_model(
    const ov_core_t \* core,
    const char \* content,
    const size_t content_size,
    const char \* device_name,
    ov_compiled_model_t \*\* compiled_model
    );

ov_core_versions_free(ov_core_version_list_t \* versions);

Detailed Documentation

The definitions & operations about core.

Global Functions

ov_get_openvino_version(ov_version_t \* version)

Get version of OpenVINO.

Parameters:

ov_version_t

a pointer to the version

Returns:

Status code of the operation: OK(0) for success.

ov_version_free(ov_version_t \* version)

Release the memory allocated by ov_version_t.

Parameters:

version

A pointer to the ov_version_t to free memory.

ov_core_create(ov_core_t \*\* core)

Constructs OpenVINO Core instance by default. See RegisterPlugins for more details.

Parameters:

core

A pointer to the newly created ov_core_t.

Returns:

Status code of the operation: OK(0) for success.

ov_core_create_with_config(const char \* xml_config_file, ov_core_t \*\* core)

Constructs OpenVINO Core instance using XML configuration file with devices description. See RegisterPlugins for more details.

Parameters:

xml_config_file

A path to .xml file with devices to load from. If XML configuration file is not specified, then default plugin.xml file will be used.

core

A pointer to the newly created ov_core_t.

Returns:

Status code of the operation: OK(0) for success.

ov_core_free(ov_core_t \* core)

Release the memory allocated by ov_core_t.

Parameters:

core

A pointer to the ov_core_t to free memory.

ov_core_read_model(
    const ov_core_t \* core,
    const char \* model_path,
    const char \* bin_path,
    ov_model_t \*\* model
    )

Reads models from IR/ONNX/PDPD formats.

Parameters:

core

A pointer to the ie_core_t instance.

model_path

Path to a model.

bin_path

Path to a data file. For IR format (*.bin):

  • if path is empty, will try to read a bin file with the same name as xml and

  • if the bin file with the same name is not found, will load IR without weights. For ONNX format (*.onnx):

  • the bin_path parameter is not used. For PDPD format (*.pdmodel)

  • the bin_path parameter is not used.

model

A pointer to the newly created model.

Returns:

Status code of the operation: OK(0) for success.

ov_core_read_model_from_memory(
    const ov_core_t \* core,
    const char \* model_str,
    const ov_tensor_t \* weights,
    ov_model_t \*\* model
    )

Reads models from IR/ONNX/PDPD formats.

Created model object shares the weights with the weights object. Thus, do not create weights on temporary data that can be freed later, since the model constant data will point to an invalid memory.

Parameters:

core

A pointer to the ie_core_t instance.

model_str

String with a model in IR/ONNX/PDPD format.

weights

Shared pointer to a constant tensor with weights.

model

A pointer to the newly created model. Reading ONNX/PDPD models does not support loading weights from the weights tensors.

Returns:

Status code of the operation: OK(0) for success.

ov_core_compile_model(
    const ov_core_t \* core,
    const ov_model_t \* model,
    const char \* device_name,
    const size_t property_args_size,
    ov_compiled_model_t \*\* compiled_model,
    ...
    )

Creates a compiled model from a source model object. Users can create as many compiled models as they need and use them simultaneously (up to the limitation of the hardware resources).

Parameters:

core

A pointer to the ie_core_t instance.

model

Model object acquired from Core::read_model.

device_name

Name of a device to load a model to.

property_args_size

How many properties args will be passed, each property contains 2 args: key and value.

compiled_model

A pointer to the newly created compiled_model.

property

paramater: Optional pack of pairs: <char* property_key, char* property_value> relevant only for this load operation operation. Supported property key please see ov_property.h.

Returns:

Status code of the operation: OK(0) for success.

ov_core_compile_model_from_file(
    const ov_core_t \* core,
    const char \* model_path,
    const char \* device_name,
    const size_t property_args_size,
    ov_compiled_model_t \*\* compiled_model,
    ...
    )

Reads a model and creates a compiled model from the IR/ONNX/PDPD file. This can be more efficient than using the ov_core_read_model_from_XXX + ov_core_compile_model flow, especially for cases when caching is enabled and a cached model is available.

Parameters:

core

A pointer to the ie_core_t instance.

model_path

Path to a model.

device_name

Name of a device to load a model to.

property_args_size

How many properties args will be passed, each property contains 2 args: key and value.

compiled_model

A pointer to the newly created compiled_model.

Optional pack of pairs: <char* property_key, char* property_value> relevant only for this load operation operation. Supported property key please see ov_property.h.

Returns:

Status code of the operation: OK(0) for success.

ov_core_set_property(const ov_core_t \* core, const char \* device_name, ...)

Sets properties for a device, acceptable keys can be found in ov_property_key_xxx.

Parameters:

core

A pointer to the ie_core_t instance.

device_name

Name of a device.

variadic paramaters The format is <char* property_key, char* property_value>. Supported property key please see ov_property.h.

Returns:

Status code of the operation: OK(0) for success.

ov_core_get_property(
    const ov_core_t \* core,
    const char \* device_name,
    const char \* property_key,
    char \*\* property_value
    )

Gets properties related to device behaviour. The method extracts information that can be set via the set_property method.

Parameters:

core

A pointer to the ie_core_t instance.

device_name

Name of a device to get a property value.

property_key

Property key.

property_value

A pointer to property value with string format.

Returns:

Status code of the operation: OK(0) for success.

ov_core_get_available_devices(
    const ov_core_t \* core,
    ov_available_devices_t \* devices
    )

Returns devices available for inference.

Parameters:

core

A pointer to the ie_core_t instance.

devices

A pointer to the ov_available_devices_t instance. Core objects go over all registered plugins and ask about available devices.

Returns:

Status code of the operation: OK(0) for success.

ov_available_devices_free(ov_available_devices_t \* devices)

Releases memory occpuied by ov_available_devices_t.

Parameters:

devices

A pointer to the ov_available_devices_t instance.

Returns:

Status code of the operation: OK(0) for success.

ov_core_import_model(
    const ov_core_t \* core,
    const char \* content,
    const size_t content_size,
    const char \* device_name,
    ov_compiled_model_t \*\* compiled_model
    )

Imports a compiled model from the previously exported one.

Parameters:

core

A pointer to the ov_core_t instance.

content

A pointer to content of the exported model.

content_size

Number of bytes in the exported network.

device_name

Name of a device to import a compiled model for.

compiled_model

A pointer to the newly created compiled_model.

Returns:

Status code of the operation: OK(0) for success.

ov_core_versions_free(ov_core_version_list_t \* versions)

Releases memory occupied by ov_core_version_list_t.

Parameters:

vers

A pointer to the ie_core_versions to free memory.