From 51b9dff1bc5e65d52745b02fc0b29013b2e89c09 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 17 Nov 2021 01:22:04 +0300 Subject: [PATCH] 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 --- .ci/azure/linux.yml | 1 - .ci/azure/windows.yml | 15 ++- cmake/dependencies.cmake | 32 ++++--- cmake/developer_package/plugins/plugins.cmake | 34 +++++-- cmake/features.cmake | 11 ++- cmake/test_model_zoo.cmake | 2 +- .../mt.runtime.win32.toolchain.cmake | 2 + .../src/inference_engine/CMakeLists.txt | 10 +- .../src/inference_engine/src/file_utils.cpp | 94 +++---------------- .../src/ie_network_reader.cpp | 4 +- .../nodes/mkldnn_detection_output_node.cpp | 4 + .../ov_variable_state_test.cpp | 12 +-- .../inference_engine/pre_allocator_test.cpp | 1 - .../tests/unit/gna/CMakeLists.txt | 6 ++ .../tests_deprecated/unit/CMakeLists.txt | 10 +- inference-engine/thirdparty/CMakeLists.txt | 2 + ngraph/CMakeLists.txt | 1 + .../include/openvino/core/op_extension.hpp | 2 +- .../frontend/frontend_manager/CMakeLists.txt | 30 +++--- .../include/frontend_manager/frontend.hpp | 2 +- .../frontend_manager_defs.hpp | 2 +- ngraph/frontend/tensorflow/CMakeLists.txt | 2 +- ngraph/test/CMakeLists.txt | 17 ++-- ngraph/test/frontend/CMakeLists.txt | 12 ++- .../test/frontend/tensorflow/CMakeLists.txt | 1 - ngraph/test/runtime/CMakeLists.txt | 17 ++-- ngraph/test/runtime/backend.cpp | 3 +- ngraph/test/runtime/ie/CMakeLists.txt | 5 + .../test/runtime/interpreter/CMakeLists.txt | 5 + openvino/util/src/file_util.cpp | 2 +- thirdparty/CMakeLists.txt | 2 + thirdparty/ocl/CMakeLists.txt | 3 + thirdparty/onnx/CMakeLists.txt | 2 +- thirdparty/protobuf/CMakeLists.txt | 2 +- 34 files changed, 191 insertions(+), 159 deletions(-) diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 57c018946e3..0e3da7f417d 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -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 diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index 4abf015d925..72642660043 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -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) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 711495b9045..662b829478c 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -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" diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake index abba70313e0..f386a0db54c 100644 --- a/cmake/developer_package/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -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() diff --git a/cmake/features.cmake b/cmake/features.cmake index bd4f4891fff..a62b6f2f9c4 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -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) diff --git a/cmake/test_model_zoo.cmake b/cmake/test_model_zoo.cmake index 9d974e8a927..c8ec6691ca9 100644 --- a/cmake/test_model_zoo.cmake +++ b/cmake/test_model_zoo.cmake @@ -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() diff --git a/cmake/toolchains/mt.runtime.win32.toolchain.cmake b/cmake/toolchains/mt.runtime.win32.toolchain.cmake index 899fecb679b..716d958fcd1 100644 --- a/cmake/toolchains/mt.runtime.win32.toolchain.cmake +++ b/cmake/toolchains/mt.runtime.win32.toolchain.cmake @@ -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) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 530dced9d33..0430c533661 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -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 $ # for ie_ir_version.hpp + $<$:$> # for ie_ir_version.hpp $ $ $) @@ -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() diff --git a/inference-engine/src/inference_engine/src/file_utils.cpp b/inference-engine/src/inference_engine/src/file_utils.cpp index a646a456d8e..ea962e2b679 100644 --- a/inference-engine/src/inference_engine/src/file_utils.cpp +++ b/inference-engine/src/inference_engine/src/file_utils.cpp @@ -16,14 +16,12 @@ #include #include "ie_common.h" +#include "openvino/util/file_util.hpp" + #ifndef _WIN32 # include # include # include -# ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT -# include -# include -# 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 #endif -#ifdef _WIN32 - -# include - -// 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 - -/// @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::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(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(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 diff --git a/inference-engine/src/inference_engine/src/ie_network_reader.cpp b/inference-engine/src/inference_engine/src/ie_network_reader.cpp index 52156b2f7a3..a0c4c7b1b2d 100644 --- a/inference-engine/src/inference_engine/src/ie_network_reader.cpp +++ b/inference-engine/src/inference_engine/src/ie_network_reader.cpp @@ -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" diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_detection_output_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_detection_output_node.cpp index a2822931efd..24b0269e8cf 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_detection_output_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_detection_output_node.cpp @@ -15,6 +15,8 @@ using namespace mkldnn; using namespace MKLDNNPlugin; using namespace InferenceEngine; +namespace { + template bool SortScorePairDescend(const std::pair& pair1, const std::pair& pair2) { @@ -27,6 +29,8 @@ bool SortScorePairDescend>(const std::pair pair2.first) || (pair1.first == pair2.first && pair1.second.second < pair2.second.second); } +} // namespace + bool MKLDNNDetectionOutputNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { if (isDynamicNgraphNode(op)) { diff --git a/inference-engine/tests/functional/inference_engine/ov_variable_state_test.cpp b/inference-engine/tests/functional/inference_engine/ov_variable_state_test.cpp index 3dfa33ed31c..d2ecec7e082 100644 --- a/inference-engine/tests/functional/inference_engine/ov_variable_state_test.cpp +++ b/inference-engine/tests/functional/inference_engine/ov_variable_state_test.cpp @@ -4,30 +4,30 @@ #include -#include "ie_blob.h" - #include #include 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); diff --git a/inference-engine/tests/functional/inference_engine/pre_allocator_test.cpp b/inference-engine/tests/functional/inference_engine/pre_allocator_test.cpp index 3ac7e5a6ff6..1b99b4e36ea 100644 --- a/inference-engine/tests/functional/inference_engine/pre_allocator_test.cpp +++ b/inference-engine/tests/functional/inference_engine/pre_allocator_test.cpp @@ -3,7 +3,6 @@ // #include -#include #include "ie_allocator.hpp" #include "details/ie_pre_allocator.hpp" diff --git a/inference-engine/tests/unit/gna/CMakeLists.txt b/inference-engine/tests/unit/gna/CMakeLists.txt index 64af7e40ecd..cff4aa3d20e 100644 --- a/inference-engine/tests/unit/gna/CMakeLists.txt +++ b/inference-engine/tests/unit/gna/CMakeLists.txt @@ -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 diff --git a/inference-engine/tests_deprecated/unit/CMakeLists.txt b/inference-engine/tests_deprecated/unit/CMakeLists.txt index fb8fc881aff..415563ed2d8 100644 --- a/inference-engine/tests_deprecated/unit/CMakeLists.txt +++ b/inference-engine/tests_deprecated/unit/CMakeLists.txt @@ -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) diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt index b2ee1c12f43..10d9e495254 100644 --- a/inference-engine/thirdparty/CMakeLists.txt +++ b/inference-engine/thirdparty/CMakeLists.txt @@ -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 diff --git a/ngraph/CMakeLists.txt b/ngraph/CMakeLists.txt index 163c3958427..9681640b96b 100644 --- a/ngraph/CMakeLists.txt +++ b/ngraph/CMakeLists.txt @@ -27,4 +27,5 @@ add_definitions(-DPROJECT_ROOT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") add_subdirectory(core) add_subdirectory(frontend) + add_subdirectory(test) diff --git a/ngraph/core/include/openvino/core/op_extension.hpp b/ngraph/core/include/openvino/core/op_extension.hpp index 735d2dba358..4f9a2cf5cbe 100644 --- a/ngraph/core/include/openvino/core/op_extension.hpp +++ b/ngraph/core/include/openvino/core/op_extension.hpp @@ -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; /** diff --git a/ngraph/frontend/frontend_manager/CMakeLists.txt b/ngraph/frontend/frontend_manager/CMakeLists.txt index ab1093805dc..cadaefceb59 100644 --- a/ngraph/frontend/frontend_manager/CMakeLists.txt +++ b/ngraph/frontend/frontend_manager/CMakeLists.txt @@ -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 - $) -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 + $) + 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) diff --git a/ngraph/frontend/frontend_manager/include/frontend_manager/frontend.hpp b/ngraph/frontend/frontend_manager/include/frontend_manager/frontend.hpp index a446da083fc..583d8eb3591 100644 --- a/ngraph/frontend/frontend_manager/include/frontend_manager/frontend.hpp +++ b/ngraph/frontend/frontend_manager/include/frontend_manager/frontend.hpp @@ -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 ::value, bool>::type = true> void add_extension(const T& extension) { std::shared_ptr ext = std::make_shared(extension); diff --git a/ngraph/frontend/frontend_manager/include/frontend_manager/frontend_manager_defs.hpp b/ngraph/frontend/frontend_manager/include/frontend_manager/frontend_manager_defs.hpp index c7d81bd8b01..708fa83f525 100644 --- a/ngraph/frontend/frontend_manager/include/frontend_manager/frontend_manager_defs.hpp +++ b/ngraph/frontend/frontend_manager/include/frontend_manager/frontend_manager_defs.hpp @@ -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) diff --git a/ngraph/frontend/tensorflow/CMakeLists.txt b/ngraph/frontend/tensorflow/CMakeLists.txt index db2a3686ff3..28aacbfaf41 100644 --- a/ngraph/frontend/tensorflow/CMakeLists.txt +++ b/ngraph/frontend/tensorflow/CMakeLists.txt @@ -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) diff --git a/ngraph/test/CMakeLists.txt b/ngraph/test/CMakeLists.txt index fc12ab0c3b2..4f71751f7cb 100644 --- a/ngraph/test/CMakeLists.txt +++ b/ngraph/test/CMakeLists.txt @@ -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 .in.cpp # 2) They must be in the `test/backend` directory diff --git a/ngraph/test/frontend/CMakeLists.txt b/ngraph/test/frontend/CMakeLists.txt index f6362d551bc..9abc95fba35 100644 --- a/ngraph/test/frontend/CMakeLists.txt +++ b/ngraph/test/frontend/CMakeLists.txt @@ -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() diff --git a/ngraph/test/frontend/tensorflow/CMakeLists.txt b/ngraph/test/frontend/tensorflow/CMakeLists.txt index 8533cafd58c..18cc63b4607 100644 --- a/ngraph/test/frontend/tensorflow/CMakeLists.txt +++ b/ngraph/test/frontend/tensorflow/CMakeLists.txt @@ -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/) diff --git a/ngraph/test/runtime/CMakeLists.txt b/ngraph/test/runtime/CMakeLists.txt index de6a433df1a..3d26cd6b425 100644 --- a/ngraph/test/runtime/CMakeLists.txt +++ b/ngraph/test/runtime/CMakeLists.txt @@ -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 - $) +target_link_libraries(ngraph_backend PUBLIC ngraph ngraph::builder ngraph::reference + PRIVATE ${CMAKE_DL_LIBS} openvino::util) + +target_include_directories(ngraph_backend PUBLIC $) 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) diff --git a/ngraph/test/runtime/backend.cpp b/ngraph/test/runtime/backend.cpp index 8bc4d3cfe92..e74687915c7 100644 --- a/ngraph/test/runtime/backend.cpp +++ b/ngraph/test/runtime/backend.cpp @@ -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(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 diff --git a/ngraph/test/runtime/ie/CMakeLists.txt b/ngraph/test/runtime/ie/CMakeLists.txt index d89b723ee24..fe0e79eab83 100644 --- a/ngraph/test/runtime/ie/CMakeLists.txt +++ b/ngraph/test/runtime/ie/CMakeLists.txt @@ -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() diff --git a/ngraph/test/runtime/interpreter/CMakeLists.txt b/ngraph/test/runtime/interpreter/CMakeLists.txt index 2b99d191106..dc39db0fc28 100644 --- a/ngraph/test/runtime/interpreter/CMakeLists.txt +++ b/ngraph/test/runtime/interpreter/CMakeLists.txt @@ -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() diff --git a/openvino/util/src/file_util.cpp b/openvino/util/src/file_util.cpp index 9b0bf1a553f..7732fcebe31 100644 --- a/openvino/util/src/file_util.cpp +++ b/openvino/util/src/file_util.cpp @@ -328,7 +328,7 @@ static std::string get_ov_library_path_a() { #elif defined(__APPLE__) || defined(__linux__) Dl_info info; dladdr(reinterpret_cast(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; diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index fb7d82db8de..35f327ca8ea 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -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" diff --git a/thirdparty/ocl/CMakeLists.txt b/thirdparty/ocl/CMakeLists.txt index 4f085f6ad96..7a54e9558c7 100644 --- a/thirdparty/ocl/CMakeLists.txt +++ b/thirdparty/ocl/CMakeLists.txt @@ -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) diff --git a/thirdparty/onnx/CMakeLists.txt b/thirdparty/onnx/CMakeLists.txt index 8c9d8b6e8c6..263802dd42f 100644 --- a/thirdparty/onnx/CMakeLists.txt +++ b/thirdparty/onnx/CMakeLists.txt @@ -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}) diff --git a/thirdparty/protobuf/CMakeLists.txt b/thirdparty/protobuf/CMakeLists.txt index 821c6764666..97cb66b5462 100644 --- a/thirdparty/protobuf/CMakeLists.txt +++ b/thirdparty/protobuf/CMakeLists.txt @@ -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()