Skip to content

Commit

Permalink
Merge branch 'master' into river/cpu_plugin_api_2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
riverlijunjie committed Oct 7, 2023
2 parents e0c0d3a + ad41d0f commit d1cab3b
Show file tree
Hide file tree
Showing 247 changed files with 6,023 additions and 4,665 deletions.
3 changes: 3 additions & 0 deletions .ci/azure/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ jobs:
- script: $(RUN_PREFIX) $(INSTALL_TEST_DIR)/ov_auto_unit_tests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ov_auto_unit_tests.xml
displayName: 'AUTO UT'

- script: $(RUN_PREFIX) $(INSTALL_TEST_DIR)/ov_auto_func_tests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ov_auto_func_tests.xml
displayName: 'AUTO FuncTests'

- script: $(RUN_PREFIX) $(INSTALL_TEST_DIR)/ov_auto_batch_unit_tests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ov_auto_batch_unit_tests.xml
displayName: 'AutoBatch UT'

Expand Down
3 changes: 3 additions & 0 deletions .ci/azure/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ jobs:
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_auto_unit_tests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ov_auto_unit_tests.xml
displayName: 'AUTO UT'

- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_auto_func_tests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ov_auto_func_tests.xml
displayName: 'AUTO FuncTests'

- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_auto_batch_unit_tests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ov_auto_batch_unit_tests.xml
displayName: 'AutoBatch UT'

Expand Down
4 changes: 2 additions & 2 deletions .github/github_org_control/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from pathlib import Path


if sys.version_info[:2] < (3, 7):
raise Exception("Python version must be >= 3.7")
if sys.version_info[:2] < (3, 8):
raise Exception("Python version must be >= 3.8")


class ConfigException(Exception):
Expand Down
47 changes: 29 additions & 18 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ jobs:
- name: Pack Artifacts
run: |
# Add the ONNX Runtime version and skip tests list to the archive to use in the ONNX Runtime Job
# Add the ONNX Runtime version and skip tests list to the archive to use in the ONNX Runtime Job
# w/o the need to checkout repository
cp -R ${ONNX_RUNTIME_UTILS} ${INSTALL_DIR}
pushd ${INSTALL_DIR}
tar -czvf ${BUILD_DIR}/openvino_package.tar.gz *
popd
Expand Down Expand Up @@ -432,10 +432,10 @@ jobs:
- name: Install Dependencies
run: |
sudo -E ${INSTALL_DIR}/install_dependencies/install_openvino_dependencies.sh -c=core -y
# Needed for downloading IRs from storage.openvinotoolkit with Python urllib
sudo apt-get update && sudo apt-get install --assume-yes --no-install-recommends ca-certificates
python3 -m pip install -r ${CONFORMANCE_TOOLS_DIR}/requirements.txt
#
Expand Down Expand Up @@ -560,7 +560,7 @@ jobs:
run: |
source ${INSTALL_DIR}/setupvars.sh
skip_tests=$(tr -s '\n ' ':' < ${ONNX_RUNTIME_UTILS}/skip_tests)
./onnxruntime_test_all --gtest_filter=-$skip_tests
working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo

Expand Down Expand Up @@ -733,6 +733,12 @@ jobs:
${INSTALL_TEST_DIR}/ov_auto_unit_tests --gtest_print_time=1 \
--gtest_output=xml:${INSTALL_TEST_DIR}/TEST-ov_auto_unit_tests.xml
- name: AUTO func Tests
run: |
source ${{ env.INSTALL_DIR }}/setupvars.sh
${{ env.INSTALL_TEST_DIR }}/ov_auto_func_tests --gtest_print_time=1 \
--gtest_output=xml:${{ env.INSTALL_TEST_DIR }}/TEST-ov_auto_func_tests.xml
- name: Template plugin func tests
run: |
source ${INSTALL_DIR}/setupvars.sh
Expand Down Expand Up @@ -1090,19 +1096,23 @@ jobs:
defaults:
run:
shell: bash
runs-on: ${{ github.event_name == 'schedule' && 'aks-linux-16-cores' || 'aks-linux-4-cores-16gb'}}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04
volumes:
- /mount/caches:/mount/caches
runs-on: ${{ github.event_name == 'schedule' && 'ubuntu-20.04-16-cores' || 'ubuntu-20.04-8-cores'}}
# TODO: Switch back to self-hosted runners
# container:
# image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04
# volumes:
# - /mount/caches:/mount/caches
env:
INSTALL_DIR: ${{ github.workspace }}/install
INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests
MODEL_HUB_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/model_hub_tests

