Skip to content

Commit

Permalink
Merge branch 'master' into ywang2/limit_VPUX_model_compilation_thread…
Browse files Browse the repository at this point in the history
…s_via_AUTO_plugin
  • Loading branch information
yangwang201911 authored Jul 15, 2023
2 parents 4d645b1 + 5d28498 commit 6893eed
Show file tree
Hide file tree
Showing 188 changed files with 5,472 additions and 1,291 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
branches:
- master

concurrency:
group: ${{ github.head_ref || github.run_id }}-linux
cancel-in-progress: true

jobs:
Build:
defaults:
Expand Down
40 changes: 22 additions & 18 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
name: Tests on Windows (VS 2022, Python 3.11)
on:
workflow_dispatch:
pull_request:
paths-ignore:
- '**/docs/**'
- 'docs/**'
- '**/**.md'
- '**.md'
- '**/layer_tests_summary/**'
- '**/conformance/**'
push:
paths-ignore:
- '**/docs/**'
- 'docs/**'
- '**/**.md'
- '**.md'
- '**/layer_tests_summary/**'
- '**/conformance/**'
branches:
- master
# pull_request:
# paths-ignore:
# - '**/docs/**'
# - 'docs/**'
# - '**/**.md'
# - '**.md'
# - '**/layer_tests_summary/**'
# - '**/conformance/**'
# push:
# paths-ignore:
# - '**/docs/**'
# - 'docs/**'
# - '**/**.md'
# - '**.md'
# - '**/layer_tests_summary/**'
# - '**/conformance/**'
# branches:
# - master

concurrency:
group: ${{ github.head_ref || github.run_id }}-windows
cancel-in-progress: true

env:
CMAKE_BUILD_TYPE: 'Release'
Expand Down
8 changes: 4 additions & 4 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ function(ov_download_tbb)
elseif(LINUX AND X86_64 AND OV_GLIBC_VERSION VERSION_GREATER_EQUAL 2.17)
# build oneTBB 2021.2.1 with gcc 4.8 (glibc 2.17)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_LIN "oneapi-tbb-2021.2.1-lin.tgz"
ARCHIVE_LIN "oneapi-tbb-2021.2.1-lin-canary.tgz"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "0a56f73baaa40d72e06949ea6d593ae63a19f7580ce71c08287c1f59d2e5b988"
SHA256 "3a2c2ec79b3cce7e6a2484754ba6f029fa968db2eefc6659540792b7db8fea0c"
USE_NEW_LOCATION TRUE)
elseif(YOCTO_AARCH64)
RESOLVE_DEPENDENCY(TBB
Expand Down Expand Up @@ -147,10 +147,10 @@ function(ov_download_tbb)
elseif(LINUX AND AARCH64 AND OV_GLIBC_VERSION VERSION_GREATER_EQUAL 2.17)
# build oneTBB 2021.2.1 with gcc 4.8 (glibc 2.17)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_LIN "oneapi-tbb-2021.2.1-lin-arm64.tgz"
ARCHIVE_LIN "oneapi-tbb-2021.2.1-lin-arm64-canary.tgz"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "6b87194a845aa9314f3785d842e250d934e545eccc4636655c7b27c98c302c0c"
SHA256 "042fdac53be65841a970b05d892f4b20b556b06fd3b20d2d0068e49c4fd74f07"
USE_NEW_LOCATION TRUE)
elseif(APPLE AND AARCH64)
# build oneTBB 2021.2.1 with export MACOSX_DEPLOYMENT_TARGET=11.0
Expand Down
5 changes: 2 additions & 3 deletions cmake/developer_package/compile_flags/sdl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
endif()
endif()
if(NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pie")
endif()

set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pie")

if(CMAKE_COMPILER_IS_GNUCXX)
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv")
Expand Down
8 changes: 5 additions & 3 deletions samples/cpp/benchmark_app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,16 +811,18 @@ int main(int argc, char* argv[]) {
}
}

if (isDynamicNetwork && FLAGS_api == "sync") {
bool allow_inference_only_or_sync = can_measure_as_static(app_inputs_info);

if (!allow_inference_only_or_sync && FLAGS_api == "sync") {
throw std::logic_error("Benchmarking of the model with dynamic shapes is available for async API only. "
"Please use -api async -nstreams 1 -nireq 1 to emulate sync behavior");
"Please use -api async -hint latency -nireq 1 to emulate sync behavior");
}

