Windows static (#8578)

* Enable LTO for oneDNN GPU

* Use importer target for onednn_gpu

* Fixed install of OpenCL, ittapi

* Try to enable samples build

* Fixed ie_wheel build

* Disabled samples

* Fixed incorrect install of pugixml in dynamic build

* Fixed clDNN_unit_tests64 link

* Minimized a number of hardcoded paths

* Switched off ITT

* Disable TBBBind for static Windows

* Fixed link on Windows

* Fixes

* Static build for Window

* Disable unit-tests

* Disabled TF

* Fixed add dependency for PDPD unit tests

* Disabled GNA

* Enabled ngraph test utils

* Fixes

* Fixes

* Disable clDNN for static build on Windows

* Dynamic MCVS runtime for OpenCL

* Disable ITT traces for static libs

* Ability to switch TBBBind_2_5 OFF

* Disabled GPU on Windows build

* Fixed libGNA link

* Disabled some GNA tests

* Fixed multiple definitions issue

* Hide FrontEnd::load in DLL

* Install libGNAStubs

* Trying to fix Windows

* Trying to fix frontends

* Passed compilation on Windows

* Updated install rules for ngraph backends

* Try CPU, TEMPLATE tests

* Enabled unit-tests

* Enabled ngraph tests

* Try to fix unit-test

* Fixed unit-test on Linux

* Fixed compilation with ENABLE_IR_V7_READER=OFF

* Fixed tests on Linux

* Enable cpuFuncTests only in static build

* Try to fix testMockPluginFrontEnd test

* Try to enable TF

* Fixed python tests

* Partial revert

* Removed OV_FRONTEND_PATH
This commit is contained in:
Ilya Lavrenov 2021-11-17 01:22:04 +03:00 committed by GitHub
parent c2d09afab9
commit 51b9dff1bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 191 additions and 159 deletions

View File

@ -233,7 +233,6 @@ jobs:
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml
displayName: 'Tensorflow Frontend UT'
continueOnError: false
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
# . $(SETUPVARS) && python3 $(WORK_DIR)/gtest-parallel/gtest_parallel.py $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --workers=16 --dump_json_test_results=InferenceEngineUnitTests.json --gtest_filter=*smoke* -- --gtest_print_time=1
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_output=xml:TEST-InferenceEngineUnitTests.xml

View File

@ -21,6 +21,14 @@ resources:
jobs:
- job: Win
strategy:
matrix:
Dynamic:
CMAKE_BUILD_SHARED_LIBS: 'ON'
Static:
CMAKE_BUILD_SHARED_LIBS: 'OFF'
maxParallel: 2
# About 150% of total time
timeoutInMinutes: 120
@ -111,7 +119,7 @@ jobs:
- script: |
set PATH=$(WORK_DIR)\ninja-win;%PATH%
call "$(MSVS_VARS_PATH)" && cmake -GNinja -DENABLE_REQUIREMENTS_INSTALL=OFF -DENABLE_FASTER_BUILD=ON -DENABLE_TEMPLATE_PLUGIN=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_TESTS=ON -DENABLE_STRICT_DEPENDENCIES=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.7.6\x64\python.exe" -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)\modules -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR)
call "$(MSVS_VARS_PATH)" && cmake -GNinja -DENABLE_CLDNN=$(CMAKE_BUILD_SHARED_LIBS) -DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_REQUIREMENTS_INSTALL=OFF -DENABLE_FASTER_BUILD=ON -DENABLE_TEMPLATE_PLUGIN=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_TESTS=ON -DENABLE_STRICT_DEPENDENCIES=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.7.6\x64\python.exe" -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)\modules -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR)
workingDirectory: $(BUILD_DIR)
displayName: 'CMake'
@ -144,10 +152,12 @@ jobs:
- script: $(INSTALL_DIR)\samples\cpp\build_samples_msvc.bat
workingDirectory: $(BUILD_SAMPLES_DIR)
displayName: 'Build cpp samples'
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
- script: $(INSTALL_DIR)\samples\c\build_samples_msvc.bat
workingDirectory: $(BUILD_SAMPLES_DIR)
displayName: 'Build c samples'
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
- script: rd /Q /S $(BUILD_DIR)
displayName: 'Clean build dir'
@ -161,10 +171,12 @@ jobs:
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddlepaddle_tests --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU* --gtest_output=xml:TEST-PaddlePaddle.xml
displayName: 'PaddlePaddle Frontend UT'
continueOnError: false
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml
displayName: 'Tensorflow Frontend UT'
continueOnError: false
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
- script: |
set PATH=$(IB_DIR);%PATH%
@ -206,6 +218,7 @@ jobs:
call $(SETUPVARS) && "$(IB_TESTCONSOLE)" $(INSTALL_TEST_DIR)\cpuFuncTests.exe --gtest_filter=*smoke*:-*CompareWithRefs/base_size=16_pre_nms_topn=100_post_nms_topn=100_nms_thresh=0.7_feat_stride=1_min_size=1_ratio*:*smoke_GRUSequenceCommonZeroClip/GRUSequenceTest.CompareWithRefs/mode=CONVERT_TO_TI_MAX_SEQ_LEN_CONST_seq_lengths* --gtest_output=xml:TEST-cpuFuncTests-IB.xml /testlevel=24
displayName: 'CPU FuncTests - IB'
continueOnError: false
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'OFF')
- script: |
set DATA_PATH=$(MODELS_PATH)