steps:
- name: Check sudo
run: if [ "$(id -u)" -eq 0 ]; then apt update && apt --assume-yes install sudo; fi

- name: Install 'actions/setup-python@v4' dependencies
run: apt-get update && apt-get install -y libssl1.1 ca-certificates
run: sudo apt-get update && sudo apt-get install -y libssl1.1 ca-certificates

- uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -1165,11 +1175,12 @@ jobs:
defaults:
run:
shell: bash
runs-on: ${{ github.event_name == 'schedule' && 'aks-linux-16-cores' || 'aks-linux-8-cores'}}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04
volumes:
- /mount/caches:/mount/caches
runs-on: ${{ github.event_name == 'schedule' && 'ubuntu-20.04-16-cores' || 'ubuntu-20.04-8-cores'}}
# TODO: Switch back to self-hosted runners
# container:
# image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04
# volumes:
# - /mount/caches:/mount/caches
env:
INSTALL_DIR: ${{ github.workspace }}/install
INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/py_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'

- name: Install dependencies
run: python -m pip install -r src/bindings/python/requirements_test.txt
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@ jobs:
run: |
call "${{ env.INSTALL_DIR }}\\setupvars.bat" && ${{ env.INSTALL_TEST_DIR }}/ov_auto_unit_tests --gtest_print_time=1 --gtest_output=xml:${{ env.INSTALL_TEST_DIR }}/TEST-ov_auto_unit_tests.xml
- name: AUTO FuncTests
shell: cmd
run: |
call "${{ env.INSTALL_DIR }}\\setupvars.bat" && ${{ env.INSTALL_TEST_DIR }}/ov_auto_func_tests --gtest_print_time=1 --gtest_output=xml:${{ env.INSTALL_TEST_DIR }}/TEST-ov_auto_func_tests.xml
- name: Template plugin tests
shell: cmd
run: |
Expand Down Expand Up @@ -647,7 +652,7 @@ jobs:
env:
INSTALL_DIR: "${{ github.workspace }}\\install"
INSTALL_TEST_DIR: "${{ github.workspace }}\\install\\tests"
PARALLEL_TEST_SCRIPT: "${{ github.workspace }}\\install\\tests\\functional_test_utils\\run_parallel.py"
PARALLEL_TEST_SCRIPT: "${{ github.workspace }}\\install\\tests\\functional_test_utils\\layer_tests_summary\\run_parallel.py"
PARALLEL_TEST_CACHE: "${{ github.workspace }}\\install\\tests\\test_cache.lst"

steps:
Expand Down Expand Up @@ -687,7 +692,7 @@ jobs:
shell: cmd
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r ${{ github.workspace }}\install\tests\functional_test_utils\requirements.txt
python3 -m pip install -r ${{ github.workspace }}\install\tests\functional_test_utils\layer_tests_summary\requirements.txt
- name: Restore tests execution time
uses: actions/cache/restore@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
clang==11.1.0; python_version == '3.7'
clang==12.0.1; python_version == '3.8'
clang==12.0.1; python_version == '3.9'
clang==14.0; python_version == '3.10'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
Installing OpenVINO Runtime with Conan Package Manager
############################################################

1. Install Conan 2.0.8 or higher:
.. code-block:: console
1. `Install Conan <https://docs.conan.io/2/installation.html>`__ 2.0.8 or higher, for example, using pip:

.. code-block:: sh

python3 -m pip install conan

2. Create a ``conanfile.txt`` file for your OpenVINO project and add "*openvino*" dependency in there:

.. code-block:: console
.. code-block:: sh

[requires]
openvino/2023.1.0
Expand All @@ -58,8 +58,8 @@ Installing OpenVINO Runtime with Conan Package Manager
cmake_layout

Run the command below to create ``conan_toolchain.cmake`` file, which will be used to compile your project with OpenVINO:
.. code-block:: console

.. code-block:: sh

conan install conanfile.txt --build=missing