// Defining of benchmark mode
// for static models inference only mode is used as default one
bool inferenceOnly = FLAGS_inference_only;
if (isDynamicNetwork) {
if (isFlagSetInCommandLine("inference_only") && inferenceOnly && app_inputs_info.size() != 1) {
if (isFlagSetInCommandLine("inference_only") && inferenceOnly && !allow_inference_only_or_sync) {
throw std::logic_error(
"Dynamic models with different input data shapes must be benchmarked only in full mode.");
}
Expand Down
4 changes: 4 additions & 0 deletions samples/cpp/benchmark_app/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ std::vector<float> split_float(const std::string& s, char delim) {
return result;
}

bool can_measure_as_static(const std::vector<benchmark_app::InputsInfo>& app_input_info) {
return app_input_info.size() == 1;
}

static const std::vector<std::string> meta_plugins{"MULTI", "HETERO", "AUTO"};
bool is_virtual_device(const std::string& device_name) {
return std::find(meta_plugins.begin(), meta_plugins.end(), device_name) != meta_plugins.end();
Expand Down
1 change: 1 addition & 0 deletions samples/cpp/benchmark_app/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ using InputsInfo = std::map<std::string, InputInfo>;
using PartialShapes = std::map<std::string, ngraph::PartialShape>;
} // namespace benchmark_app

bool can_measure_as_static(const std::vector<benchmark_app::InputsInfo>& app_input_info);
bool is_virtual_device(const std::string& device_name);
bool is_virtual_device_found(const std::vector<std::string>& device_names);
void update_device_properties_setting(const std::string& device_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def tf_type_to_ov_type(tf_type_int):
tf_type = tf.dtypes.as_dtype(tf_type_int)
if tf_type.name == "variant":
return Type.dynamic
if tf_type.name == "string":
return "DT_STRING"
numpy_type = tf_type.as_numpy_dtype
try:
ret_type = Type(numpy_type)
Expand Down Expand Up @@ -51,19 +53,30 @@ def __init__(self, operation: tf.Operation, inner_graph: bool):
"Expected tf.Operation, got {}".format(type(operation))
self.m_operation = operation
self.m_inner_graph = inner_graph
self.m_data_type = None
if self.m_operation.type == "Const":
value = self.m_operation.node_def.attr["value"].tensor
data_type = tf.dtypes.DType(self.m_operation.node_def.attr["dtype"].type).name
self.m_data_type = data_type
# copies tensor value from node_def
self.m_parsed_content = tf.make_ndarray(value)
value = self.m_operation.node_def.attr["value"].tensor
if data_type == "string":
self.m_parsed_content = [str(val) for val in value.string_val]
else:
self.m_parsed_content = tf.make_ndarray(value)

if self.m_operation.type == "Placeholder":
data_type = self.m_operation.node_def.attr["dtype"].type
if tf.dtypes.DType(data_type).name == "resource" and not self.m_inner_graph:
data_type = tf.dtypes.DType(self.m_operation.node_def.attr["dtype"].type).name
self.m_data_type = data_type
if data_type == "resource" and not self.m_inner_graph:
variable_value = TFGraphNodeDecoder.get_variable(self.m_operation)
if variable_value is not None:
# does not copy data
self.m_parsed_content = variable_value.value().__array__()

if isinstance(self.m_parsed_content, bytes):
self.m_data_type = "string"
self.m_parsed_content = [str(self.m_parsed_content)]

def get_op_name(self) -> str:
return self.m_operation.name

Expand Down Expand Up @@ -114,6 +127,8 @@ def get_attribute(self, name):
return OVAny(tf_type_to_ov_type(type_num))

if name == "value":
if self.m_data_type == 'string':
return OVAny(self.m_parsed_content)
if self.m_parsed_content.size == 1:
if isinstance(self.m_parsed_content, np.ndarray):
return OVAny(Tensor(self.m_parsed_content))
Expand Down
33 changes: 17 additions & 16 deletions src/bindings/python/src/openvino/runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from openvino.runtime import opset9
from openvino.runtime import opset10
from openvino.runtime import opset11
from openvino.runtime import opset12

# Import properties API
from openvino.runtime import properties
Expand All @@ -75,19 +76,19 @@


# Extend Node class to support binary operators
Node.__add__ = opset11.add
Node.__sub__ = opset11.subtract
Node.__mul__ = opset11.multiply
Node.__div__ = opset11.divide
Node.__truediv__ = opset11.divide
Node.__radd__ = lambda left, right: opset11.add(right, left)
Node.__rsub__ = lambda left, right: opset11.subtract(right, left)
Node.__rmul__ = lambda left, right: opset11.multiply(right, left)
Node.__rdiv__ = lambda left, right: opset11.divide(right, left)
Node.__rtruediv__ = lambda left, right: opset11.divide(right, left)
Node.__eq__ = opset11.equal
Node.__ne__ = opset11.not_equal
Node.__lt__ = opset11.less
Node.__le__ = opset11.less_equal
Node.__gt__ = opset11.greater
Node.__ge__ = opset11.greater_equal
Node.__add__ = opset12.add
Node.__sub__ = opset12.subtract
Node.__mul__ = opset12.multiply
Node.__div__ = opset12.divide
Node.__truediv__ = opset12.divide
Node.__radd__ = lambda left, right: opset12.add(right, left)
Node.__rsub__ = lambda left, right: opset12.subtract(right, left)
Node.__rmul__ = lambda left, right: opset12.multiply(right, left)
Node.__rdiv__ = lambda left, right: opset12.divide(right, left)
Node.__rtruediv__ = lambda left, right: opset12.divide(right, left)
Node.__eq__ = opset12.equal
Node.__ne__ = opset12.not_equal
Node.__lt__ = opset12.less
Node.__le__ = opset12.less_equal
Node.__gt__ = opset12.greater
Node.__ge__ = opset12.greater_equal
Loading

0 comments on commit 6893eed

Please sign in to comment.