View File

@ -103,17 +103,22 @@ if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
endif()
if(WIN32 AND X86_64)
#TODO: add target_path to be platform specific as well, to avoid following if
# TODO: add target_path to be platform specific as well, to avoid following if
RESOLVE_DEPENDENCY(TBB
ARCHIVE_WIN "tbb2020_20200415_win.zip"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "f1c9b9e2861efdaa01552bd25312ccbc5feeb45551e5f91ae61e29221c5c1479")
RESOLVE_DEPENDENCY(TBBBIND_2_5
ARCHIVE_WIN "tbbbind_2_5_static_win_v1.zip"
TARGET_PATH "${TEMP}/tbbbind_2_5"
ENVIRONMENT "TBBBIND_2_5_ROOT"
SHA256 "a67afeea8cf194f97968c800dab5b5459972908295242e282045d6b8953573c1")
if(ENABLE_TBBBIND_2_5)
RESOLVE_DEPENDENCY(TBBBIND_2_5
ARCHIVE_WIN "tbbbind_2_5_static_win_v1.zip"
TARGET_PATH "${TEMP}/tbbbind_2_5"
ENVIRONMENT "TBBBIND_2_5_ROOT"
SHA256 "a67afeea8cf194f97968c800dab5b5459972908295242e282045d6b8953573c1")
else()
message(WARNING "prebuilt TBBBIND_2_5 is not available.
Build oneTBB from sources and set TBBROOT environment var before OpenVINO cmake configure")
endif()
elseif(ANDROID) # Should be before LINUX due LINUX is detected as well
RESOLVE_DEPENDENCY(TBB
ARCHIVE_ANDROID "tbb2020_20200404_android.tgz"
@ -126,11 +131,16 @@ if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "95b2f3b0b70c7376a0c7de351a355c2c514b42c4966e77e3e34271a599501008")
RESOLVE_DEPENDENCY(TBBBIND_2_5
ARCHIVE_LIN "tbbbind_2_5_static_lin_v2.tgz"
TARGET_PATH "${TEMP}/tbbbind_2_5"
ENVIRONMENT "TBBBIND_2_5_ROOT"
SHA256 "865e7894c58402233caf0d1b288056e0e6ab2bf7c9d00c9dc60561c484bc90f4")
if(ENABLE_TBBBIND_2_5)
RESOLVE_DEPENDENCY(TBBBIND_2_5
ARCHIVE_LIN "tbbbind_2_5_static_lin_v2.tgz"
TARGET_PATH "${TEMP}/tbbbind_2_5"
ENVIRONMENT "TBBBIND_2_5_ROOT"
SHA256 "865e7894c58402233caf0d1b288056e0e6ab2bf7c9d00c9dc60561c484bc90f4")
else()
message(WARNING "prebuilt TBBBIND_2_5 is not available.
Build oneTBB from sources and set TBBROOT environment var before OpenVINO cmake configure")
endif()
elseif(LINUX AND AARCH64)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_LIN "keembay/tbb2020_38404_kmb_lic.tgz"

View File

@ -243,10 +243,28 @@ macro(ie_register_plugins)
endif()
endmacro()
function(ie_target_link_plugins TARGET_NAME)
if(BUILD_SHARED_LIBS)
return()
endif()
foreach(name IN LISTS PLUGIN_FILES)
string(REPLACE ":" ";" name "${name}")
list(LENGTH name length)
if(NOT ${length} EQUAL 2)
message(FATAL_ERROR "Unexpected error, please, contact developer of this script")
endif()
# link plugin to ${TARGET_NAME} static version
list(GET name 1 plugin_name)
target_link_libraries(${TARGET_NAME} PRIVATE ${plugin_name})
endforeach()
endfunction()
#
# ie_generate_plugins_hpp()
#
macro(ie_generate_plugins_hpp)
function(ie_generate_plugins_hpp)
if(BUILD_SHARED_LIBS)
return()
endif()
@ -278,12 +296,14 @@ macro(ie_generate_plugins_hpp)
if(${device_name}_CONFIG)
list(APPEND device_configs -D "${device_name}_CONFIG=${${device_name}_CONFIG}")
endif()
# link plugin to inference_engine static version
list(GET name 1 plugin_name)
target_link_libraries(inference_engine PRIVATE ${plugin_name})
endforeach()
# add plugins to libraries including ie_plugins.hpp
ie_target_link_plugins(inference_engine)
if(TARGET inference_engine_s)
ie_target_link_plugins(inference_engine_s)
endif()
set(ie_plugins_hpp "${CMAKE_BINARY_DIR}/inference-engine/src/inference_engine/ie_plugins.hpp")
set(plugins_hpp_in "${IEDevScripts_DIR}/plugins/plugins.hpp.in")
@ -303,7 +323,7 @@ macro(ie_generate_plugins_hpp)
"Generate ie_plugins.hpp for static build"
VERBATIM)
# for some reason dependnency on source files does not work
# for some reason dependency on source files does not work
# so, we have to use explicit target and make it dependency for inference_engine
add_custom_target(ie_generate_hpp DEPENDS ${ie_plugins_hpp})
add_dependencies(inference_engine ie_generate_hpp)
@ -324,4 +344,4 @@ macro(ie_generate_plugins_hpp)
# add dependency on header file generation for all inference_engine source files
set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ie_plugins_hpp})
endmacro()
endfunction()