Expand All @@ -68,20 +68,20 @@ Installing OpenVINO Runtime with Conan Package Manager
what options there are on the `Conan Package Manager page for OpenVINO <https://conan.io/center/recipes/openvino>`__
and extend the command, like so:

.. code-block:: console
.. code-block:: sh

conan install conanfile.txt --build=missing -o:h openvino/*:enable_intel_gpu=False -o:h openvino/*:enable_onnx_frontend=False' -o:h openvino/*:shared=True.
conan install conanfile.txt --build=missing -o:h 'openvino/*:enable_intel_gpu=False' -o:h 'openvino/*:enable_onnx_frontend=False' -o:h 'openvino/*:shared=True'

3. Configure and compile your project with OpenVINO:
.. code-block:: console

.. code-block:: sh

cmake -DCMAKE_TOOLCHAIN_FILE=<path to conan_toolchain.cmake> -DCMAKE_BUILD_TYPE=Release -S <path to CMakeLists.txt of your project> -B <build dir>
cmake --build <build dir> --parallel

.. note::

OpenVINO can be used with any build interface, as long as it is supported by Conan 2.0.
OpenVINO can be used with any build interface, as long as it is supported by Conan 2.0. Read `more <https://docs.conan.io/2/examples/tools.html>`__.

Additional Resources
########################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Installing OpenVINO Runtime

.. code-block:: sh

vcpkg install openvino:x64-windows-static
vcpkg install 'openvino:x64-windows-static'

Note that the vcpkg installation means building all packages and dependencies from source,
which means the compiler stage will require additional time to complete the process.
Expand Down Expand Up @@ -93,7 +93,7 @@ which means the compiler stage will require additional time to complete the proc

.. code-block:: sh

vcpkg install openvino:x64-linux-release-dynamic
vcpkg install 'openvino:x64-linux-release-dynamic'


After installation, you can use OpenVINO in your product's cmake scripts:
Expand Down
2 changes: 1 addition & 1 deletion scripts/setupvars/setupvars.bat
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ set "PATH=%OPENVINO_LIB_PATHS%;%PATH%"

:: Check if Python is installed
set PYTHON_VERSION_MAJOR=3
set MIN_REQUIRED_PYTHON_VERSION_MINOR=7
set MIN_REQUIRED_PYTHON_VERSION_MINOR=8
set MAX_SUPPORTED_PYTHON_VERSION_MINOR=11

python --version 2>NUL
Expand Down
2 changes: 1 addition & 1 deletion scripts/setupvars/setupvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if command -v lsb_release >/dev/null 2>&1; then
fi

PYTHON_VERSION_MAJOR="3"
MIN_REQUIRED_PYTHON_VERSION_MINOR="7"
MIN_REQUIRED_PYTHON_VERSION_MINOR="8"
MAX_SUPPORTED_PYTHON_VERSION_MINOR="11"

check_python_version () {
Expand Down
6 changes: 3 additions & 3 deletions src/bindings/python/src/compatibility/ngraph/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ def get_dtype(ngraph_type: NgraphType) -> np.dtype:

def get_ndarray(data: NumericData) -> np.ndarray:
"""Wrap data into a numpy ndarray."""
if type(data) == np.ndarray:
if isinstance(data, np.ndarray):
return data
return np.array(data)


def get_shape(data: NumericData) -> TensorShape:
"""Return a shape of NumericData."""
if type(data) == np.ndarray:
if isinstance(data, np.ndarray):
return data.shape # type: ignore
elif type(data) == list:
if isinstance(data, list):
return [len(data)] # type: ignore
return []

Expand Down
6 changes: 3 additions & 3 deletions src/bindings/python/src/openvino/runtime/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ def get_numpy_ctype(openvino_type: Type) -> type:

def get_ndarray(data: NumericData) -> np.ndarray:
"""Wrap data into a numpy ndarray."""
if type(data) == np.ndarray:
if isinstance(data, np.ndarray):
return data # type: ignore
return np.array(data)


def get_shape(data: NumericData) -> TensorShape:
"""Return a shape of NumericData."""
if type(data) == np.ndarray:
if isinstance(data, np.ndarray):
return data.shape # type: ignore
elif type(data) == list:
if isinstance(data, list):
return [len(data)] # type: ignore
return []

Expand Down
5 changes: 1 addition & 4 deletions src/bindings/python/src/openvino/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ def _add_openvino_libs_to_search_path() -> None:
lib_path = os.path.join(os.path.dirname(__file__), lib)
if os.path.isdir(lib_path):
# On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.
if (3, 8) <= sys.version_info:
os.add_dll_directory(os.path.abspath(lib_path))
else:
os.environ["PATH"] = os.path.abspath(lib_path) + ";" + os.environ["PATH"]
os.add_dll_directory(os.path.abspath(lib_path))


def add_openvino_libs_to_path() -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/bindings/python/tests/test_graph/test_any.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_any_dict(value_dict, value_type, data_type):
assert isinstance(ovany.value, dict)
assert ovany[key] == list(value_dict.values())[0]
assert len(ovany.value) == 1
assert type(ovany.value[key]) == value_type
assert type(list(value_dict.values())[0]) == data_type
assert isinstance(ovany.value[key], value_type)
assert isinstance(list(value_dict.values())[0], data_type)
assert ovany.get() == value_dict


Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/tests/test_graph/test_if.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_simple_if_basic():
if_node.set_function(0, then_body)
subgraph_func = if_node.get_function(0)

assert type(subgraph_func) == type(then_body)
assert isinstance(subgraph_func, type(then_body))
assert compare_models(subgraph_func, then_body)
assert subgraph_func._get_raw_address() == then_body._get_raw_address()

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/tests/test_graph/test_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def test_loop_basic():

subgraph_func = loop.get_function()

assert type(subgraph_func) == type(graph_body)
assert isinstance(subgraph_func, type(graph_body))
assert subgraph_func._get_raw_address() == graph_body._get_raw_address()
assert compare_models(subgraph_func, graph_body)
assert loop.get_special_body_ports() == body_ports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_tensor_iterator_basic():

subgraph_func = ti.get_function()

assert type(subgraph_func) == type(graph_body)
assert isinstance(subgraph_func, type(graph_body))
assert compare_models(subgraph_func, graph_body)
assert subgraph_func._get_raw_address() == graph_body._get_raw_address()
assert ti.get_num_iterations() == 16
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/tests/test_runtime/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def test_evaluate_invalid_input_shape():
[Tensor("float32", Shape([2, 1]))],
[Tensor("float32", Shape([3, 1])), Tensor("float32", Shape([3, 1]))],
)
assert "must be compatible with the partial shape: [2,1]" in str(e.value)
assert "Cannot evaluate model!" in str(e.value)


def test_get_batch():
Expand Down
16 changes: 8 additions & 8 deletions src/bindings/python/tests/test_runtime/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def test_single_property_setting(device):
core.set_property(device, streams.num(streams.Num.AUTO))

assert props.streams.Num.AUTO.to_integer() == -1
assert type(core.get_property(device, streams.num())) == int
assert isinstance(core.get_property(device, streams.num()), int)


@pytest.mark.skipif(os.environ.get("TEST_DEVICE", "CPU") != "CPU", reason=f"Cannot run test on device {os.environ.get('TEST_DEVICE')}, Plugin specific test")
Expand Down Expand Up @@ -539,10 +539,10 @@ def test_core_cpu_properties(properties_to_set):
assert core.get_property("CPU", streams.num) == 5

# RO properties
assert type(core.get_property("CPU", props.supported_properties)) == dict
assert type(core.get_property("CPU", props.available_devices)) == list
assert type(core.get_property("CPU", props.optimal_number_of_infer_requests)) == int
assert type(core.get_property("CPU", props.range_for_streams)) == tuple
assert type(core.get_property("CPU", props.range_for_async_infer_requests)) == tuple
assert type(core.get_property("CPU", device.full_name)) == str
assert type(core.get_property("CPU", device.capabilities)) == list
assert isinstance(core.get_property("CPU", props.supported_properties), dict)
assert isinstance(core.get_property("CPU", props.available_devices), list)
assert isinstance(core.get_property("CPU", props.optimal_number_of_infer_requests), int)
assert isinstance(core.get_property("CPU", props.range_for_streams), tuple)
assert isinstance(core.get_property("CPU", props.range_for_async_infer_requests), tuple)
assert isinstance(core.get_property("CPU", device.full_name), str)
assert isinstance(core.get_property("CPU", device.capabilities), list)
Loading

0 comments on commit d1cab3b

Please sign in to comment.