Group Core#

group ov_core_c_api

The definitions & operations about core.

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 / TF / TFLite formats.

Parameters:
  • core – A pointer to the ov_core_t instance.

  • model_path – Path to a model.

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

    • if bin_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 the following file formats the bin_path parameter is not used:

    • ONNX format (*.onnx)

    • PDPD (*.pdmodel)

    • TF (*.pb)

    • TFLite (*.tflite)

  • model – A pointer to the newly created model.

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 ov_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 ov_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 ov_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 ov_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 ov_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:

versions – A pointer to the ov_core_version_list_t to free memory.

ov_core_create_context(const ov_core_t *core, const char *device_name, const size_t context_args_size, ov_remote_context_t **context, ...)#

Creates a new remote shared context object on the specified accelerator device using specified plugin-specific low-level device API parameters (device handle, pointer, context, etc.).

Parameters:
  • core – A pointer to the ov_core_t instance.

  • device_name – Device name to identify a plugin.

  • context_args_size – How many property args will be for this remote context creation.

  • context – A pointer to the newly created remote context.

  • ... – variadic parmameters Actual context property parameter for remote context

Returns:

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

ov_core_compile_model_with_context(const ov_core_t *core, const ov_model_t *model, const ov_remote_context_t *context, const size_t property_args_size, ov_compiled_model_t **compiled_model, ...)#

Creates a compiled model from a source model within a specified remote context.

Parameters:
  • core – A pointer to the ov_core_t instance.

  • model – Model object acquired from ov_core_read_model.

  • context – A pointer to the newly created remote context.

  • property_args_size – How many args will be for this compiled model.

  • compiled_model – A pointer to the newly created compiled_model.

  • ... – variadic parmameters Actual property parameter for remote context

Returns:

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

ov_core_get_default_context(const ov_core_t *core, const char *device_name, ov_remote_context_t **context)#

Gets a pointer to default (plugin-supplied) shared context object for the specified accelerator device.

Parameters:
  • core – A pointer to the ov_core_t instance.

  • device_name – Name of a device to get a default shared context from.

  • context – A pointer to the referenced remote context.

Returns:

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

struct ov_core_t#
#include <ov_core.h>

type define ov_core_t from ov_core

struct ov_version#
#include <ov_core.h>

Represents OpenVINO version information.

Public Members

const char *buildNumber#

A string representing OpenVINO version.

const char *description#

A string representing OpenVINO description.

struct ov_core_version#
#include <ov_core.h>

Represents version information that describes device and ov runtime library.

struct ov_core_version_list#
#include <ov_core.h>

Represents version information that describes all devices and ov runtime library.

struct ov_available_devices_t#
#include <ov_core.h>

Represent all available devices.

Public Members

char **devices#

devices’ name

size_t size#

devices’ number