View File

@ -23,7 +23,7 @@ else()
set(ENABLE_ONEDNN_FOR_GPU_DEFAULT ON)
endif()
ie_dependent_option (ENABLE_ONEDNN_FOR_GPU "Enable oneDNN with GPU support" ON "${ENABLE_ONEDNN_FOR_GPU_DEFAULT}" OFF)
ie_dependent_option (ENABLE_ONEDNN_FOR_GPU "Enable oneDNN with GPU support" ON "ENABLE_ONEDNN_FOR_GPU_DEFAULT" OFF)
ie_option (ENABLE_PROFILING_ITT "Build with ITT tracing. Optionally configure pre-built ittnotify library though INTEL_VTUNE_DIR variable." OFF)
@ -73,6 +73,15 @@ if (NOT THREADING STREQUAL "TBB" AND
message(FATAL_ERROR "THREADING should be set to TBB, TBB_AUTO, OMP or SEQ. Default option is ${THREADING_DEFAULT}")
endif()
if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND
(BUILD_SHARED_LIBS OR (LINUX AND X86_64)))
set(ENABLE_TBBBIND_2_5_DEFAULT ON)
else()
set(ENABLE_TBBBIND_2_5_DEFAULT OFF)
endif()
ie_dependent_option (ENABLE_TBBBIND_2_5 "Enable TBBBind_2_5 static usage in OpenVINO runtime" ON "ENABLE_TBBBIND_2_5_DEFAULT" OFF)
if (ENABLE_GNA)
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4)
set (DEFAULT_GNA_LIB GNA1)

View File

@ -136,7 +136,7 @@ if(ENABLE_TESTS)
add_dependencies(test_model_zoo test_pip_prerequsites)
endif()
if (NGRAPH_PDPD_FRONTEND_ENABLE)
if (NGRAPH_PDPD_FRONTEND_ENABLE AND NGRAPH_UNIT_TEST_ENABLE)
add_dependencies(test_model_zoo paddlepaddle_test_models)
endif()

View File

@ -29,6 +29,8 @@ onecoreuap_set_runtime(STATIC_CRT)
onecoreuap_set_runtime(protobuf_MSVC_STATIC_RUNTIME)
# clDNN
onecoreuap_set_runtime(CLDNN__COMPILE_LINK_USE_STATIC_RUNTIME)
# OpenCL
onecoreuap_set_runtime(USE_DYNAMIC_VCXX_RUNTIME)
# google-test
if(use_static_runtime)
set(gtest_force_shared_crt OFF CACHE BOOL "" FORCE)

View File

