Added version information to OpenVINO Core (#7600)
* Added version information to OpenVINO Core * Fixed code style * Fixed Windows * Fixed code style * Fixed clang
This commit is contained in:
parent
634759210f
commit
84a07889f0
@ -49,14 +49,28 @@ macro(ie_parse_ci_build_number)
|
||||
message(FATAL_ERROR "File ie_version.hpp with IE_VERSION definitions is not found")
|
||||
endif()
|
||||
|
||||
file(STRINGS "${ie_version_hpp}" IE_VERSION_PARTS REGEX "#define IE_VERSION_[A-Z]+[ ]+" )
|
||||
set(ov_version_hpp "${OpenVINO_SOURCE_DIR}/ngraph/core/include/openvino/core/version.hpp")
|
||||
if(NOT EXISTS ${ov_version_hpp})
|
||||
message(FATAL_ERROR "File openvino/core/version.hpp with OPENVINO_VERSION definitions is not found")
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE ".+IE_VERSION_MAJOR[ ]+([0-9]+).*" "\\1"
|
||||
IE_VERSION_MAJOR_HPP "${IE_VERSION_PARTS}")
|
||||
string(REGEX REPLACE ".+IE_VERSION_MINOR[ ]+([0-9]+).*" "\\1"
|
||||
IE_VERSION_MINOR_HPP "${IE_VERSION_PARTS}")
|
||||
string(REGEX REPLACE ".+IE_VERSION_PATCH[ ]+([0-9]+).*" "\\1"
|
||||
IE_VERSION_PATCH_HPP "${IE_VERSION_PARTS}")
|
||||
file(STRINGS "${ie_version_hpp}" IE_VERSION_PARTS REGEX "#define IE_VERSION_[A-Z]+[ ]+" )
|
||||
file(STRINGS "${ov_version_hpp}" OV_VERSION_PARTS REGEX "#define OPENVINO_VERSION_[A-Z]+[ ]+" )
|
||||
|
||||
foreach(suffix MAJOR MINOR PATCH)
|
||||
set(ie_version_name "IE_VERSION_${suffix}")
|
||||
set(ov_version_name "OPENVINO_VERSION_${suffix}")
|
||||
|
||||
string(REGEX REPLACE ".+${ie_version_name}[ ]+([0-9]+).*" "\\1"
|
||||
${ie_version_name}_HPP "${IE_VERSION_PARTS}")
|
||||
string(REGEX REPLACE ".+${ov_version_name}[ ]+([0-9]+).*" "\\1"
|
||||
${ov_version_name}_HPP "${OV_VERSION_PARTS}")
|
||||
|
||||
if(NOT ${ie_version_name}_HPP EQUAL ${ov_version_name}_HPP)
|
||||
message(FATAL_ERROR "${ov_version_name} (${${ov_version_name}_HPP})"
|
||||
" and ${ie_version_name} (${${ie_version_name}_HPP}) are not equal")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(ie_hpp_version_is_found ON)
|
||||
endmacro()
|
||||
@ -95,14 +109,22 @@ endif()
|
||||
# 2. Otherwise, parses ie_version.hpp
|
||||
ie_parse_ci_build_number()
|
||||
|
||||
function (addVersionDefines FILE)
|
||||
macro (addVersionDefines FILE)
|
||||
set(__version_file ${FILE})
|
||||
if(NOT IS_ABSOLUTE ${__version_file})
|
||||
set(__version_file "${CMAKE_CURRENT_SOURCE_DIR}/${__version_file}")
|
||||
endif()
|
||||
if(NOT EXISTS ${__version_file})
|
||||
message(FATAL_ERROR "${FILE} does not exists in current source directory")
|
||||
endif()
|
||||
foreach (VAR ${ARGN})
|
||||
if (DEFINED ${VAR} AND NOT "${${VAR}}" STREQUAL "")
|
||||
set_property(
|
||||
SOURCE ${FILE}
|
||||
SOURCE ${__version_file}
|
||||
APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS
|
||||
${VAR}="${${VAR}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
unset(__version_file)
|
||||
endmacro()
|
||||
|
@ -31,13 +31,12 @@
|
||||
/**
|
||||
* @def OPENVINO_PLUGIN_API(type)
|
||||
* @brief Defines OpenVINO Runtime Plugin API method
|
||||
* @param type A plugin type
|
||||
*/
|
||||
|
||||
#ifdef IMPLEMENT_INFERENCE_ENGINE_PLUGIN
|
||||
# define OPENVINO_PLUGIN_API(type) OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS type
|
||||
# define OPENVINO_PLUGIN_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS
|
||||
#else
|
||||
# define OPENVINO_PLUGIN_API(type) OPENVINO_EXTERN_C type
|
||||
# define OPENVINO_PLUGIN_API OPENVINO_EXTERN_C
|
||||
#endif
|
||||
|
||||
namespace InferenceEngine {}
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "ie_plugin_config.hpp"
|
||||
#include "ie_version.hpp"
|
||||
#include "openvino/core/version.hpp"
|
||||
#include "openvino/runtime/common.hpp"
|
||||
#include "openvino/runtime/executable_network.hpp"
|
||||
#include "openvino/runtime/remote_context.hpp"
|
||||
@ -59,7 +59,7 @@ public:
|
||||
* @param deviceName Device name to identify plugin
|
||||
* @return A vector of versions
|
||||
*/
|
||||
std::map<std::string, ie::Version> get_versions(const std::string& deviceName) const;
|
||||
std::map<std::string, Version> get_versions(const std::string& deviceName) const;
|
||||
|
||||
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
|
||||
/**
|
||||
|
@ -1241,8 +1241,14 @@ Core::Core(const std::string& xmlConfigFile) {
|
||||
OV_CORE_CALL_STATEMENT(register_plugins(parseXmlConfig(xmlConfigFile)));
|
||||
}
|
||||
|
||||
std::map<std::string, ie::Version> Core::get_versions(const std::string& deviceName) const {
|
||||
OV_CORE_CALL_STATEMENT(return _impl->GetVersions(deviceName))
|
||||
std::map<std::string, Version> Core::get_versions(const std::string& deviceName) const {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
std::map<std::string, Version> versions;
|
||||
for (auto&& kvp : _impl->GetVersions(deviceName)) {
|
||||
versions[kvp.first] = Version{kvp.second.buildNumber, kvp.second.description};
|
||||
}
|
||||
return versions;
|
||||
})
|
||||
}
|
||||
|
||||
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
|
||||
@ -1264,29 +1270,33 @@ std::shared_ptr<ngraph::Function> Core::read_model(const std::string& model, con
|
||||
ExecutableNetwork Core::compile_model(const std::shared_ptr<const ngraph::Function>& network,
|
||||
const std::string& deviceName,
|
||||
const ConfigMap& config) {
|
||||
OV_CORE_CALL_STATEMENT(
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec =
|
||||
_impl->LoadNetwork(ie::CNNNetwork(std::const_pointer_cast<ngraph::Function>(network)), deviceName, config);
|
||||
return {exec.operator const InferenceEngine::details::SharedObjectLoader&().get(),
|
||||
exec.operator std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>&()};);
|
||||
exec.operator std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>&()};
|
||||
});
|
||||
}
|
||||
|
||||
ExecutableNetwork Core::compile_model(const std::string& modelPath,
|
||||
const std::string& deviceName,
|
||||
const ConfigMap& config) {
|
||||
OV_CORE_CALL_STATEMENT(auto exec = _impl->LoadNetwork(modelPath, deviceName, config);
|
||||
return {exec.operator const InferenceEngine::details::SharedObjectLoader&().get(),
|
||||
exec.operator std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>&()};);
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->LoadNetwork(modelPath, deviceName, config);
|
||||
return {exec.operator const InferenceEngine::details::SharedObjectLoader&().get(),
|
||||
exec.operator std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>&()};
|
||||
});
|
||||
}
|
||||
|
||||
ExecutableNetwork Core::compile_model(const std::shared_ptr<const ngraph::Function>& network,
|
||||
const RemoteContext& context,
|
||||
const ConfigMap& config) {
|
||||
OV_CORE_CALL_STATEMENT(auto exec =
|
||||
_impl->LoadNetwork(ie::CNNNetwork(std::const_pointer_cast<ngraph::Function>(network)),
|
||||
context._impl,
|
||||
config);
|
||||
return {exec._so, exec._ptr};);
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->LoadNetwork(ie::CNNNetwork(std::const_pointer_cast<ngraph::Function>(network)),
|
||||
context._impl,
|
||||
config);
|
||||
return {exec._so, exec._ptr};
|
||||
});
|
||||
}
|
||||
|
||||
void Core::add_extension(const ie::IExtensionPtr& extension) {
|
||||
@ -1297,9 +1307,11 @@ ExecutableNetwork Core::import_model(std::istream& networkModel,
|
||||
const std::string& deviceName,
|
||||
const ConfigMap& config) {
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "Core::import_model");
|
||||
OV_CORE_CALL_STATEMENT(auto exec = _impl->ImportNetwork(networkModel, deviceName, config);
|
||||
return {exec.operator const InferenceEngine::details::SharedObjectLoader&().get(),
|
||||
exec.operator std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>&()};);
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->ImportNetwork(networkModel, deviceName, config);
|
||||
return {exec.operator const InferenceEngine::details::SharedObjectLoader&().get(),
|
||||
exec.operator std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>&()};
|
||||
});
|
||||
}
|
||||
|
||||
ExecutableNetwork Core::import_model(std::istream& networkModel,
|
||||
@ -1323,16 +1335,20 @@ ExecutableNetwork Core::import_model(std::istream& networkModel,
|
||||
}
|
||||
networkModel.seekg(currentPos, networkModel.beg);
|
||||
|
||||
OV_CORE_CALL_STATEMENT(auto exec = _impl->GetCPPPluginByName(deviceName).import_model(networkModel, {});
|
||||
return {exec._so, exec._ptr};);
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->GetCPPPluginByName(deviceName).import_model(networkModel, {});
|
||||
return {exec._so, exec._ptr};
|
||||
});
|
||||
}
|
||||
|
||||
SupportedOpsMap Core::query_model(const std::shared_ptr<const ngraph::Function>& network,
|
||||
const std::string& deviceName,
|
||||
const ConfigMap& config) const {
|
||||
OV_CORE_CALL_STATEMENT(auto cnnNet = ie::CNNNetwork(std::const_pointer_cast<ngraph::Function>(network));
|
||||
auto qnResult = _impl->QueryNetwork(cnnNet, deviceName, config);
|
||||
return qnResult.supportedLayersMap;);
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto cnnNet = ie::CNNNetwork(std::const_pointer_cast<ngraph::Function>(network));
|
||||
auto qnResult = _impl->QueryNetwork(cnnNet, deviceName, config);
|
||||
return qnResult.supportedLayersMap;
|
||||
});
|
||||
}
|
||||
|
||||
void Core::set_config(const ConfigMap& config, const std::string& deviceName) {
|
||||
@ -1351,11 +1367,14 @@ void Core::set_config(const ConfigMap& config, const std::string& deviceName) {
|
||||
"set_config is supported only for device family itself (without particular device .#). "
|
||||
"You can pass .# as a particular device instance to query_model, compile_model, import_model only");
|
||||
|
||||
OV_CORE_CALL_STATEMENT(
|
||||
if (deviceName.empty()) { _impl->SetConfigForPlugins(config, std::string()); } else {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
if (deviceName.empty()) {
|
||||
_impl->SetConfigForPlugins(config, std::string());
|
||||
} else {
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, config);
|
||||
_impl->SetConfigForPlugins(parsed._config, parsed._deviceName);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Parameter Core::get_config(const std::string& deviceName, const std::string& name) const {
|
||||
@ -1369,13 +1388,14 @@ Parameter Core::get_config(const std::string& deviceName, const std::string& nam
|
||||
"You can only get_config of the AUTO itself (without devices). "
|
||||
"get_config is also possible for the individual devices before creating the AUTO on top.");
|
||||
|
||||
OV_CORE_CALL_STATEMENT(
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName);
|
||||
|
||||
// we need to return a copy of Parameter object which is created on Core side,
|
||||
// not in ie plugin side, which can be unloaded from Core in a parallel thread
|
||||
// TODO: remove this WA after *-31417 is resolved
|
||||
return copyParameterValue(_impl->GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config)););
|
||||
return copyParameterValue(_impl->GetCPPPluginByName(parsed._deviceName).get_config(name, parsed._config));
|
||||
});
|
||||
}
|
||||
|
||||
Parameter Core::get_metric(const std::string& deviceName, const std::string& name) const {
|
||||
@ -1391,9 +1411,12 @@ void Core::register_plugin(const std::string& pluginName, const std::string& dev
|
||||
}
|
||||
|
||||
void Core::unload_plugin(const std::string& deviceName) {
|
||||
OV_CORE_CALL_STATEMENT(ie::DeviceIDParser parser(deviceName); std::string devName = parser.getDeviceName();
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
ie::DeviceIDParser parser(deviceName);
|
||||
std::string devName = parser.getDeviceName();
|
||||
|
||||
_impl->UnloadPluginByName(devName););
|
||||
_impl->UnloadPluginByName(devName);
|
||||
});
|
||||
}
|
||||
|
||||
void Core::register_plugins(const std::string& xmlConfigFile) {
|
||||
@ -1405,10 +1428,11 @@ RemoteContext Core::create_context(const std::string& deviceName, const ParamMap
|
||||
OPENVINO_ASSERT(deviceName.find("MULTI") != 0, "MULTI device does not support remote context");
|
||||
OPENVINO_ASSERT(deviceName.find("AUTO") != 0, "AUTO device does not support remote context");
|
||||
|
||||
OV_CORE_CALL_STATEMENT(auto parsed = parseDeviceNameIntoConfig(deviceName, params);
|
||||
auto remoteContext =
|
||||
_impl->GetCPPPluginByName(parsed._deviceName).create_context(parsed._config);
|
||||
return {remoteContext._so, remoteContext._ptr};);
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, params);
|
||||
auto remoteContext = _impl->GetCPPPluginByName(parsed._deviceName).create_context(parsed._config);
|
||||
return {remoteContext._so, remoteContext._ptr};
|
||||
});
|
||||
}
|
||||
|
||||
RemoteContext Core::get_default_context(const std::string& deviceName) {
|
||||
@ -1416,10 +1440,11 @@ RemoteContext Core::get_default_context(const std::string& deviceName) {
|
||||
OPENVINO_ASSERT(deviceName.find("MULTI") != 0, "MULTI device does not support remote context");
|
||||
OPENVINO_ASSERT(deviceName.find("AUTO") != 0, "AUTO device does not support remote context");
|
||||
|
||||
OV_CORE_CALL_STATEMENT(auto parsed = parseDeviceNameIntoConfig(deviceName, ParamMap());
|
||||
auto remoteContext =
|
||||
_impl->GetCPPPluginByName(parsed._deviceName).get_default_context(parsed._config);
|
||||
return {remoteContext._so, remoteContext._ptr};);
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, ParamMap());
|
||||
auto remoteContext = _impl->GetCPPPluginByName(parsed._deviceName).get_default_context(parsed._config);
|
||||
return {remoteContext._so, remoteContext._ptr};
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace runtime
|
||||
|
@ -42,6 +42,6 @@ CNNNetwork IRReader::read(std::istream& model, const Blob::CPtr& weights, const
|
||||
return CNNNetwork(parser.parse(root, weights));
|
||||
}
|
||||
|
||||
OPENVINO_PLUGIN_API(void) InferenceEngine::CreateReader(std::shared_ptr<IReader>& reader) {
|
||||
OPENVINO_PLUGIN_API void InferenceEngine::CreateReader(std::shared_ptr<IReader>& reader) {
|
||||
reader = std::make_shared<IRReader>();
|
||||
}
|
||||
|
@ -58,6 +58,6 @@ protected:
|
||||
* @brief Creates the default instance of the reader
|
||||
* @return Reader interface
|
||||
*/
|
||||
OPENVINO_PLUGIN_API(void) CreateReader(std::shared_ptr<IReader>& reader);
|
||||
OPENVINO_PLUGIN_API void CreateReader(std::shared_ptr<IReader>& reader);
|
||||
|
||||
} // namespace InferenceEngine
|
||||
|
@ -133,17 +133,17 @@ std::string MockPlugin::GetName() const noexcept {
|
||||
|
||||
InferenceEngine::IInferencePlugin *__target = nullptr;
|
||||
|
||||
OPENVINO_PLUGIN_API(void) CreatePluginEngine(std::shared_ptr<InferenceEngine::IInferencePlugin>& plugin) {
|
||||
OPENVINO_PLUGIN_API void CreatePluginEngine(std::shared_ptr<InferenceEngine::IInferencePlugin>& plugin) {
|
||||
IInferencePlugin *p = nullptr;
|
||||
std::swap(__target, p);
|
||||
plugin = std::make_shared<MockPlugin>(p);
|
||||
}
|
||||
|
||||
OPENVINO_PLUGIN_API(InferenceEngine::IInferencePlugin*)
|
||||
OPENVINO_PLUGIN_API InferenceEngine::IInferencePlugin*
|
||||
CreatePluginEngineProxy(InferenceEngine::IInferencePlugin *target) {
|
||||
return new MockPlugin(target);
|
||||
}
|
||||
|
||||
OPENVINO_PLUGIN_API(void) InjectProxyEngine(InferenceEngine::IInferencePlugin *target) {
|
||||
OPENVINO_PLUGIN_API void InjectProxyEngine(InferenceEngine::IInferencePlugin *target) {
|
||||
__target = target;
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ add_subdirectory(reference)
|
||||
source_group("src" FILES ${LIBRARY_SRC})
|
||||
source_group("include" FILES ${PUBLIC_HEADERS})
|
||||
|
||||
configure_file(include/ngraph/version.in.hpp include/ngraph/version.hpp)
|
||||
|
||||
# Create static or shared library depending on BUILD_SHARED_LIBS
|
||||
add_library(ngraph ${LIBRARY_SRC} ${PUBLIC_HEADERS})
|
||||
|
||||
@ -39,6 +37,8 @@ if(COMMAND ie_add_vs_version_file)
|
||||
FILEDESCRIPTION "nGraph library")
|
||||
endif()
|
||||
|
||||
addVersionDefines(src/version.cpp CI_BUILD_NUMBER)
|
||||
|
||||
target_link_libraries(ngraph PRIVATE ngraph::builder ngraph::reference openvino::util)
|
||||
|
||||
ie_mark_target_as_cc(ngraph)
|
||||
@ -71,8 +71,7 @@ set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/pass/convert_precis
|
||||
|
||||
# Defines macro in C++ to load backend plugin
|
||||
target_include_directories(ngraph PUBLIC $<BUILD_INTERFACE:${NGRAPH_INCLUDE_PATH}>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
# Add an alias so that library can be used inside the build tree, e.g. when testing
|
||||
add_library(ngraph::ngraph ALIAS ngraph)
|
||||
@ -103,12 +102,7 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
||||
COMPONENT ngraph_dev
|
||||
FILES_MATCHING
|
||||
PATTERN "*.hpp"
|
||||
PATTERN "*.h"
|
||||
PATTERN "*version.in.hpp" EXCLUDE)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/ngraph/version.hpp
|
||||
DESTINATION "runtime/include/ngraph"
|
||||
COMPONENT ngraph_dev)
|
||||
PATTERN "*.h")
|
||||
|
||||
configure_package_config_file(${OpenVINO_SOURCE_DIR}/cmake/templates/ngraphConfig.cmake.in
|
||||
${ngraph_BINARY_DIR}/ngraphConfig.cmake
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "ngraph/deprecated.hpp"
|
||||
#include "ngraph/version.hpp"
|
||||
|
||||
#ifdef IN_NGRAPH_LIBRARY
|
||||
# error("ngraph.hpp is for external use only")
|
||||
|
@ -5,8 +5,10 @@
|
||||
#include "ngraph/visibility.hpp"
|
||||
#include "openvino/core/core_visibility.hpp"
|
||||
|
||||
#define NGRAPH_API OPENVINO_API
|
||||
#define NGRAPH_API OPENVINO_API
|
||||
#define NGRAPH_API_C OPENVINO_API_C
|
||||
#define NGRAPH_EXTERN_C OPENVINO_EXTERN_C
|
||||
|
||||
#ifdef ENABLE_UNICODE_PATH_SUPPORT
|
||||
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
|
||||
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
|
||||
# define ENABLE_UNICODE_PATH_SUPPORT
|
||||
#endif
|
||||
|
7
ngraph/core/include/ngraph/version.hpp
Normal file
7
ngraph/core/include/ngraph/version.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/ngraph_visibility.hpp"
|
||||
|
||||
NGRAPH_EXTERN_C NGRAPH_API const char* NGRAPH_VERSION_NUMBER;
|
@ -1,5 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
const char* NGRAPH_VERSION_NUMBER = "${CI_BUILD_NUMBER}";
|
@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "openvino/core/visibility.hpp"
|
||||
|
||||
#define OV_NEW_API 1
|
||||
@ -16,11 +18,13 @@
|
||||
|
||||
#ifdef NGRAPH_STATIC_LIBRARY // defined if we are building or calling NGRAPH as a static library
|
||||
# define OPENVINO_API
|
||||
# define OPENVINO_API
|
||||
# define OPENVINO_API_C(...) __VA_ARGS__
|
||||
#else
|
||||
# ifdef ngraph_EXPORTS // defined if we are building the NGRAPH DLL (instead of using it)
|
||||
# define OPENVINO_API OPENVINO_CORE_EXPORTS
|
||||
# define OPENVINO_API OPENVINO_CORE_EXPORTS
|
||||
# define OPENVINO_API_C(...) OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS __VA_ARGS__ OPENVINO_CDECL
|
||||
# else
|
||||
# define OPENVINO_API OPENVINO_CORE_IMPORTS
|
||||
# define OPENVINO_API OPENVINO_CORE_IMPORTS
|
||||
# define OPENVINO_API_C(...) OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS __VA_ARGS__ OPENVINO_CDECL
|
||||
# endif // ngraph_EXPORTS
|
||||
#endif // NGRAPH_STATIC_LIBRARY
|
||||
|
48
ngraph/core/include/openvino/core/version.hpp
Normal file
48
ngraph/core/include/openvino/core/version.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/core/core_visibility.hpp"
|
||||
|
||||
/**
|
||||
* @def OPENVINO_VERSION_MAJOR
|
||||
* @brief Defines OpenVINO major version
|
||||
*
|
||||
* @def OPENVINO_VERSION_MINOR
|
||||
* @brief Defines OpenVINO minor version
|
||||
*
|
||||
* @def OPENVINO_VERSION_PATCH
|
||||
* @brief Defines OpenVINO patch version
|
||||
*/
|
||||
|
||||
#define OPENVINO_VERSION_MAJOR 2022
|
||||
#define OPENVINO_VERSION_MINOR 1
|
||||
#define OPENVINO_VERSION_PATCH 0
|
||||
|
||||
namespace ov {
|
||||
|
||||
/**
|
||||
* @struct Version
|
||||
* @brief Represents version information that describes plugins and the OpemVINO library
|
||||
*/
|
||||
#pragma pack(push, 1)
|
||||
struct Version {
|
||||
/**
|
||||
* @brief A null terminated string with build number
|
||||
*/
|
||||
const char* buildNumber;
|
||||
|
||||
/**
|
||||
* @brief A null terminated description string
|
||||
*/
|
||||
const char* description;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
/**
|
||||
* @brief Gets the current OpenVINO version
|
||||
* @return The current OpenVINO version
|
||||
*/
|
||||
OPENVINO_API_C(const Version*) get_openvino_version() noexcept;
|
||||
|
||||
} // namespace ov
|
@ -6,17 +6,16 @@
|
||||
|
||||
#include "ngraph/util.hpp"
|
||||
#include "ngraph/version.hpp"
|
||||
|
||||
using namespace std;
|
||||
#include "openvino/core/version.hpp"
|
||||
|
||||
extern "C" NGRAPH_API const char* get_ngraph_version_string() {
|
||||
return NGRAPH_VERSION_NUMBER;
|
||||
return ov::get_openvino_version()->buildNumber;
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
NGRAPH_API void get_version(size_t& major, size_t& minor, size_t& patch, std::string& extra) {
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
string version = NGRAPH_VERSION_NUMBER;
|
||||
std::string version = get_ngraph_version_string();
|
||||
ngraph::parse_version_string(version, major, minor, patch, extra);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
|
18
ngraph/core/src/version.cpp
Normal file
18
ngraph/core/src/version.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/core/version.hpp"
|
||||
|
||||
#include "ngraph/version.hpp"
|
||||
|
||||
const char* NGRAPH_VERSION_NUMBER = CI_BUILD_NUMBER;
|
||||
|
||||
namespace ov {
|
||||
|
||||
const Version* get_openvino_version() noexcept {
|
||||
static const Version version = {NGRAPH_VERSION_NUMBER, "OpenVINO Runtime"};
|
||||
return &version;
|
||||
}
|
||||
|
||||
} // namespace ov
|
@ -18,6 +18,7 @@
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "ngraph/pass/manager.hpp"
|
||||
#include "ngraph/pass/visualize_tree.hpp"
|
||||
#include "openvino/core/version.hpp"
|
||||
#include "util/all_close.hpp"
|
||||
#include "util/ndarray.hpp"
|
||||
|
||||
@ -25,6 +26,16 @@ NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
TEST(openvino_version, version) {
|
||||
auto version = ov::get_openvino_version();
|
||||
ASSERT_EQ(std::string("OpenVINO Runtime"), version->description);
|
||||
ASSERT_FALSE(std::string(version->buildNumber).empty());
|
||||
}
|
||||
|
||||
TEST(ngraph_version_variable, version) {
|
||||
ASSERT_FALSE(std::string(NGRAPH_VERSION_NUMBER).empty());
|
||||
}
|
||||
|
||||
TEST(util, split) {
|
||||
{
|
||||
string s1 = "this,is,a,test";
|
||||
|
Loading…
Reference in New Issue
Block a user