@ -4,10 +4,13 @@
set (TARGET_NAME "inference_engine")
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
if(ENABLE_TBBBIND_2_5)
# try to find prebuilt version of tbbbind_2_5
find_package(TBBBIND_2_5 QUIET)
if(TBBBIND_2_5_FOUND)
message(STATUS "Static tbbbind_2_5 package is found")
set_target_properties(${TBBBIND_2_5_IMPORTED_TARGETS} PROPERTIES
INTERFACE_COMPILE_DEFINITIONS TBBBIND_2_5_AVAILABLE)
if(NOT BUILD_SHARED_LIBS)
set(install_tbbbind ON)
endif()
@ -140,7 +143,7 @@ target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE $<TARGET_PROPERTY:n
target_include_directories(${TARGET_NAME}_obj PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src"
"${CMAKE_CURRENT_BINARY_DIR}" # for static ie_plugins.hpp
$<TARGET_PROPERTY:inference_engine_ir_v7_reader,SOURCE_DIR> # for ie_ir_version.hpp
$<$<TARGET_EXISTS:inference_engine_ir_v7_reader>:$<TARGET_PROPERTY:inference_engine_ir_v7_reader,SOURCE_DIR>> # for ie_ir_version.hpp
$<TARGET_PROPERTY:${TARGET_NAME}_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME}_transformations,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME}_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
@ -149,7 +152,6 @@ target_link_libraries(${TARGET_NAME}_obj PRIVATE ${TARGET_NAME}_reader_api openv
set_ie_threading_interface_for(${TARGET_NAME}_obj)
if (TBBBIND_2_5_FOUND)
target_compile_definitions(${TARGET_NAME}_obj PRIVATE -DTBBBIND_2_5_AVAILABLE)
target_link_libraries(${TARGET_NAME}_obj PRIVATE ${TBBBIND_2_5_IMPORTED_TARGETS})
endif()
@ -174,7 +176,6 @@ ie_add_vs_version_file(NAME ${TARGET_NAME}
set_ie_threading_interface_for(${TARGET_NAME})
if (TBBBIND_2_5_FOUND)
target_compile_definitions(${TARGET_NAME} PRIVATE -DTBBBIND_2_5_AVAILABLE)
target_link_libraries(${TARGET_NAME} PRIVATE ${TBBBIND_2_5_IMPORTED_TARGETS})
endif()
@ -208,7 +209,6 @@ add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL
set_ie_threading_interface_for(${TARGET_NAME}_s)
if (TBBBIND_2_5_FOUND)
target_compile_definitions(${TARGET_NAME}_s PRIVATE -DTBBBIND_2_5_AVAILABLE)
target_link_libraries(${TARGET_NAME}_s PRIVATE ${TBBBIND_2_5_IMPORTED_TARGETS})
endif()

View File

@ -16,14 +16,12 @@
#include <sys/stat.h>
#include "ie_common.h"
#include "openvino/util/file_util.hpp"
#ifndef _WIN32
# include <dlfcn.h>
# include <limits.h>
# include <unistd.h>
# ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# include <codecvt>
# include <locale>
# endif
#else
# if defined(WINAPI_FAMILY) && !WINAPI_PARTITION_DESKTOP
# error "Only WINAPI_PARTITION_DESKTOP is supported, because of GetModuleHandleEx[A|W]"
@ -34,90 +32,20 @@
# include <Windows.h>
#endif
#ifdef _WIN32
# include <direct.h>
// Copied from linux libc sys/stat.h:
# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
/// @brief Windows-specific 'mkdir' wrapper
# define makedir(dir) _mkdir(dir)
/// @brief Max length of absolute file path
# define MAX_ABS_PATH _MAX_PATH
/// @brief Get absolute file path, returns NULL in case of error
# define get_absolute_path(result, path) _fullpath(result, path.c_str(), MAX_ABS_PATH)
/// @brief Windows-specific 'stat' wrapper
# define stat _stat
#else
# include <unistd.h>
/// @brief mkdir wrapper
# define makedir(dir) mkdir(dir, 0755)
/// @brief Max length of absolute file path
# define MAX_ABS_PATH PATH_MAX
/// @brief Get absolute file path, returns NULL in case of error
# define get_absolute_path(result, path) realpath(path.c_str(), result)
#endif
long long FileUtils::fileSize(const char* charfilepath) {
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring widefilename = ov::util::string_to_wstring(charfilepath);
const wchar_t* fileName = widefilename.c_str();
#elif defined(__ANDROID__) || defined(ANDROID)
std::string fileName = charfilepath;
std::string::size_type pos = fileName.find('!');
if (pos != std::string::npos) {
fileName = fileName.substr(0, pos);
}
#else
const char* fileName = charfilepath;
#endif
std::ifstream in(fileName, std::ios_base::binary | std::ios_base::ate);
return in.tellg();
return ov::util::file_size(charfilepath);
}
std::string FileUtils::absoluteFilePath(const std::string& filePath) {
std::string absolutePath;
absolutePath.resize(MAX_ABS_PATH);
auto absPath = get_absolute_path(&absolutePath[0], filePath);
if (!absPath) {
IE_THROW() << "Can't get absolute file path for [" << filePath << "], err = " << strerror(errno);
}
absolutePath.resize(strlen(absPath));
return absolutePath;
return ov::util::get_absolute_file_path(filePath);
}
bool FileUtils::directoryExists(const std::string& path) {
struct stat sb;
if (stat(path.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) {
return true;
}
return false;
return ov::util::directory_exists(path);
}
void FileUtils::createDirectoryRecursive(const std::string& dirPath) {
if (dirPath.empty() || directoryExists(dirPath)) {
return;
}
std::size_t pos = dirPath.rfind(ov::util::FileTraits<char>::file_separator);
if (pos != std::string::npos) {
createDirectoryRecursive(dirPath.substr(0, pos));
}
int err = makedir(dirPath.c_str());
if (err != 0 && errno != EEXIST) {
// TODO: in case of exception it may be needed to remove all created sub-directories
IE_THROW() << "Couldn't create directory [" << dirPath << "], err=" << strerror(errno) << ")";
}
ov::util::create_directory_recursive(dirPath);
}
namespace InferenceEngine {
@ -148,11 +76,11 @@ static std::string getIELibraryPathA() {
GetModuleFileNameA(hm, (LPSTR)ie_library_path, sizeof(ie_library_path));
return getPathName(std::string(ie_library_path));
#elif defined(__APPLE__) || defined(__linux__)
# if defined(OPENVINO_STATIC_LIBRARY) || defined(USE_STATIC_IE)
# ifdef USE_STATIC_IE
# ifdef __APPLE__
Dl_info info;
dladdr(reinterpret_cast<void*>(getIELibraryPath), &info);
std::string path = getPathName(std::string(info.dli_fname)).c_str();
std::string path = getPathName(std::string(info.dli_fname));
# else
char result[PATH_MAX];
ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
@ -162,8 +90,9 @@ static std::string getIELibraryPathA() {
# else
Dl_info info;
dladdr(reinterpret_cast<void*>(getIELibraryPath), &info);
return getPathName(std::string(info.dli_fname)).c_str();
# endif // OPENVINO_STATIC_LIBRARY || USE_STATIC_IE
std::string path = FileUtils::absoluteFilePath(info.dli_fname);
return getPathName(path);
# endif // USE_STATIC_IE
#else
# error "Unsupported OS"
#endif // _WIN32
@ -192,6 +121,7 @@ std::wstring getIELibraryPathW() {
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::string getIELibraryPath() {
(void)getIELibraryPathA;
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
return ov::util::wstring_to_string(getIELibraryPathW());
#else

View File

@ -20,7 +20,9 @@
#include "ie_common.h"
#include "ie_icnn_network.hpp"
#include "ie_input_info.hpp"
#include "ie_ir_version.hpp"
#ifdef ENABLE_IR_V7_READER
# include "ie_ir_version.hpp"
#endif
#include "ie_itt.hpp"
#include "ie_reader.hpp"
#include "ngraph/function.hpp"

View File

@ -15,6 +15,8 @@ using namespace mkldnn;
using namespace MKLDNNPlugin;
using namespace InferenceEngine;
namespace {
template <typename T>
bool SortScorePairDescend(const std::pair<float, T>& pair1,
const std::pair<float, T>& pair2) {
@ -27,6 +29,8 @@ bool SortScorePairDescend<std::pair<int, int>>(const std::pair<float, std::pair<
return (pair1.first > pair2.first) || (pair1.first == pair2.first && pair1.second.second < pair2.second.second);
}
} // namespace
bool MKLDNNDetectionOutputNode::isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op, std::string& errorMessage) noexcept {
try {
if (isDynamicNgraphNode(op)) {

View File

@ -4,30 +4,30 @@
#include <gtest/gtest.h>
#include "ie_blob.h"
#include <openvino/core/except.hpp>
#include <openvino/runtime/variable_state.hpp>
using namespace ::testing;
using namespace std;
TEST(VariableStateOVTests, throwsOnUninitializedReset) {
using VariableStateOVTests = ::testing::Test;
TEST_F(VariableStateOVTests, throwsOnUninitializedReset) {
ov::runtime::VariableState state;
ASSERT_THROW(state.reset(), ov::Exception);
}
TEST(VariableStateOVTests, throwsOnUninitializedGetname) {
TEST_F(VariableStateOVTests, throwsOnUninitializedGetname) {
ov::runtime::VariableState state;
ASSERT_THROW(state.get_name(), ov::Exception);
}
TEST(VariableStateOVTests, throwsOnUninitializedGetState) {
TEST_F(VariableStateOVTests, throwsOnUninitializedGetState) {
ov::runtime::VariableState state;
ASSERT_THROW(state.get_state(), ov::Exception);
}
TEST(VariableStateOVTests, throwsOnUninitializedSetState) {
TEST_F(VariableStateOVTests, throwsOnUninitializedSetState) {
ov::runtime::VariableState state;
ov::runtime::Tensor tensor;
ASSERT_THROW(state.set_state(tensor), ov::Exception);

View File

@ -3,7 +3,6 @@
//
#include <gtest/gtest.h>
#include <gmock/gmock-spec-builders.h>
#include "ie_allocator.hpp"
#include "details/ie_pre_allocator.hpp"

View File

@ -4,9 +4,15 @@
set(TARGET_NAME gnaUnitTests)
# TODO: fix CVS-71010 and remove BUILD_SHARED_LIBS
if(NOT BUILD_SHARED_LIBS)
set(exclude_path EXCLUDED_SOURCE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/(gna_api_stub|gna_wait_test).cpp")
endif()
addIeTargetTest(
NAME ${TARGET_NAME}
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
${exclude_path}
LINK_LIBRARIES
PRIVATE
ngraphFunctions

View File

@ -18,7 +18,8 @@ file(GLOB
inference_engine_tests/*.cpp
)
if (ENABLE_GNA)
# TODO: fix CVS-71010 and remove BUILD_SHARED_LIBS
if (ENABLE_GNA AND BUILD_SHARED_LIBS)
file(GLOB
GNA_TESTS
engines/gna/*cpp
@ -142,4 +143,11 @@ install(TARGETS ${TARGET_NAME}
COMPONENT tests
EXCLUDE_FROM_ALL)
if(TARGET libGNAStubs)
install(TARGETS libGNAStubs
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)
endif()
add_dependencies(${TARGET_NAME} mock_engine)

View File

@ -28,6 +28,8 @@ if (ENABLE_CLDNN)
endif()
function(ie_add_mkldnn)
set(DNNL_ENABLE_JIT_PROFILING ${BUILD_SHARED_LIBS} CACHE BOOL "" FORCE)
set(DNNL_ENABLE_ITT_TASKS ${BUILD_SHARED_LIBS} CACHE BOOL "" FORCE)
set(DNNL_ENABLE_CONCURRENT_EXEC ON CACHE BOOL "" FORCE)
set(DNNL_ENABLE_PRIMITIVE_CACHE OFF CACHE BOOL "" FORCE) ## TODO: try it later
set(DNNL_ENABLE_MAX_CPU_ISA OFF CACHE BOOL "" FORCE) ## TODO: try it later

View File

@ -27,4 +27,5 @@ add_definitions(-DPROJECT_ROOT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_subdirectory(core)
add_subdirectory(frontend)
add_subdirectory(test)

View File

@ -14,7 +14,7 @@ namespace ov {
/**
* @brief The base interface for OpenVINO operation extensions
*/
class OPENVINO_EXTENSION_API BaseOpExtension : public Extension {
class OPENVINO_API BaseOpExtension : public Extension {
public:
using Ptr = std::shared_ptr<BaseOpExtension>;
/**

View File

@ -22,20 +22,9 @@ source_group("src" FILES ${LIBRARY_SRC})
source_group("include" FILES ${LIBRARY_HEADERS})
source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS})
# Static library
# create library
add_library(${TARGET_NAME}_static STATIC ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
add_library(${TARGET_NAME}::static ALIAS ${TARGET_NAME}_static)
target_link_libraries(${TARGET_NAME}_static PRIVATE ${CMAKE_DL_LIBS} openvino::util PUBLIC ngraph)
target_include_directories(${TARGET_NAME}_static PUBLIC
$<BUILD_INTERFACE:${FRONTEND_INCLUDE_DIR}>)
target_include_directories(${TARGET_NAME}_static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_definitions(${TARGET_NAME}_static PUBLIC USE_STATIC_FRONTEND_MANAGER)
ov_install_static_lib(${TARGET_NAME}_static ngraph)
# Shared library - need to recompile object files to export necessary symbols
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
add_library(ngraph::${TARGET_NAME} ALIAS ${TARGET_NAME})
add_library(openvino::frontend::manager ALIAS ${TARGET_NAME})
@ -57,6 +46,21 @@ if(COMMAND ie_add_vs_version_file)
FILEDESCRIPTION "Manager of OpenVINO nGraph Frontends")
endif()
# create static library if needed
if(BUILD_SHARED_LIBS)
add_library(${TARGET_NAME}_static STATIC ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
add_library(${TARGET_NAME}::static ALIAS ${TARGET_NAME}_static)
target_link_libraries(${TARGET_NAME}_static PRIVATE ${CMAKE_DL_LIBS} openvino::util PUBLIC ngraph)
target_include_directories(${TARGET_NAME}_static PUBLIC
$<BUILD_INTERFACE:${FRONTEND_INCLUDE_DIR}>)
target_include_directories(${TARGET_NAME}_static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_definitions(${TARGET_NAME}_static PUBLIC USE_STATIC_FRONTEND_MANAGER)
ov_install_static_lib(${TARGET_NAME}_static ngraph)
else()
add_library(${TARGET_NAME}::static ALIAS ${TARGET_NAME})
endif()
# Installation rules for shared version only
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::manager)

View File

@ -107,7 +107,7 @@ public:
#endif
/// @brief Registers extension
/// @param extension Extension class which is inherited from ov::BaseExtension class
/// @param extension Extension class which is inherited from ov::BaseOpExtension class
template <class T, typename std::enable_if<std::is_base_of<ov::Extension, T>::value, bool>::type = true>
void add_extension(const T& extension) {
std::shared_ptr<ov::Extension> ext = std::make_shared<T>(extension);

View File

@ -9,7 +9,7 @@
// Increment each time when FrontEnd/InputModel/Place interface is changed
#define OV_FRONTEND_API_VERSION 1
#if defined(USE_STATIC_FRONTEND_MANAGER) // || defined(OPENVINO_STATIC_LIBRARY)
#if defined(USE_STATIC_FRONTEND_MANAGER) || defined(OPENVINO_STATIC_LIBRARY)
# define FRONTEND_API
#else
// Defined if cmake is building the frontend_manager DLL (instead of using it)

View File

@ -48,7 +48,7 @@ set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRU
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w)
# Create library
add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS})
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS})
add_library(openvino::frontend::tensorflow ALIAS ${TARGET_NAME})
add_dependencies(${TARGET_NAME} tensorflow_ngraph_frontend_proto)

View File

@ -12,6 +12,15 @@ set(NGRAPH_ONNX_NAMESPACE ngraph_onnx)
add_subdirectory(runtime)
if(ENABLE_TESTS)
add_definitions("-DTEST_FILES=\"${TEST_MODEL_ZOO}/ngraph/files\"")
add_subdirectory(util)
add_subdirectory(engines_util)
if (NGRAPH_ONNX_FRONTEND_ENABLE)
add_subdirectory(onnx_test_util)
endif()
endif()
if(NOT NGRAPH_UNIT_TEST_ENABLE)
message(STATUS "nGraph unit tests disabled")
return()
@ -460,14 +469,6 @@ if (NGRAPH_UNIT_TEST_BACKENDS_ENABLE)
set(ACTIVE_BACKEND_LIST ${ACTIVE_BACKEND_LIST} INTERPRETER)
endif()
add_definitions("-DTEST_FILES=\"${TEST_MODEL_ZOO}/ngraph/files\"")
add_subdirectory(util)
add_subdirectory(engines_util)
if (NGRAPH_ONNX_FRONTEND_ENABLE)
add_subdirectory(onnx_test_util)
endif()
# backend specific test files must meet the following requirements:
# 1) The must be named <name>.in.cpp
# 2) They must be in the `test/backend` directory

View File

@ -27,6 +27,12 @@ add_dependencies(unit-test mock1_ngraph_frontend)
add_clang_format_target(mock1_ngraph_frontend_clang FOR_TARGETS mock1_ngraph_frontend)
install(TARGETS mock1_ngraph_frontend
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
if(BUILD_SHARED_LIBS OR NOT WIN32)
install(TARGETS mock1_ngraph_frontend
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
else()
install(TARGETS mock1_ngraph_frontend
RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
endif()

View File

@ -63,7 +63,6 @@ else()
endif()
add_dependencies(${TARGET_NAME} tensorflow_test_models)
add_dependencies(${TARGET_NAME} tensorflow_ngraph_frontend)
get_target_property(TENSORFLOW_FRONTEND_SRC_DIR tensorflow_ngraph_frontend SOURCE_DIR)
target_include_directories(${TARGET_NAME} PRIVATE ${TENSORFLOW_FRONTEND_SRC_DIR}/src/pass/)

View File

@ -38,18 +38,19 @@ target_compile_definitions(ngraph_backend
SHARED_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}"
SHARED_LIB_SUFFIX="${IE_BUILD_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
target_link_libraries(ngraph_backend PUBLIC ngraph
ngraph::builder
ngraph::reference)
if (NOT WIN32)
target_link_libraries(ngraph_backend PRIVATE ${CMAKE_DL_LIBS})
endif()
target_include_directories(ngraph_backend PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_link_libraries(ngraph_backend PUBLIC ngraph ngraph::builder ngraph::reference
PRIVATE ${CMAKE_DL_LIBS} openvino::util)
target_include_directories(ngraph_backend PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
install(TARGETS ngraph_backend
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ngraph_backend
RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
endif()
add_subdirectory(interpreter)
add_subdirectory(ie)

View File

@ -21,6 +21,7 @@
#include "dynamic/dynamic_backend.hpp"
#include "ngraph/file_util.hpp"
#include "ngraph/util.hpp"
#include "openvino/util/file_util.hpp"
using namespace std;
using namespace ngraph;
@ -45,7 +46,7 @@ static string find_my_pathname() {
#elif defined(__linux) || defined(__APPLE__)
Dl_info dl_info;
dladdr(reinterpret_cast<void*>(ngraph::to_lower), &dl_info);
return dl_info.dli_fname;
return ov::util::get_absolute_file_path(dl_info.dli_fname);
#else
# error "Unsupported OS"
#endif

View File

@ -31,3 +31,8 @@ target_link_libraries(ie_backend PUBLIC ngraph_backend inference_engine)
install(TARGETS ie_backend
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ie_backend
RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
endif()

View File

@ -26,3 +26,8 @@ target_link_libraries(interpreter_backend PUBLIC ngraph_backend PRIVATE ngraph_r
install(TARGETS interpreter_backend
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
if(NOT BUILD_SHARED_LIBS)
install(TARGETS interpreter_backend
RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
endif()

View File

@ -328,7 +328,7 @@ static std::string get_ov_library_path_a() {
#elif defined(__APPLE__) || defined(__linux__)
Dl_info info;
dladdr(reinterpret_cast<void*>(ov::util::get_ov_lib_path), &info);
std::string result = get_path_name(std::string(info.dli_fname)).c_str();
std::string result = get_path_name(ov::util::get_absolute_file_path(info.dli_fname)).c_str();
if (!ov::util::ends_with(result, "/lib") && !ov::util::ends_with(result, "/lib/"))
result = ov::util::path_join({result, "lib"});
return result;

View File

@ -170,6 +170,8 @@ if(ENABLE_ONEDNN_FOR_GPU)
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
"-DDNNL_ENABLE_CONCURRENT_EXEC=ON"
"-DDNNL_ENABLE_PRIMITIVE_CACHE=ON"
"-DDNNL_ENABLE_JIT_PROFILING=${BUILD_SHARED_LIBS}"
"-DDNNL_ENABLE_ITT_TASKS=${BUILD_SHARED_LIBS}"
"-DDNNL_BUILD_TESTS=OFF"
"-DDNNL_BUILD_EXAMPLES=OFF"
"-DDNNL_BLAS_VENDOR=NONE"

View File

@ -45,6 +45,9 @@ set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS_RELEASE "")
# OpenCL has absolute paths to include directories
set(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION OFF)
if(NOT DEFINED USE_DYNAMIC_VCXX_RUNTIME)
set(USE_DYNAMIC_VCXX_RUNTIME ON)
endif()
add_subdirectory(icd_loader EXCLUDE_FROM_ALL)

View File

@ -23,7 +23,7 @@ endmacro()
set(ONNX_USE_PROTOBUF_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Use dynamic protobuf by ONNX library" FORCE)
set(ONNX_NAMESPACE ${NGRAPH_ONNX_NAMESPACE})
set(ONNX_USE_LITE_PROTO ${NGRAPH_USE_PROTOBUF_LITE} CACHE BOOL "Use protobuf lite for ONNX library" FORCE)
set(ONNX_USE_LITE_PROTO ON CACHE BOOL "Use protobuf lite for ONNX library" FORCE)
set(ONNX_ML ON CACHE BOOL "Use ONNX ML" FORCE)
if(CMAKE_CROSSCOMPILING)
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${SYSTEM_PROTOC})

View File

@ -69,7 +69,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR
INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
endif()
if(protobuf_VERSION VERSION_LESS "3.9" AND NGRAPH_USE_PROTOBUF_LITE)
if(protobuf_VERSION VERSION_LESS "3.9")
message(FATAL_ERROR "Minimum supported version of protobuf-lite library is 3.9.0 (provided ${protobuf_VERSION})")
endif()