Compare commits
1 Commits
2022.1.0.d
...
releases/2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f103291b47 |
@@ -1,53 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
"""
|
||||
Analyze GTest logs
|
||||
"""
|
||||
|
||||
import re
|
||||
from argparse import ArgumentParser
|
||||
|
||||
|
||||
def get_passed_tests(log_file_path):
|
||||
"""Gets passed tests with OK status"""
|
||||
ok_test_line_pattern = "[ OK ] "
|
||||
ok_tests = []
|
||||
with open(log_file_path) as log_file_obj:
|
||||
for line in log_file_obj.readlines():
|
||||
if ok_test_line_pattern in line:
|
||||
ok_tests.append(line.split(ok_test_line_pattern)[1])
|
||||
return ok_tests
|
||||
|
||||
|
||||
def get_total_time(tests):
|
||||
"""Gets total execution time (sec)"""
|
||||
re_compile_time = re.compile(r".+ \(([0-9]+) ms\)")
|
||||
total_time = 0.0
|
||||
for test in tests:
|
||||
re_time = re_compile_time.match(test)
|
||||
if re_time:
|
||||
total_time += int(re_time.group(1)) / 1000
|
||||
else:
|
||||
print("No time in the test line:", test)
|
||||
return total_time
|
||||
|
||||
|
||||
def main():
|
||||
"""The main entry point function"""
|
||||
arg_parser = ArgumentParser()
|
||||
arg_parser.add_argument(
|
||||
"--log-file", metavar="PATH", default="gtest.log", help="Path to GTest log file"
|
||||
)
|
||||
args = arg_parser.parse_args()
|
||||
|
||||
passed_tests = get_passed_tests(args.log_file)
|
||||
print("PASSED tests count:", len(passed_tests))
|
||||
print("Total execution time of passed tests (sec):", get_total_time(passed_tests))
|
||||
|
||||
print("\nPASSED tests:")
|
||||
print("".join(sorted(passed_tests)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,6 +0,0 @@
|
||||
TransposeOpTest.NHWC2NCHW
|
||||
TransposeOpTest.NCHW2NHWC
|
||||
TransposeOpTest.TwoDim_int16
|
||||
GatherOpTest.Gather_axis1_indices2d_int16
|
||||
SoftmaxOperator.ThreeDimsAxis1
|
||||
SoftmaxOperator.ThreeDimsAxis0
|
||||
@@ -1 +0,0 @@
|
||||
rel-1.8.1
|
||||
@@ -1,372 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- releases/*
|
||||
paths:
|
||||
exclude:
|
||||
- docs/*
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
- repository: openvino_contrib
|
||||
type: github
|
||||
endpoint: openvinotoolkit
|
||||
name: openvinotoolkit/openvino_contrib
|
||||
|
||||
- repository: testdata
|
||||
type: github
|
||||
endpoint: openvinotoolkit
|
||||
name: openvinotoolkit/testdata
|
||||
|
||||
jobs:
|
||||
- job: Lin
|
||||
strategy:
|
||||
matrix:
|
||||
Dynamic:
|
||||
CMAKE_BUILD_SHARED_LIBS: 'ON'
|
||||
PYTHON_STATIC_ARGS:
|
||||
Static:
|
||||
CMAKE_BUILD_SHARED_LIBS: 'OFF'
|
||||
PYTHON_STATIC_ARGS: -m "not dynamic_library and not template_plugin"
|
||||
maxParallel: 2
|
||||
|
||||
# About 150% of total time
|
||||
timeoutInMinutes: 90
|
||||
|
||||
pool:
|
||||
name: LIN_VMSS_VENV_F16S_U20_WU2
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
VSTS_HTTP_RETRY: 5
|
||||
VSTS_HTTP_TIMEOUT: 200
|
||||
BUILD_TYPE: Release
|
||||
REPO_DIR: $(Build.Repository.LocalPath)
|
||||
OPENVINO_CONTRIB_REPO_DIR: $(REPO_DIR)/../openvino_contrib
|
||||
MODELS_PATH: $(REPO_DIR)/../testdata
|
||||
WORK_DIR: $(Pipeline.Workspace)/_w
|
||||
BUILD_DIR: $(WORK_DIR)/build
|
||||
BUILD_SAMPLES_DIR: $(WORK_DIR)/build_samples
|
||||
BUILD_LAYER_TESTS_DIR: $(WORK_DIR)/build_layer_tests
|
||||
BUILD_SAMPLES_TESTS_DIR: $(WORK_DIR)/build_samples_tests
|
||||
INSTALL_DIR: $(WORK_DIR)/install_pkg
|
||||
INSTALL_TEST_DIR: $(INSTALL_DIR)/tests
|
||||
LAYER_TESTS_DIR: $(INSTALL_TEST_DIR)/layer_tests
|
||||
SETUPVARS: $(INSTALL_DIR)/setupvars.sh
|
||||
TMP_DIR: /mnt/tmp
|
||||
SHARE_DIR: /mount/cinfsshare/onnxtestdata
|
||||
CCACHE_DIR: $(SHARE_DIR)/ccache
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2019-06-01"
|
||||
whoami
|
||||
uname -a
|
||||
echo Python3 info ; which python3 ; python3 --version
|
||||
echo Python info ; which python ; python --version
|
||||
echo Java info ; which java ; java -version
|
||||
echo gcc info ; which gcc ; gcc --version
|
||||
echo cmake info ; which cmake ; cmake --version
|
||||
lsb_release
|
||||
env
|
||||
cat /proc/cpuinfo
|
||||
cat /proc/meminfo
|
||||
cat /etc/fstab
|
||||
vmstat -s
|
||||
df
|
||||
lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd"
|
||||
free -h
|
||||
echo TargetBranch: $(System.PullRequest.TargetBranch)
|
||||
echo SourceBranch: $(Build.SourceBranch)
|
||||
displayName: 'System info'
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR)
|
||||
rm -rf $(BUILD_DIR) ; mkdir $(BUILD_DIR)
|
||||
rm -rf $(BUILD_SAMPLES_DIR) ; mkdir $(BUILD_SAMPLES_DIR)
|
||||
sudo rm -rf $(TMP_DIR) ; sudo mkdir $(TMP_DIR) ; sudo chmod 777 -R $(TMP_DIR)
|
||||
sudo mkdir -p $(SHARE_DIR)
|
||||
sudo apt --assume-yes update && sudo apt --assume-yes install nfs-common
|
||||
sudo mount -vvv -t nfs cinfsshare.file.core.windows.net:/cinfsshare/onnxtestdata $(SHARE_DIR) -o vers=4,minorversion=1,sec=sys
|
||||
mkdir -p $(CCACHE_DIR)
|
||||
displayName: 'Make dir'
|
||||
|
||||
- checkout: self
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino
|
||||
|
||||
- checkout: openvino_contrib
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino_contrib
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
$(REPO_DIR)/install_build_dependencies.sh
|
||||
# Move jdk into contrib
|
||||
sudo apt --assume-yes install openjdk-11-jdk
|
||||
# For opencv-python: python3-setuptools and pip upgrade
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/requirements.txt
|
||||
python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/wheel/requirements-dev.txt
|
||||
# For running Python API tests
|
||||
python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/src/requirements-dev.txt
|
||||
# For running Paddle frontend unit tests
|
||||
python3 -m pip install -r $(REPO_DIR)/src/core/tests/frontend/paddle/requirements_dev.txt
|
||||
# For running ONNX frontend unit tests
|
||||
python3 -m pip install -r $(REPO_DIR)/src/core/tests/requirements_test_onnx.txt
|
||||
# For MO unit tests
|
||||
python3 -m pip install -r $(REPO_DIR)/tools/mo/requirements.txt
|
||||
python3 -m pip install -r $(REPO_DIR)/tools/mo/requirements_dev.txt
|
||||
# Speed up build
|
||||
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
|
||||
unzip ninja-linux.zip
|
||||
sudo cp -v ninja /usr/local/bin/
|
||||
# Speed up tests
|
||||
git clone https://github.com/google/gtest-parallel.git
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
# Should be after 'Install dependencies' because Git lfs is not installed
|
||||
- checkout: testdata
|
||||
clean: true
|
||||
lfs: true
|
||||
path: testdata
|
||||
|
||||
- task: CMake@1
|
||||
inputs:
|
||||
# CMake must get Python 3.x version by default
|
||||
cmakeArgs: >
|
||||
-GNinja
|
||||
-DVERBOSE_BUILD=ON
|
||||
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
|
||||
-DENABLE_PYTHON=ON
|
||||
-DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS)
|
||||
-DENABLE_INTEL_GNA=$(CMAKE_BUILD_SHARED_LIBS)
|
||||
-DENABLE_ONEDNN_FOR_GPU=$(CMAKE_BUILD_SHARED_LIBS)
|
||||
-DPYTHON_EXECUTABLE=/usr/bin/python3.8
|
||||
-DENABLE_WHEEL=ON
|
||||
-DENABLE_TESTS=ON
|
||||
-DENABLE_OV_ONNX_FRONTEND=ON
|
||||
-DENABLE_FASTER_BUILD=ON
|
||||
-DENABLE_STRICT_DEPENDENCIES=OFF
|
||||
-DENABLE_REQUIREMENTS_INSTALL=OFF
|
||||
-DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache
|
||||
$(REPO_DIR)
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
|
||||
- script: ls -alR $(REPO_DIR)/temp/
|
||||
displayName: 'List temp SDKs'
|
||||
|
||||
- script: ccache --zero-stats --max-size=1T --show-config
|
||||
displayName: 'Clean ccache stats'
|
||||
|
||||
- script: |
|
||||
export CCACHE_DIR=$(CCACHE_DIR)
|
||||
export CCACHE_TEMPDIR=$(TMP_DIR)/ccache
|
||||
ninja
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Build Lin'
|
||||
|
||||
- script: ccache --show-stats
|
||||
displayName: 'Show ccache stats'
|
||||
|
||||
- script: ls -alR $(REPO_DIR)/bin/
|
||||
displayName: 'List bin files'
|
||||
|
||||
- script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install'
|
||||
|
||||
- task: CMake@1
|
||||
inputs:
|
||||
cmakeArgs: >
|
||||
-GNinja
|
||||
$(REPO_DIR)/tests/layer_tests
|
||||
workingDirectory: $(BUILD_LAYER_TESTS_DIR)
|
||||
|
||||
- script: ninja
|
||||
workingDirectory: $(BUILD_LAYER_TESTS_DIR)
|
||||
displayName: 'Build Layer Tests'
|
||||
|
||||
- script: cmake -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_LAYER_TESTS_DIR)
|
||||
displayName: 'Install Layer Tests'
|
||||
|
||||
- script: ls -alR $(INSTALL_DIR)
|
||||
displayName: 'List install files'
|
||||
|
||||
- script: python3 -m pip install openvino-dev --find-links=$(INSTALL_DIR)/tools
|
||||
displayName: 'Install wheels'
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
mkdir -p $(INSTALL_DIR)/opencv/
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake
|
||||
cp -R $(REPO_DIR)/temp/opencv_4.5.2_ubuntu20/opencv/* $(INSTALL_DIR)/opencv/
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install tests'
|
||||
|
||||
- script: ls -alR $(INSTALL_DIR)
|
||||
displayName: 'List install files'
|
||||
|
||||
- script: $(INSTALL_DIR)/samples/cpp/build_samples.sh -i $(INSTALL_DIR)
|
||||
workingDirectory: $(BUILD_SAMPLES_DIR)
|
||||
displayName: 'Build cpp samples'
|
||||
continueOnError: false
|
||||
|
||||
- script: $(INSTALL_DIR)/samples/c/build_samples.sh -i $(INSTALL_DIR)
|
||||
workingDirectory: $(BUILD_SAMPLES_DIR)
|
||||
displayName: 'Build c samples'
|
||||
continueOnError: false
|
||||
|
||||
- script: rm -fr $(BUILD_DIR)
|
||||
displayName: 'Clean build dir'
|
||||
continueOnError: false
|
||||
|
||||
# Skip test_onnx/test_zoo_models and test_onnx/test_backend due to long execution time
|
||||
- script: |
|
||||
export DATA_PATH=$(MODELS_PATH)
|
||||
export MODELS_PATH=$(MODELS_PATH)
|
||||
. $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_TEST_DIR)/pyngraph $(PYTHON_STATIC_ARGS) --junitxml=TEST-Pyngraph.xml --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_utils/test_utils.py --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_zoo_models.py --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_backend.py
|
||||
displayName: 'nGraph Python Bindings Tests'
|
||||
continueOnError: false
|
||||
|
||||
- script: |
|
||||
export MO_ROOT=$(INSTALL_DIR)/tools/mo
|
||||
. $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_DIR)/tests/mo/unit_tests --junitxml=TEST-ModelOptimizer.xml
|
||||
displayName: 'Model Optimizer UT'
|
||||
continueOnError: false
|
||||
enabled: true
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml
|
||||
workingDirectory: $(INSTALL_TEST_DIR)
|
||||
displayName: 'OV Core UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/paddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-Paddle.xml
|
||||
displayName: 'Paddle Frontend UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml
|
||||
displayName: 'Tensorflow Frontend UT'
|
||||
continueOnError: false
|
||||
|
||||
# . $(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
|
||||
displayName: 'IE UT old'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml
|
||||
displayName: 'IE UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml
|
||||
displayName: 'CPU UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml
|
||||
displayName: 'GNA UT'
|
||||
continueOnError: false
|
||||
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml
|
||||
displayName: 'VPU UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieMultiPluginUnitTests --gtest_output=xml:TEST-ieMultiPluginUnitTests.xml
|
||||
displayName: 'MULTI UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml
|
||||
displayName: 'ONNX Importer UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml
|
||||
displayName: 'IE FuncTests'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_template_func_tests --gtest_filter=*smoke* --gtest_output=xml:TEST-templateFuncTests.xml
|
||||
displayName: 'TEMPLATE FuncTests'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuFuncTests --gtest_filter=*smoke* --gtest_print_time=1 --gtest_output=xml:TEST-cpuFuncTests.xml
|
||||
displayName: 'CPU FuncTests'
|
||||
continueOnError: false
|
||||
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'OFF')
|
||||
|
||||
- script: |
|
||||
export DATA_PATH=$(MODELS_PATH)
|
||||
export MODELS_PATH=$(MODELS_PATH)
|
||||
. $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml
|
||||
displayName: 'IE CAPITests'
|
||||
continueOnError: false
|
||||
|
||||
- task: CMake@1
|
||||
inputs:
|
||||
cmakeArgs: >
|
||||
-GNinja
|
||||
$(REPO_DIR)/tests/samples_tests
|
||||
workingDirectory: $(BUILD_SAMPLES_TESTS_DIR)
|
||||
|
||||
- script: cmake -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_SAMPLES_TESTS_DIR)
|
||||
displayName: 'Install Samples Tests'
|
||||
|
||||
- script: |
|
||||
python3 -m pip install -r $(INSTALL_DIR)/tests/smoke_tests/requirements.txt
|
||||
workingDirectory: $(INSTALL_DIR)
|
||||
displayName: 'Install dependencies for samples smoke tests'
|
||||
continueOnError: false
|
||||
|
||||
- script: |
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
export IE_APP_PATH=$(INSTALL_DIR)/samples_bin
|
||||
export IE_APP_PYTHON_PATH=$(INSTALL_DIR)/samples/python/
|
||||
export SHARE=$(INSTALL_DIR)/tests/smoke_tests/samples_smoke_tests_data/
|
||||
export WORKSPACE=$(INSTALL_DIR)
|
||||
. $(SETUPVARS) && python3 -m pytest $(INSTALL_DIR)/tests/smoke_tests/ --env_conf $(INSTALL_DIR)/tests/smoke_tests/env_config.yml -s --junitxml=$(BUILD_DIR)/TEST-SamplesSmokeTests.xml
|
||||
workingDirectory: $(INSTALL_DIR)/samples_bin
|
||||
displayName: 'Samples Smoke Tests'
|
||||
continueOnError: false
|
||||
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
|
||||
enabled: true
|
||||
|
||||
- script: |
|
||||
export DATA_PATH=$(MODELS_PATH)
|
||||
export MODELS_PATH=$(MODELS_PATH)
|
||||
cd $(REPO_DIR)/inference-engine/ie_bridges/python/tests
|
||||
. $(SETUPVARS) -pyver 3.8 && python3 -m pytest --junitxml=TEST-PythonAPI.xml $(PYTHON_STATIC_ARGS)
|
||||
displayName: 'Python API Tests'
|
||||
continueOnError: false
|
||||
|
||||
- script: |
|
||||
. $(SETUPVARS)
|
||||
python3 -m pip install -r requirements.txt
|
||||
export MO_ROOT=$(INSTALL_DIR)/tools/mo
|
||||
export PYTHONPATH=$(LAYER_TESTS_DIR):$PYTHONPATH
|
||||
python3 -m pytest tensorflow_tests/test_tf_Roll.py --ir_version=10 --junitxml=TEST-tf_Roll.xmlTEST
|
||||
workingDirectory: $(LAYER_TESTS_DIR)
|
||||
displayName: 'Layer Tests'
|
||||
continueOnError: false
|
||||
enabled: true
|
||||
|
||||
- task: PublishTestResults@2
|
||||
condition: always()
|
||||
inputs:
|
||||
testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit, cTest
|
||||
testResultsFiles: '**/TEST-*.xml'
|
||||
#searchFolder: '$(BUILD_DIR)'
|
||||
mergeTestResults: false # Optional
|
||||
#failTaskOnFailedTests: false # Optional
|
||||
#testRunTitle: 'Pre/Post-Commit' # Optional
|
||||
buildPlatform: 'x64' # Optional
|
||||
buildConfiguration: 'Linux' # Optional
|
||||
#publishRunAttachments: true # Optional
|
||||
@@ -1,98 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- releases/*
|
||||
paths:
|
||||
exclude:
|
||||
- docs/*
|
||||
|
||||
jobs:
|
||||
- job: LinCC
|
||||
# About 150% of total time
|
||||
timeoutInMinutes: 90
|
||||
|
||||
pool:
|
||||
name: LIN_VMSS_VENV_F16S_U20_WU2
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
VSTS_HTTP_RETRY: 5
|
||||
VSTS_HTTP_TIMEOUT: 200
|
||||
BUILD_TYPE: Release
|
||||
REPO_DIR: $(Build.Repository.LocalPath)
|
||||
OPENVINO_CONTRIB_REPO_DIR: $(REPO_DIR)/../openvino_contrib
|
||||
MODELS_PATH: $(REPO_DIR)/../testdata
|
||||
WORK_DIR: $(Pipeline.Workspace)/_w
|
||||
BUILD_DIR: $(WORK_DIR)/build
|
||||
INSTALL_DIR: $(WORK_DIR)/install_pkg
|
||||
SETUPVARS: $(INSTALL_DIR)/setupvars.sh
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2019-06-01"
|
||||
whoami
|
||||
uname -a
|
||||
echo Python3 info ; which python3 ; python3 --version
|
||||
echo Python info ; which python ; python --version
|
||||
echo Java info ; which java ; java -version
|
||||
echo gcc info ; which gcc ; gcc --version
|
||||
echo cmake info ; which cmake ; cmake --version
|
||||
lsb_release
|
||||
env
|
||||
cat /proc/cpuinfo
|
||||
cat /proc/meminfo
|
||||
cat /etc/fstab
|
||||
vmstat -s
|
||||
df
|
||||
lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd"
|
||||
free -h
|
||||
displayName: 'System info'
|
||||
|
||||
- script: |
|
||||
rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR)
|
||||
rm -rf $(BUILD_DIR) ; mkdir $(BUILD_DIR)
|
||||
displayName: 'Make dir'
|
||||
|
||||
- checkout: self
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
$(REPO_DIR)/install_build_dependencies.sh
|
||||
python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/requirements.txt
|
||||
# Speed up build
|
||||
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
|
||||
unzip ninja-linux.zip
|
||||
sudo cp -v ninja /usr/local/bin/
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- task: CMake@1
|
||||
inputs:
|
||||
cmakeArgs: >
|
||||
-GNinja
|
||||
-DVERBOSE_BUILD=ON
|
||||
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
|
||||
-DENABLE_FASTER_BUILD=ON
|
||||
-DENABLE_PROFILING_ITT=ON
|
||||
-DSELECTIVE_BUILD=COLLECT
|
||||
$(REPO_DIR)
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
|
||||
- script: ninja
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Build LinCC'
|
||||
|
||||
- script: ls -alR $(REPO_DIR)/bin/
|
||||
displayName: 'List bin files'
|
||||
|
||||
- script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install'
|
||||
|
||||
- script: ls -alR $(INSTALL_DIR)
|
||||
displayName: 'List install files'
|
||||
@@ -1,111 +0,0 @@
|
||||
jobs:
|
||||
- job: Lin
|
||||
# About 150% of total time
|
||||
timeoutInMinutes: 90
|
||||
|
||||
pool:
|
||||
name: LIN_VMSS_VENV_F16S_U20_WU2
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
VSTS_HTTP_RETRY: 5
|
||||
VSTS_HTTP_TIMEOUT: 200
|
||||
BUILD_TYPE: Release
|
||||
REPO_DIR: $(Build.Repository.LocalPath)
|
||||
WORK_DIR: $(Pipeline.Workspace)/_w
|
||||
BUILD_DIR: $(WORK_DIR)/build
|
||||
BUILD_SAMPLES_DIR: $(WORK_DIR)/build_samples
|
||||
INSTALL_DIR: $(WORK_DIR)/install_pkg
|
||||
SETUPVARS: $(INSTALL_DIR)/setupvars.sh
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2019-06-01"
|
||||
whoami
|
||||
uname -a
|
||||
echo Python3 info ; which python3 ; python3 --version
|
||||
echo Python info ; which python ; python --version
|
||||
echo Java info ; which java ; java -version
|
||||
echo gcc info ; which gcc ; gcc --version
|
||||
echo cmake info ; which cmake ; cmake --version
|
||||
lsb_release
|
||||
env
|
||||
cat /proc/cpuinfo
|
||||
cat /proc/meminfo
|
||||
cat /etc/fstab
|
||||
vmstat -s
|
||||
df
|
||||
lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd"
|
||||
free -h
|
||||
displayName: 'System info'
|
||||
|
||||
- script: |
|
||||
rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR)
|
||||
rm -rf $(BUILD_DIR) ; mkdir $(BUILD_DIR)
|
||||
rm -rf $(BUILD_SAMPLES_DIR) ; mkdir $(BUILD_SAMPLES_DIR)
|
||||
displayName: 'Make dir'
|
||||
|
||||
- checkout: self
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
$(REPO_DIR)/install_build_dependencies.sh
|
||||
# Speed up build
|
||||
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
|
||||
unzip ninja-linux.zip
|
||||
sudo cp -v ninja /usr/local/bin/
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- task: CMake@1
|
||||
inputs:
|
||||
cmakeArgs: >
|
||||
-GNinja
|
||||
-DVERBOSE_BUILD=ON
|
||||
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
|
||||
-DENABLE_FASTER_BUILD=ON
|
||||
-DENABLE_STRICT_DEPENDENCIES=OFF
|
||||
-DENABLE_REQUIREMENTS_INSTALL=OFF
|
||||
$(REPO_DIR)
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
|
||||
- script: ls -alR $(REPO_DIR)/temp/
|
||||
displayName: 'List temp SDKs'
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
wget https://scan.coverity.com/download/linux64 --post-data "token=$(COVERITY_TOKEN)&project=openvino" -O coverity_tool.tgz
|
||||
tar xvf coverity_tool.tgz
|
||||
rm coverity_tool.tgz
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install coverity tool'
|
||||
|
||||
- script: $(WORK_DIR)/cov-analysis*/bin/cov-build --dir $(BUILD_DIR)/cov-int ninja
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Build Lin with Coverity'
|
||||
|
||||
- script: ls -alR $(REPO_DIR)/bin/
|
||||
displayName: 'List bin files'
|
||||
|
||||
- script: tar -C $(BUILD_DIR) -czvf openvino.tgz cov-int
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Pack cov-int folder for submission'
|
||||
|
||||
- publish: $(BUILD_DIR)/openvino.tgz
|
||||
artifact: openvino.tgz
|
||||
continueOnError: true
|
||||
displayName: 'Publish submission'
|
||||
|
||||
- script: |
|
||||
curl --form token=$(COVERITY_TOKEN) \
|
||||
--form email=$(COVERITY_USER) \
|
||||
--form file=@openvino.tgz \
|
||||
--form version="$(Build.SourceVersion)" \
|
||||
--form description="https://github.com/openvinotoolkit/openvino/runs/$(Build.BuildNumber)" \
|
||||
https://scan.coverity.com/builds?project=openvino
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Submit for analysis'
|
||||
@@ -1,80 +0,0 @@
|
||||
#resources:
|
||||
# repositories:
|
||||
# - repository: testdata
|
||||
# type: github
|
||||
# endpoint: openvinotoolkit
|
||||
# name: openvinotoolkit/testdata
|
||||
|
||||
jobs:
|
||||
- job: Lin_lohika
|
||||
# About 150% of total time
|
||||
timeoutInMinutes: 90
|
||||
|
||||
pool:
|
||||
name: LIN_LOHIKA
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
# VSTS_HTTP_RETRY: 5
|
||||
# VSTS_HTTP_TIMEOUT: 200
|
||||
# BUILD_TYPE: Release
|
||||
# REPO_DIR: $(Build.Repository.LocalPath)
|
||||
# MODELS_PATH: $(REPO_DIR)/../testdata
|
||||
# WORK_DIR: $(Pipeline.Workspace)/_w
|
||||
# BUILD_DIR: $(WORK_DIR)/build
|
||||
|
||||
steps:
|
||||
- script: git -C ~/work/openvino fetch origin $(Build.SourceBranch)
|
||||
displayName: fetch
|
||||
|
||||
# - checkout: self
|
||||
# clean: true
|
||||
# lfs: false
|
||||
# submodules: recursive
|
||||
# path: openvino
|
||||
|
||||
- checkout: none
|
||||
|
||||
- script: git -C ~/work/openvino checkout -m $(Build.SourceVersion) && git -C ~/work/openvino submodule update --init --recursive
|
||||
displayName: checkout
|
||||
|
||||
# Should be after 'Install dependencies' because Git lfs is not installed
|
||||
# - checkout: testdata
|
||||
# clean: true
|
||||
# lfs: true
|
||||
# path: testdata
|
||||
|
||||
- script: env -C ~/work ./configreleasenolto.sh
|
||||
displayName: CMake
|
||||
|
||||
# - task: CMake@1
|
||||
# inputs:
|
||||
# # CMake must get Python 3.x version by default
|
||||
# cmakeArgs: >
|
||||
# -GNinja
|
||||
# -DVERBOSE_BUILD=ON
|
||||
# -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
|
||||
# -DENABLE_PYTHON=ON
|
||||
# -DPYTHON_EXECUTABLE=/usr/bin/python3.8
|
||||
# -DENABLE_WHEEL=ON
|
||||
# -DENABLE_TESTS=ON
|
||||
# -DENABLE_OV_ONNX_FRONTEND=ON
|
||||
# -DENABLE_FASTER_BUILD=ON
|
||||
# -DENABLE_STRICT_DEPENDENCIES=OFF
|
||||
# -DENABLE_REQUIREMENTS_INSTALL=OFF
|
||||
# -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules
|
||||
# $(REPO_DIR)
|
||||
# workingDirectory: $(BUILD_DIR)
|
||||
|
||||
- script: >
|
||||
env -C ~/work
|
||||
./buildreleasenolto.sh
|
||||
libinference_engine_preproc.so
|
||||
ov_intel_cpu_plugin
|
||||
ov_intel_gpu_plugin
|
||||
clDNN_unit_tests64
|
||||
gpuFuncTests
|
||||
displayName: Build Lin
|
||||
|
||||
- script: ~/work/testreleasenolto.sh
|
||||
displayName: cldnn tests
|
||||
@@ -1,93 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- releases/*
|
||||
paths:
|
||||
exclude:
|
||||
- docs/*
|
||||
|
||||
jobs:
|
||||
- job: OpenVINO_ONNX_CI
|
||||
strategy:
|
||||
matrix:
|
||||
Release:
|
||||
BUILD_TYPE: 'Release'
|
||||
TOX_COMMAND: 'tox && tox -e zoo_models'
|
||||
Debug:
|
||||
BUILD_TYPE: 'Debug'
|
||||
TOX_COMMAND: 'tox'
|
||||
maxParallel: 2
|
||||
|
||||
# About 300% of total time
|
||||
timeoutInMinutes: 90
|
||||
|
||||
pool:
|
||||
name: LIN_VMSS_VENV_ONNX_U20_WU2
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
VSTS_HTTP_RETRY: 5
|
||||
VSTS_HTTP_TIMEOUT: 200
|
||||
REPO_DIR: $(Build.Repository.LocalPath)
|
||||
WORK_DIR: $(Pipeline.Workspace)/_w
|
||||
MODELS_DIR: /mount/cinfsshare/onnxtestdata
|
||||
TMP_DIR: /mnt/tmp
|
||||
ONNX_MODEL_ZOO_SHA: "d58213534f2a4d1c4b19ba62b3bb5f544353256e"
|
||||
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2019-06-01"
|
||||
whoami
|
||||
uname -a
|
||||
echo Python3 info ; which python3 ; python3 --version
|
||||
echo Python info ; which python ; python --version
|
||||
echo Java info ; which java ; java -version
|
||||
echo gcc info ; which gcc ; gcc --version
|
||||
echo cmake info ; which cmake ; cmake --version
|
||||
lsb_release
|
||||
env
|
||||
cat /proc/cpuinfo
|
||||
cat /proc/meminfo
|
||||
cat /etc/fstab
|
||||
vmstat -s
|
||||
df
|
||||
lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd"
|
||||
free -h
|
||||
displayName: 'System info'
|
||||
|
||||
- script: |
|
||||
rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR)
|
||||
sudo mkdir -p $(MODELS_DIR)
|
||||
sudo apt --assume-yes update && sudo apt --assume-yes install nfs-common
|
||||
sudo mount -vvv -t nfs cinfsshare.file.core.windows.net:/cinfsshare/onnxtestdata $(MODELS_DIR) -o vers=4,minorversion=1,sec=sys
|
||||
mkdir -p $(MODELS_DIR)/models_data
|
||||
displayName: 'Make dirs'
|
||||
|
||||
- checkout: self
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
sudo apt --assume-yes install git-lfs uidmap
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sudo sh get-docker.sh
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- script: src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh -d $(MODELS_DIR)/models_data -o -s "$(ONNX_MODEL_ZOO_SHA)"
|
||||
displayName: 'Update models'
|
||||
condition: ne(variables['BUILD_TYPE'], 'Debug')
|
||||
|
||||
- script: sudo docker build --tag=openvino-onnx-ci-image --file=.ci/openvino-onnx/Dockerfile --build-arg BUILD_TYPE=$(BUILD_TYPE) --build-arg PROTOBUF_LITE=$(PROTOBUF_LITE) .
|
||||
displayName: 'Docker build $(BUILD_TYPE)'
|
||||
|
||||
- script: sudo fallocate -l 64G /swapfile ; sudo mkswap /swapfile ; sudo swapon /swapfile ; df ; free -h
|
||||
displayName: 'Create swap'
|
||||
|
||||
- script: sudo docker run --name openvino-onnx-ci-container --volume $(MODELS_DIR)/models_data/model_zoo/onnx_model_zoo_$(ONNX_MODEL_ZOO_SHA):/root/.onnx/model_zoo/onnx_model_zoo --volume $(MODELS_DIR)/msft:/root/.onnx/model_zoo/MSFT openvino-onnx-ci-image /bin/bash -c "$(TOX_COMMAND)"
|
||||
displayName: 'Docker run $(BUILD_TYPE)'
|
||||
@@ -1,162 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- releases/*
|
||||
paths:
|
||||
exclude:
|
||||
- docs/*
|
||||
|
||||
jobs:
|
||||
- job: onnxruntime
|
||||
timeoutInMinutes: 90
|
||||
|
||||
pool:
|
||||
name: LIN_VMSS_VENV_ONNX_U20_WU2
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
VSTS_HTTP_RETRY: 5
|
||||
VSTS_HTTP_TIMEOUT: 200
|
||||
BUILD_TYPE: Release
|
||||
REPO_DIR: $(Build.Repository.LocalPath)
|
||||
ONNXRUNTIME_REPO_DIR: $(REPO_DIR)/../onnxruntime
|
||||
WORK_DIR: $(Pipeline.Workspace)/_w
|
||||
MODELS_DIR: /mount/cinfsshare/onnxtestdata
|
||||
TMP_DIR: /mnt/tmp
|
||||
INSTALL_DIR: $(WORK_DIR)/install_pkg/openvino
|
||||
BUILD_DIR: $(WORK_DIR)/build
|
||||
ONNXRUNTIME_UTILS: $(REPO_DIR)/.ci/azure/ci_utils/onnxruntime
|
||||
ONNXRUNTIME_BUILD_DIR: $(ONNXRUNTIME_REPO_DIR)/build
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2019-06-01"
|
||||
whoami
|
||||
uname -a
|
||||
echo Python3 info ; which python3 ; python3 --version
|
||||
echo Python info ; which python ; python --version
|
||||
echo Java info ; which java ; java -version
|
||||
echo gcc info ; which gcc ; gcc --version
|
||||
echo cmake info ; which cmake ; cmake --version
|
||||
lsb_release
|
||||
env
|
||||
cat /proc/cpuinfo
|
||||
cat /proc/meminfo
|
||||
cat /etc/fstab
|
||||
vmstat -s
|
||||
df
|
||||
lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd"
|
||||
free -h
|
||||
displayName: 'System info'
|
||||
|
||||
- script: |
|
||||
rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR)
|
||||
sudo rm -rf $(TMP_DIR) ; sudo mkdir $(TMP_DIR) ; sudo chmod 777 -R $(TMP_DIR)
|
||||
sudo mkdir -p $(MODELS_DIR)
|
||||
sudo apt --assume-yes update && sudo apt --assume-yes install nfs-common
|
||||
sudo mount -vvv -t nfs cinfsshare.file.core.windows.net:/cinfsshare/onnxtestdata $(MODELS_DIR) -o vers=4,minorversion=1,sec=sys
|
||||
displayName: 'Make dirs'
|
||||
|
||||
- checkout: self
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino
|
||||
|
||||
- script: |
|
||||
branch=`tr -s '\n ' < $(ONNXRUNTIME_UTILS)/version`
|
||||
git clone --branch $branch --single-branch --recursive https://github.com/microsoft/onnxruntime.git $(ONNXRUNTIME_REPO_DIR)
|
||||
displayName: 'Clone onnxruntime'
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
$(REPO_DIR)/install_build_dependencies.sh
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/requirements.txt
|
||||
# For running Python API tests
|
||||
python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/src/requirements-dev.txt
|
||||
# Speed up build
|
||||
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
|
||||
unzip ninja-linux.zip
|
||||
sudo cp -v ninja /usr/local/bin/
|
||||
# Speed up tests
|
||||
git clone https://github.com/google/gtest-parallel.git
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- task: CMake@1
|
||||
inputs:
|
||||
# CMake must get Python 3.x version by default
|
||||
cmakeArgs: >
|
||||
-GNinja
|
||||
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
|
||||
-DENABLE_PYTHON=ON
|
||||
-DPYTHON_EXECUTABLE=/usr/bin/python3.8
|
||||
-DENABLE_VPU=OFF
|
||||
-DENABLE_INTEL_GNA=OFF
|
||||
-DENABLE_OPENCV=OFF
|
||||
-DENABLE_CPPLINT=OFF
|
||||
-DENABLE_TESTS=OFF
|
||||
-DENABLE_INTEL_CPU=ON
|
||||
-DENABLE_INTEL_GPU=OFF
|
||||
-DENABLE_PROFILING_ITT=OFF
|
||||
-DENABLE_SAMPLES=OFF
|
||||
-DENABLE_OV_ONNX_FRONTEND=ON
|
||||
-DENABLE_OPENVINO_DEBUG=OFF
|
||||
$(REPO_DIR)
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
|
||||
- script: ninja
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Build Lin ONNX'
|
||||
|
||||
- script: ls -alR $(REPO_DIR)/bin/
|
||||
displayName: 'List bin files'
|
||||
|
||||
- script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install'
|
||||
|
||||
- script: |
|
||||
source $(INSTALL_DIR)/setupvars.sh
|
||||
CXXFLAGS="-Wno-error=deprecated-declarations" ./build.sh --config RelWithDebInfo --use_openvino CPU_FP32 --build_shared_lib --parallel --skip_tests --build_dir $(ONNXRUNTIME_BUILD_DIR)
|
||||
workingDirectory: $(ONNXRUNTIME_REPO_DIR)
|
||||
displayName: 'Build Lin ONNX Runtime'
|
||||
|
||||
- script: |
|
||||
source $(INSTALL_DIR)/setupvars.sh
|
||||
skip_tests=`tr -s '\n ' ':' < $(ONNXRUNTIME_UTILS)/skip_tests`
|
||||
./onnxruntime_test_all --gtest_filter=-$skip_tests
|
||||
workingDirectory: $(ONNXRUNTIME_BUILD_DIR)/RelWithDebInfo
|
||||
displayName: 'Run onnxruntime_test_all'
|
||||
|
||||
- script: |
|
||||
source $(INSTALL_DIR)/setupvars.sh
|
||||
./onnxruntime_shared_lib_test
|
||||
workingDirectory: $(ONNXRUNTIME_BUILD_DIR)/RelWithDebInfo
|
||||
displayName: 'Run onnxruntime_shared_lib_test'
|
||||
|
||||
- script: |
|
||||
source $(INSTALL_DIR)/setupvars.sh
|
||||
./onnxruntime_global_thread_pools_test
|
||||
workingDirectory: $(ONNXRUNTIME_BUILD_DIR)/RelWithDebInfo
|
||||
displayName: 'Run onnxruntime_global_thread_pools_test'
|
||||
|
||||
- script: |
|
||||
source $(INSTALL_DIR)/setupvars.sh
|
||||
./onnxruntime_api_tests_without_env
|
||||
workingDirectory: $(ONNXRUNTIME_BUILD_DIR)/RelWithDebInfo
|
||||
displayName: 'Run onnxruntime_api_tests_without_env'
|
||||
|
||||
- script: |
|
||||
source $(INSTALL_DIR)/setupvars.sh
|
||||
./onnx_test_runner "$(ONNXRUNTIME_REPO_DIR)/cmake/external/onnx/onnx/backend/test/data/pytorch-converted"
|
||||
workingDirectory: $(ONNXRUNTIME_BUILD_DIR)/RelWithDebInfo
|
||||
displayName: 'Run pytorch-converted tests'
|
||||
|
||||
- script: |
|
||||
source $(INSTALL_DIR)/setupvars.sh
|
||||
./onnx_test_runner "$(ONNXRUNTIME_REPO_DIR)/cmake/external/onnx/onnx/backend/test/data/pytorch-operator"
|
||||
workingDirectory: $(ONNXRUNTIME_BUILD_DIR)/RelWithDebInfo
|
||||
displayName: 'Run pytorch-operator tests'
|
||||
@@ -1,187 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- releases/*
|
||||
paths:
|
||||
exclude:
|
||||
- docs/*
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
- repository: openvino_contrib
|
||||
type: github
|
||||
endpoint: openvinotoolkit
|
||||
name: openvinotoolkit/openvino_contrib
|
||||
|
||||
- repository: testdata
|
||||
type: github
|
||||
endpoint: openvinotoolkit
|
||||
name: openvinotoolkit/testdata
|
||||
|
||||
jobs:
|
||||
- job: Mac
|
||||
# About 250% of total time (perfomace of Mac hosts is unstable, 360 is max)
|
||||
timeoutInMinutes: 360
|
||||
|
||||
pool:
|
||||
vmImage: 'macOS-10.15'
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
VSTS_HTTP_RETRY: 5
|
||||
VSTS_HTTP_TIMEOUT: 200
|
||||
BUILD_TYPE: Release
|
||||
REPO_DIR: $(Build.Repository.LocalPath)
|
||||
OPENVINO_CONTRIB_REPO_DIR: $(REPO_DIR)/../openvino_contrib
|
||||
MODELS_PATH: $(REPO_DIR)/../testdata
|
||||
WORK_DIR: $(Pipeline.Workspace)/_w
|
||||
BUILD_DIR: $(WORK_DIR)/build
|
||||
INSTALL_DIR: $(WORK_DIR)/install_pkg
|
||||
INSTALL_TEST_DIR: $(INSTALL_DIR)/tests
|
||||
SETUPVARS: $(INSTALL_DIR)/setupvars.sh
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
whoami
|
||||
uname -a
|
||||
echo Python3 info ; which python3 ; python3 --version
|
||||
echo Python info ; which python ; python --version
|
||||
echo Java info ; which java ; java -version
|
||||
echo gcc info ; which gcc ; gcc --version
|
||||
echo cmake info ; which cmake ; cmake --version
|
||||
xcrun --sdk macosx --show-sdk-version
|
||||
env
|
||||
sysctl -a
|
||||
displayName: 'System info'
|
||||
|
||||
- script: |
|
||||
rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR)
|
||||
rm -rf $(BUILD_DIR) ; mkdir $(BUILD_DIR)
|
||||
displayName: 'Make dir'
|
||||
|
||||
- checkout: self
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino
|
||||
|
||||
- checkout: openvino_contrib
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino_contrib
|
||||
|
||||
- checkout: testdata
|
||||
clean: true
|
||||
lfs: true
|
||||
path: testdata
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.7'
|
||||
|
||||
- script: |
|
||||
brew install cython
|
||||
brew install automake
|
||||
python3 -m pip install -r $(REPO_DIR)/src/core/tests/requirements_test_onnx.txt
|
||||
# Speed up build
|
||||
brew install ninja
|
||||
# Speed up tests
|
||||
git clone https://github.com/google/gtest-parallel.git
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- script: |
|
||||
export PATH="/usr/local/opt/cython/bin:$PATH"
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
cmake -GNinja -DVERBOSE_BUILD=ON -DENABLE_REQUIREMENTS_INSTALL=OFF -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_STRICT_DEPENDENCIES=OFF -DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules $(REPO_DIR)
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'CMake'
|
||||
|
||||
- script: ls -alR $(REPO_DIR)/temp/
|
||||
displayName: 'List temp SDKs'
|
||||
|
||||
- script: ninja
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Build Mac'
|
||||
|
||||
- script: ls -alR $(REPO_DIR)/bin/
|
||||
displayName: 'List bin files'
|
||||
|
||||
- script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install'
|
||||
|
||||
- script: ls -alR $(INSTALL_DIR)
|
||||
displayName: 'List install files'
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
mkdir -p $(INSTALL_DIR)/opencv/
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake
|
||||
cp -R $(REPO_DIR)/temp/opencv_4.5.2_osx/opencv/* $(INSTALL_DIR)/opencv/
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install tests'
|
||||
|
||||
- script: ls -alR $(INSTALL_DIR)
|
||||
displayName: 'List install files'
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU*:IE_CPU.onnx_model_sigmoid:IE_CPU/GRUSequenceOp.onnx_model_gru* --gtest_output=xml:TEST-NGraphUT.xml
|
||||
workingDirectory: $(INSTALL_TEST_DIR)
|
||||
displayName: 'OV Core UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_filter=-MKLDNNGraphStructureTests.TestNoRedundantReordersBeforeDWConvolution:TestConvolution/MKLDNNGraphConvolutionTests.TestsConvolution/0:TestConvolutionDefaultPrimitivesPriority/MKLDNNGraphConvolutionTests.TestsConvolution/0 --gtest_output=xml:TEST-InferenceEngineUnitTests.xml
|
||||
displayName: 'IE UT old'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml
|
||||
displayName: 'IE UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml
|
||||
displayName: 'CPU UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml
|
||||
displayName: 'VPU UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml
|
||||
displayName: 'ONNX Importer UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieMultiPluginUnitTests --gtest_output=xml:TEST-ieMultiPluginUnitTests.xml
|
||||
displayName: 'MULTI UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml
|
||||
displayName: 'IE FuncTests'
|
||||
continueOnError: false
|
||||
|
||||
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuFuncTests --gtest_filter=*smoke*:-smoke_LPT/ReduceMinTransformation.CompareWithRefImpl/f32_Shape* --gtest_print_time=1 --gtest_output=xml:TEST-cpuFuncTests.xml
|
||||
displayName: 'CPU FuncTests'
|
||||
continueOnError: false
|
||||
enabled: false
|
||||
|
||||
- script: |
|
||||
export DATA_PATH=$(MODELS_PATH)
|
||||
export MODELS_PATH=$(MODELS_PATH)
|
||||
. $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml
|
||||
displayName: 'IE CAPITests'
|
||||
continueOnError: false
|
||||
|
||||
- task: PublishTestResults@2
|
||||
condition: always()
|
||||
inputs:
|
||||
testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit, cTest
|
||||
testResultsFiles: '**/TEST-*.xml'
|
||||
#searchFolder: '$(BUILD_DIR)'
|
||||
mergeTestResults: false # Optional
|
||||
#failTaskOnFailedTests: false # Optional
|
||||
#testRunTitle: 'Pre/Post-Commit' # Optional
|
||||
buildPlatform: 'x64' # Optional
|
||||
buildConfiguration: 'Mac' # Optional
|
||||
#publishRunAttachments: true # Optional
|
||||
@@ -1,291 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- releases/*
|
||||
paths:
|
||||
exclude:
|
||||
- docs/*
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
- repository: openvino_contrib
|
||||
type: github
|
||||
endpoint: openvinotoolkit
|
||||
name: openvinotoolkit/openvino_contrib
|
||||
|
||||
- repository: testdata
|
||||
type: github
|
||||
endpoint: openvinotoolkit
|
||||
name: openvinotoolkit/testdata
|
||||
|
||||
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
|
||||
|
||||
pool:
|
||||
name: WIN_VMSS_VENV_F8S_WU2
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
VSTS_HTTP_RETRY: 5
|
||||
VSTS_HTTP_TIMEOUT: 200
|
||||
BUILD_TYPE: Release
|
||||
REPO_DIR: $(Build.Repository.LocalPath)
|
||||
OPENVINO_CONTRIB_REPO_DIR: $(REPO_DIR)\..\openvino_contrib
|
||||
MODELS_PATH: $(REPO_DIR)\..\testdata
|
||||
WORK_DIR: $(Pipeline.Workspace)\_w
|
||||
BUILD_DIR: D:\build
|
||||
BUILD_SAMPLES_DIR: D:\build_samples
|
||||
BUILD_SAMPLES_TESTS_DIR: D:\build_samples_tests
|
||||
MSVS_VARS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
|
||||
MSVC_COMPILER_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64\cl.exe
|
||||
INSTALL_DIR: $(WORK_DIR)\install_pkg
|
||||
INSTALL_TEST_DIR: $(INSTALL_DIR)\tests
|
||||
SETUPVARS: $(INSTALL_DIR)\setupvars.bat
|
||||
IB_DIR: C:\Program Files (x86)\IncrediBuild
|
||||
IB_TESTCONSOLE: $(IB_DIR)\IBTestConsole.exe
|
||||
PYTHON_DIR: C:\hostedtoolcache\windows\Python\3.7.6\x64
|
||||
CMAKE_VERSION: 3.21.0
|
||||
CMAKE_CMD: $(WORK_DIR)\cmake-$(CMAKE_VERSION)-windows-x86_64\cmake-$(CMAKE_VERSION)-windows-x86_64\bin\cmake.exe
|
||||
OV_CMAKE_TOOLCHAIN_FILE: $(REPO_DIR)\cmake\toolchains\mt.runtime.win32.toolchain.cmake
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
powershell -command "Invoke-RestMethod -Headers @{\"Metadata\"=\"true\"} -Method GET -Uri http://169.254.169.254/metadata/instance/compute?api-version=2019-06-01 | format-custom"
|
||||
where python3
|
||||
python3 --version
|
||||
where python
|
||||
python --version
|
||||
where java
|
||||
java -version
|
||||
wmic computersystem get TotalPhysicalMemory
|
||||
wmic cpu list
|
||||
wmic logicaldisk get description,name
|
||||
wmic VOLUME list
|
||||
set
|
||||
displayName: 'System info'
|
||||
|
||||
- script: |
|
||||
rd /Q /S $(WORK_DIR) & mkdir $(WORK_DIR)
|
||||
rd /Q /S $(BUILD_DIR) & mkdir $(BUILD_DIR)
|
||||
rd /Q /S $(BUILD_SAMPLES_DIR) & mkdir $(BUILD_SAMPLES_DIR)
|
||||
rd /Q /S $(BUILD_SAMPLES_TESTS_DIR) & mkdir $(BUILD_SAMPLES_TESTS_DIR)
|
||||
displayName: 'Make dir'
|
||||
|
||||
- script: |
|
||||
curl -O https://openvinoweb.z5.web.core.windows.net/incredibuild/install_ib_console.bat
|
||||
call install_ib_console.bat
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install IncrediBuild'
|
||||
|
||||
- checkout: self
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino
|
||||
|
||||
- checkout: openvino_contrib
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino_contrib
|
||||
|
||||
- checkout: testdata
|
||||
clean: true
|
||||
lfs: true
|
||||
path: testdata
|
||||
|
||||
- script: |
|
||||
python -m pip install --upgrade pip
|
||||
rem For running Python API tests
|
||||
python -m pip install -r $(REPO_DIR)\inference-engine\ie_bridges\python\src\requirements-dev.txt
|
||||
python -m pip install -r $(REPO_DIR)\inference-engine\ie_bridges\python\wheel\requirements-dev.txt
|
||||
rem For running Paddle frontend unit tests
|
||||
python -m pip install -r $(REPO_DIR)\src\core\tests\frontend\paddle\requirements_dev.txt
|
||||
rem For running ONNX frontend unit tests
|
||||
python -m pip install -r $(REPO_DIR)\src\core\tests\requirements_test_onnx.txt
|
||||
rem For MO unit tests
|
||||
python -m pip install -r $(REPO_DIR)\tools\mo\requirements.txt
|
||||
python -m pip install -r $(REPO_DIR)\tools\mo\requirements_dev.txt
|
||||
rem Speed up build
|
||||
powershell -command "Invoke-WebRequest https://github.com/Kitware/CMake/releases/download/v$(CMAKE_VERSION)/cmake-$(CMAKE_VERSION)-windows-x86_64.zip -OutFile cmake-$(CMAKE_VERSION)-windows-x86_64.zip"
|
||||
powershell -command "Expand-Archive -Force cmake-$(CMAKE_VERSION)-windows-x86_64.zip"
|
||||
powershell -command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip -OutFile ninja-win.zip"
|
||||
powershell -command "Expand-Archive -Force ninja-win.zip"
|
||||
git clone https://github.com/google/gtest-parallel.git
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- powershell: |
|
||||
Write-Host "##vso[task.setvariable variable=CMAKE_TOOLCHAIN_FILE]$(OV_CMAKE_TOOLCHAIN_FILE)"
|
||||
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
|
||||
displayName: "Set cmake toolchain"
|
||||
|
||||
- script: |
|
||||
set PATH=$(WORK_DIR)\ninja-win;%PATH%
|
||||
call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) -G "Ninja Multi-Config" -DENABLE_ONEDNN_FOR_GPU=OFF -DENABLE_WHEEL=ON -DENABLE_INTEL_GNA=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_INTEL_GPU=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_GAPI_PREPROCESSING=$(CMAKE_BUILD_SHARED_LIBS) -DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS) -DENABLE_REQUIREMENTS_INSTALL=OFF -DENABLE_FASTER_BUILD=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" -DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.7.6\x64\include" -DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.7.6\x64\libs\python37.lib" -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'
|
||||
|
||||
- script: dir $(REPO_DIR)\temp\ /s
|
||||
displayName: 'List temp SDKs'
|
||||
|
||||
- script: |
|
||||
set PATH=$(WORK_DIR)\ninja-win;%PATH%
|
||||
call "$(MSVS_VARS_PATH)" && "C:\Program Files (x86)\IncrediBuild\BuildConsole.exe" /COMMAND="$(CMAKE_CMD) --build . --config Release"
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Build Win - IB'
|
||||
|
||||
- script: dir $(REPO_DIR)\bin\ /s
|
||||
displayName: 'List bin files'
|
||||
|
||||
- script: $(CMAKE_CMD) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install'
|
||||
|
||||
- script: dir $(INSTALL_DIR) /s
|
||||
displayName: 'List install files'
|
||||
|
||||
- script: python -m pip install openvino-dev --find-links=$(INSTALL_DIR)\tools
|
||||
displayName: 'Install Wheels'
|
||||
|
||||
- script: call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR)\tests\samples_tests
|
||||
workingDirectory: $(BUILD_SAMPLES_TESTS_DIR)
|
||||
displayName: 'CMake'
|
||||
|
||||
- script: $(CMAKE_CMD) -DCOMPONENT=tests -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_SAMPLES_TESTS_DIR)
|
||||
displayName: 'Install Samples Tests'
|
||||
|
||||
- script: $(CMAKE_CMD) -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake && xcopy $(REPO_DIR)\temp\opencv_4.5.2\opencv\* $(INSTALL_DIR)\opencv\ /e /h /y
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install tests'
|
||||
|
||||
- script: dir $(INSTALL_DIR) /s
|
||||
displayName: 'List install files'
|
||||
|
||||
- script: $(INSTALL_DIR)\samples\cpp\build_samples_msvc.bat -i $(INSTALL_DIR)
|
||||
workingDirectory: $(BUILD_SAMPLES_DIR)
|
||||
displayName: 'Build cpp samples'
|
||||
continueOnError: false
|
||||
|
||||
- script: $(INSTALL_DIR)\samples\c\build_samples_msvc.bat -i $(INSTALL_DIR)
|
||||
workingDirectory: $(BUILD_SAMPLES_DIR)
|
||||
displayName: 'Build c samples'
|
||||
continueOnError: false
|
||||
|
||||
- script: |
|
||||
python -m pip install -r $(INSTALL_DIR)\tests\smoke_tests\requirements.txt
|
||||
workingDirectory: $(INSTALL_DIR)
|
||||
displayName: 'Install dependencies for samples smoke tests'
|
||||
continueOnError: false
|
||||
|
||||
- script: |
|
||||
call $(SETUPVARS) && set IE_APP_PATH=$(INSTALL_DIR)\samples_bin
|
||||
set IE_APP_PYTHON_PATH=$(INSTALL_DIR)\samples\python\
|
||||
set SHARE=$(INSTALL_DIR)\tests\smoke_tests\samples_smoke_tests_data\
|
||||
set WORKSPACE=$(INSTALL_DIR)
|
||||
python -m pytest $(INSTALL_DIR)\tests\smoke_tests\ --env_conf $(INSTALL_DIR)\tests\smoke_tests\env_config.yml -s --junitxml=TEST-SamplesSmokeTests.xml
|
||||
workingDirectory: $(INSTALL_DIR)
|
||||
displayName: 'Samples Smoke Tests'
|
||||
continueOnError: false
|
||||
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
|
||||
|
||||
- script: rd /Q /S $(BUILD_DIR)
|
||||
displayName: 'Clean build dir'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml
|
||||
workingDirectory: $(INSTALL_TEST_DIR)
|
||||
displayName: 'OV Core UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-Paddle.xml
|
||||
displayName: 'Paddle Frontend UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml
|
||||
displayName: 'Tensorflow Frontend UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: |
|
||||
set PATH=$(IB_DIR);%PATH%
|
||||
call $(SETUPVARS) && "$(IB_TESTCONSOLE)" $(INSTALL_TEST_DIR)\InferenceEngineUnitTests.exe --gtest_output=xml:TEST-InferenceEngineUnitTests-IB.xml
|
||||
displayName: 'IE UT old - IB'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml
|
||||
displayName: 'IE UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml
|
||||
displayName: 'CPU UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml
|
||||
displayName: 'GNA UT'
|
||||
continueOnError: false
|
||||
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml
|
||||
displayName: 'VPU UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml
|
||||
displayName: 'ONNX Importer UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieMultiPluginUnitTests --gtest_output=xml:TEST-ieMultiPluginUnitTests.xml
|
||||
displayName: 'MULTI UT'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml
|
||||
displayName: 'IE FuncTests'
|
||||
continueOnError: false
|
||||
|
||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_template_func_tests --gtest_output=xml:TEST-templateFuncTests.xml
|
||||
displayName: 'TEMPLATE FuncTests'
|
||||
continueOnError: false
|
||||
|
||||
# call $(SETUPVARS) && $(INSTALL_TEST_DIR)\cpuFuncTests.exe --gtest_filter=*smoke* --gtest_output=xml:TEST-cpuFuncTests.xml
|
||||
- script: |
|
||||
set PATH=$(IB_DIR);%PATH%
|
||||
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)
|
||||
set MODELS_PATH=$(MODELS_PATH)
|
||||
call $(SETUPVARS) && $(INSTALL_TEST_DIR)\InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml
|
||||
displayName: 'IE CAPITests'
|
||||
continueOnError: false
|
||||
|
||||
- task: PublishTestResults@2
|
||||
condition: always()
|
||||
inputs:
|
||||
testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit, cTest
|
||||
testResultsFiles: '**/TEST-*.xml'
|
||||
#searchFolder: '$(BUILD_DIR)'
|
||||
mergeTestResults: false # Optional
|
||||
#failTaskOnFailedTests: false # Optional
|
||||
#testRunTitle: 'Pre/Post-Commit' # Optional
|
||||
buildPlatform: 'x64' # Optional
|
||||
buildConfiguration: 'Windows' # Optional
|
||||
#publishRunAttachments: true # Optional
|
||||
|
||||
- script: echo Stop IncrediBuild_Agent && net stop IncrediBuild_Agent
|
||||
displayName: Stop IncrediBuild
|
||||
continueOnError: true
|
||||
enabled: false
|
||||
@@ -1,88 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- releases/*
|
||||
paths:
|
||||
exclude:
|
||||
- docs/*
|
||||
|
||||
jobs:
|
||||
- job: WinCC
|
||||
# About 150% of total time
|
||||
timeoutInMinutes: 60
|
||||
|
||||
pool:
|
||||
name: WIN_VMSS_VENV_F8S_WU2
|
||||
|
||||
variables:
|
||||
system.debug: true
|
||||
VSTS_HTTP_RETRY: 5
|
||||
VSTS_HTTP_TIMEOUT: 200
|
||||
BUILD_TYPE: Release
|
||||
REPO_DIR: $(Build.Repository.LocalPath)
|
||||
OPENVINO_CONTRIB_REPO_DIR: $(REPO_DIR)\..\openvino_contrib
|
||||
MODELS_PATH: $(REPO_DIR)\..\testdata
|
||||
WORK_DIR: $(Pipeline.Workspace)\_w
|
||||
BUILD_DIR: D:\build
|
||||
MSVS_VARS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
|
||||
MSVC_COMPILER_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64\cl.exe
|
||||
INSTALL_DIR: $(WORK_DIR)\install_pkg
|
||||
SETUPVARS: $(INSTALL_DIR)\setupvars.bat
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
powershell -command "Invoke-RestMethod -Headers @{\"Metadata\"=\"true\"} -Method GET -Uri http://169.254.169.254/metadata/instance/compute?api-version=2019-06-01 | format-custom"
|
||||
where python3
|
||||
python3 --version
|
||||
where python
|
||||
python --version
|
||||
where java
|
||||
java -version
|
||||
wmic computersystem get TotalPhysicalMemory
|
||||
wmic cpu list
|
||||
wmic logicaldisk get description,name
|
||||
wmic VOLUME list
|
||||
set
|
||||
displayName: 'System info'
|
||||
|
||||
- script: |
|
||||
rd /Q /S $(WORK_DIR) & mkdir $(WORK_DIR)
|
||||
rd /Q /S $(BUILD_DIR) & mkdir $(BUILD_DIR)
|
||||
displayName: 'Make dir'
|
||||
|
||||
- checkout: self
|
||||
clean: true
|
||||
lfs: false
|
||||
submodules: recursive
|
||||
path: openvino
|
||||
|
||||
- script: |
|
||||
rem Speed up build
|
||||
powershell -command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip -OutFile ninja-win.zip"
|
||||
powershell -command "Expand-Archive -Force ninja-win.zip"
|
||||
workingDirectory: $(WORK_DIR)
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- script: |
|
||||
set PATH=$(WORK_DIR)\ninja-win;%PATH%
|
||||
call "$(MSVS_VARS_PATH)" && cmake -GNinja -DENABLE_FASTER_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(REPO_DIR)
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'CMake'
|
||||
|
||||
- script: dir $(REPO_DIR)\temp\ /s
|
||||
displayName: 'List temp SDKs'
|
||||
|
||||
- script: call "$(MSVS_VARS_PATH)" && $(WORK_DIR)\ninja-win\ninja
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Build Win CC'
|
||||
|
||||
- script: dir $(REPO_DIR)\bin\ /s
|
||||
displayName: 'List bin files'
|
||||
|
||||
- script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -P cmake_install.cmake
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
displayName: 'Install'
|
||||
|
||||
- script: dir $(INSTALL_DIR) /s
|
||||
displayName: 'List install files'
|
||||
@@ -1,79 +0,0 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
LABEL version=2021.03.30.1
|
||||
|
||||
# Build configuration arguments
|
||||
ARG BUILD_TYPE=Release
|
||||
|
||||
ARG http_proxy
|
||||
ARG https_proxy
|
||||
ENV http_proxy ${http_proxy}
|
||||
ENV https_proxy ${https_proxy}
|
||||
|
||||
ENV CI=true
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# Install base dependencies
|
||||
RUN apt-get update && apt-get install -y locales && apt-get clean autoclean && apt-get autoremove -y
|
||||
|
||||
# Set the locale to en_US.UTF-8
|
||||
RUN locale-gen en_US.UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
||||
RUN apt-get update && apt-get -y --no-install-recommends install \
|
||||
# OpenVINO dependencies
|
||||
autoconf \
|
||||
automake \
|
||||
build-essential \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
libtool \
|
||||
ocl-icd-opencl-dev \
|
||||
pkg-config \
|
||||
unzip \
|
||||
wget \
|
||||
# Python dependencies
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-dev \
|
||||
python3-virtualenv \
|
||||
cython3 \
|
||||
tox \
|
||||
# ONNX dependencies
|
||||
git-lfs \
|
||||
protobuf-compiler \
|
||||
libprotobuf-dev && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
# Build OpenVINO
|
||||
COPY . /openvino/
|
||||
WORKDIR /openvino/build
|
||||
RUN cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||
-DENABLE_VPU=OFF \
|
||||
-DENABLE_INTEL_GNA=OFF \
|
||||
-DENABLE_OPENCV=OFF \
|
||||
-DENABLE_CPPLINT=OFF \
|
||||
-DENABLE_TESTS=OFF \
|
||||
-DENABLE_INTEL_CPU=ON \
|
||||
-DENABLE_INTEL_GPU=OFF \
|
||||
-DENABLE_PROFILING_ITT=OFF \
|
||||
-DENABLE_SAMPLES=OFF \
|
||||
-DENABLE_PYTHON=ON \
|
||||
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
|
||||
-DENABLE_OV_ONNX_FRONTEND=ON \
|
||||
-DENABLE_OPENVINO_DEBUG=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=/openvino/dist
|
||||
RUN make -j $(nproc) install
|
||||
|
||||
# Run tests via tox
|
||||
WORKDIR /openvino/src/bindings/python
|
||||
ENV OpenVINO_DIR=/openvino/dist/runtime/cmake
|
||||
ENV LD_LIBRARY_PATH=/openvino/dist/runtime/lib:/openvino/dist/runtime/3rdparty/tbb/lib
|
||||
ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/lib/python_api/python3.8:${PYTHONPATH}
|
||||
CMD tox
|
||||
213
.ci/openvino-onnx/Jenkinsfile
vendored
213
.ci/openvino-onnx/Jenkinsfile
vendored
@@ -1,213 +0,0 @@
|
||||
// Copyright (C) 2018-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
DOCKER_CONTAINER_NAME= "openvino-onnx-ci-container"
|
||||
DOCKER_IMAGE_TAG = "openvino-onnx-ci-image"
|
||||
ONNX_MODEL_ZOO_SHA = "d58213534f2a4d1c4b19ba62b3bb5f544353256e"
|
||||
|
||||
BACKEND_CONFIGURATIONS = [
|
||||
[ name: "Release", build_type: "Release" ],
|
||||
[ name: "Debug", build_type: "Debug" ],
|
||||
]
|
||||
|
||||
// workaround for aborting previous builds on PR update
|
||||
@NonCPS
|
||||
def stopPreviousRunningBuilds() {
|
||||
def jobname = env.JOB_NAME
|
||||
if (jobname.startsWith("onnx-ci/openvino onnx ci/openvino/PR")){
|
||||
def buildnum = env.BUILD_NUMBER.toInteger()
|
||||
def job = Jenkins.instance.getItemByFullName(jobname)
|
||||
def job_newest = job.builds.first()
|
||||
for (build in job.builds.reverse()[0..<-1]) {
|
||||
if (build.isBuilding()){
|
||||
echo "Stop task = ${build} because newest #${job_newest} is on the way"
|
||||
build.doStop();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def getGitPrInfo(String project, String workdir) {
|
||||
def gitPrInfo = [
|
||||
prAuthorEmail : "",
|
||||
commitAuthorEmail : "",
|
||||
commitHash : "",
|
||||
commitSubject : ""
|
||||
]
|
||||
try {
|
||||
dir ("${workdir}/${project}") {
|
||||
gitPrInfo.prAuthorEmail = sh (script: 'git log -1 --pretty="format:%ae" ', returnStdout: true).trim()
|
||||
gitPrInfo.commitAuthorEmail = sh (script: 'git log -1 --pretty="format:%ce" ', returnStdout: true).trim()
|
||||
gitPrInfo.commitSubject = sh (script: 'git log -1 --pretty="format:%H" ', returnStdout: true).trim()
|
||||
gitPrInfo.commitHash = sh (script: 'git log -1 --pretty="format:%s" ', returnStdout: true).trim()
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
echo "Failed to retrieve ${project} git repository information!"
|
||||
echo "ERROR: ${e}"
|
||||
}
|
||||
return gitPrInfo
|
||||
}
|
||||
|
||||
def notifyByEmail(def gitPrInfo) {
|
||||
stage('Notify') {
|
||||
String notifyPeople = "${gitPrInfo.prAuthorEmail}, ${gitPrInfo.commitAuthorEmail}"
|
||||
emailext (
|
||||
subject: "OpenVino CI: PR ${CHANGE_ID} ${currentBuild.result}!",
|
||||
body: """
|
||||
Status: ${currentBuild.result}
|
||||
Pull Request Title: ${CHANGE_TITLE}
|
||||
Pull Request: ${CHANGE_URL}
|
||||
Branch: ${CHANGE_BRANCH}
|
||||
Commit Hash: ${gitPrInfo.commitSubject}
|
||||
Commit Subject: ${gitPrInfo.commitHash}
|
||||
Jenkins Build: ${RUN_DISPLAY_URL}
|
||||
""",
|
||||
to: "${notifyPeople}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
def gitSubmoduleUpdate(String repository_name, String workdir) {
|
||||
dir ("${workdir}/${repository_name}") {
|
||||
sh label: "Init ${repository_name} submodules",
|
||||
script:
|
||||
"""
|
||||
git submodule init && git submodule update \
|
||||
--init \
|
||||
--no-fetch \
|
||||
--recursive
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def prepare_repository(String workdir) {
|
||||
dir("${workdir}") {
|
||||
println "Preparing repository in directory: ${workdir}"
|
||||
checkout scm
|
||||
gitSubmoduleUpdate(PROJECT_NAME, workdir)
|
||||
}
|
||||
}
|
||||
|
||||
def updateModels() {
|
||||
sh """
|
||||
./src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh -d ${HOME}/ONNX_CI/models_data -o -s ${ONNX_MODEL_ZOO_SHA}
|
||||
"""
|
||||
}
|
||||
|
||||
def get_docker_container_name(Map configuration){
|
||||
println "RUN get_docker_container_name for ${configuration.name}"
|
||||
String docker_container_name = "${DOCKER_CONTAINER_NAME}_${BUILD_NUMBER}_${env.CHANGE_ID}_${configuration.name}"
|
||||
return docker_container_name
|
||||
}
|
||||
|
||||
def buildDockerImage(Map configuration, String workdir) {
|
||||
String docker_image_tag = "${DOCKER_IMAGE_TAG}_${BUILD_NUMBER}_${env.CHANGE_ID}_${configuration.name}".toLowerCase()
|
||||
println "docker_image_tag: ${docker_image_tag}"
|
||||
updateModels()
|
||||
sh """
|
||||
docker build --tag=${docker_image_tag} \
|
||||
--build-arg BUILD_TYPE=${configuration.build_type} \
|
||||
--file=.ci/openvino-onnx/Dockerfile \
|
||||
--build-arg http_proxy=${HTTP_PROXY} \
|
||||
--build-arg https_proxy=${HTTPS_PROXY} .
|
||||
"""
|
||||
}
|
||||
|
||||
def runTests(Map configuration, String workdir) {
|
||||
println "Run tests for ${configuration.name}"
|
||||
String docker_image_tag = "${DOCKER_IMAGE_TAG}_${BUILD_NUMBER}_${env.CHANGE_ID}_${configuration.name}".toLowerCase()
|
||||
|
||||
String docker_container_name = get_docker_container_name(configuration)
|
||||
|
||||
// Run only basic unit tests in Debug configuration
|
||||
if (configuration.build_type == "Debug") {
|
||||
sh """
|
||||
docker run --name ${docker_container_name} ${docker_image_tag}
|
||||
"""
|
||||
}
|
||||
|
||||
// Run unit-tests AND large model tests by default
|
||||
else {
|
||||
sh """
|
||||
docker run --name ${docker_container_name} \
|
||||
--volume ${HOME}/ONNX_CI/models_data/model_zoo/onnx_model_zoo_${ONNX_MODEL_ZOO_SHA}:/root/.onnx/model_zoo/onnx_model_zoo \
|
||||
--volume ${HOME}/ONNX_CI/data/model_zoo/MSFT:/root/.onnx/model_zoo/MSFT \
|
||||
${docker_image_tag} /bin/bash -c "tox && tox -e zoo_models"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def getConfigurationsMap() {
|
||||
def configurationsMap = [:]
|
||||
for (backend in BACKEND_CONFIGURATIONS) {
|
||||
def configuration = backend.clone()
|
||||
configurationsMap[configuration.name] = {
|
||||
stage(configuration.name) { CONFIGURATION_WORKFLOW(configuration) }
|
||||
}
|
||||
}
|
||||
return configurationsMap
|
||||
}
|
||||
|
||||
CONFIGURATION_WORKFLOW = { configuration ->
|
||||
node("OpenVINO") {
|
||||
String workdir = "${HOME}/workspace/${BUILD_NUMBER}_${env.CHANGE_ID}_${configuration.name}"
|
||||
try {
|
||||
PROJECT_NAME = "openvino"
|
||||
stage("Clone repository") {
|
||||
prepare_repository(workdir)
|
||||
}
|
||||
stage("Prepare Docker environment") {
|
||||
dir("${workdir}") {
|
||||
buildDockerImage(configuration, workdir)
|
||||
}
|
||||
}
|
||||
stage("Run tests") {
|
||||
timeout(time: 60, unit: 'MINUTES') {
|
||||
runTests(configuration, workdir)
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
// Set result to ABORTED if exception contains exit code of a process interrupted by SIGTERM
|
||||
if ("$e".contains("143")) {
|
||||
currentBuild.result = "ABORTED"
|
||||
} else {
|
||||
currentBuild.result = "FAILURE"
|
||||
}
|
||||
def gitPrInfo = getGitPrInfo(PROJECT_NAME, workdir)
|
||||
notifyByEmail(gitPrInfo)
|
||||
}
|
||||
finally {
|
||||
stage("Cleanup") {
|
||||
String docker_container_name = get_docker_container_name(configuration)
|
||||
sh """
|
||||
docker rm -f ${docker_container_name}
|
||||
rm -rf ${workdir}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent none
|
||||
options {
|
||||
skipDefaultCheckout true
|
||||
timeout(activity: true, time: 120, unit: 'MINUTES')
|
||||
}
|
||||
stages {
|
||||
stage('Parallel CI') {
|
||||
steps {
|
||||
stopPreviousRunningBuilds()
|
||||
script {
|
||||
parallelStagesMap = getConfigurationsMap()
|
||||
parallel parallelStagesMap
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
65
.ci/openvino-onnx/watchdog/Jenkinsfile
vendored
65
.ci/openvino-onnx/watchdog/Jenkinsfile
vendored
@@ -1,65 +0,0 @@
|
||||
// Copyright (C) 2018-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
timeout(30)
|
||||
{
|
||||
node(LABEL) {
|
||||
|
||||
BUILD_WORKSPACE = "$WORKSPACE/$BUILD_NUMBER"
|
||||
WATCHDOG_ROOT = "$BUILD_WORKSPACE/.ci/openvino-onnx/watchdog"
|
||||
VENV_PATH = "${BUILD_WORKSPACE}/.wdvenv"
|
||||
|
||||
try {
|
||||
stage("Clone repository") {
|
||||
dir ("$BUILD_WORKSPACE") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "*/$BRANCH"]],
|
||||
doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', timeout: 30]], submoduleCfg: [],
|
||||
userRemoteConfigs: [[credentialsId: "${GITHUB_KEY}", url: "${OPEN_VINO_URL}"]]])
|
||||
}
|
||||
}
|
||||
stage("Prepare environment") {
|
||||
sh """#!/bin/bash
|
||||
if [ ! -d ${VENV_PATH} ]; then
|
||||
python3 -m venv ${VENV_PATH}
|
||||
source ${VENV_PATH}/bin/activate
|
||||
pip install -r ${WATCHDOG_ROOT}/requirements.txt
|
||||
fi
|
||||
"""
|
||||
}
|
||||
stage("Run script") {
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: '7157091e-bc04-42f0-99fd-dc4da2922a55',
|
||||
usernameVariable: 'username',
|
||||
passwordVariable: 'password')])
|
||||
{
|
||||
dir ("$BUILD_WORKSPACE") {
|
||||
sh """#!/bin/bash
|
||||
source ${VENV_PATH}/bin/activate
|
||||
export PYTHONHTTPSVERIFY=0
|
||||
python ${WATCHDOG_ROOT}/src/main.py \
|
||||
--msteams-url=${MSTEAMS_URL_FILE} \
|
||||
--github-credentials '${username}' '${password}' \
|
||||
--github-org=${GITHUB_ORG} \
|
||||
--github-project=${GITHUB_PROJECT} \
|
||||
--jenkins-token=${JENKINS_TOKEN_FILE} \
|
||||
--jenkins-server=${JENKINS_SERVER} \
|
||||
--jenkins-user=${JENKINS_USER} \
|
||||
--ci-job=${CI_JOB_NAME} \
|
||||
--watchdog-job=${WATCHDOG_JOB_NAME}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
echo "$e"
|
||||
currentBuild.result = "FAILURE"
|
||||
} finally {
|
||||
stage("Cleanup") {
|
||||
sh """
|
||||
cd $BUILD_WORKSPACE
|
||||
rm -rf ..?* .[!.]* *
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
python-jenkins==1.7.0
|
||||
retrying==1.3.3
|
||||
pygithub==1.51
|
||||
timeout-decorator==0.4.1
|
||||
requests==2.23.0
|
||||
wheel
|
||||
@@ -1,108 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import logging
|
||||
import timeout_decorator
|
||||
from datetime import datetime
|
||||
from retrying import retry
|
||||
from github import Github, GithubException
|
||||
|
||||
# Logging
|
||||
logging.basicConfig(format='%(name)s - %(levelname)s - %(message)s')
|
||||
log = logging.getLogger(__name__)
|
||||
log.setLevel(logging.INFO)
|
||||
|
||||
_RETRY_LIMIT = 3
|
||||
_RETRY_COOLDOWN_MS = 2000
|
||||
_REQUEST_TIMEOUT_S = 10
|
||||
|
||||
|
||||
class GitWrapper:
|
||||
"""Class wrapping PyGithub API.
|
||||
|
||||
The purpose of this class is to wrap methods from PyGithub API used in Watchdog, for less error-prone and
|
||||
more convenient use. Docs for used API, including wrapped methods can be found at:
|
||||
https://pygithub.readthedocs.io/en/latest/introduction.html
|
||||
|
||||
:param github_credentials: Credentials used for GitHub
|
||||
:param repository: GitHub repository name
|
||||
:param project: GitHub project name
|
||||
:type github_credentials: String
|
||||
:type repository: String
|
||||
:type project: String
|
||||
"""
|
||||
|
||||
def __init__(self, github_credentials, repository, project):
|
||||
self.git = Github(*github_credentials)
|
||||
self.repository = repository
|
||||
self.project = project
|
||||
self.github_credentials = github_credentials
|
||||
|
||||
@retry(stop_max_attempt_number=_RETRY_LIMIT, wait_fixed=_RETRY_COOLDOWN_MS)
|
||||
def get_git_time(self):
|
||||
"""Retrieve time from GitHub.
|
||||
|
||||
Used to reliably determine time during Watchdog run.
|
||||
|
||||
:return: Datetime object describing current time
|
||||
:rtype: datetime
|
||||
"""
|
||||
try:
|
||||
datetime_object = self._get_git_time()
|
||||
except ValueError as e:
|
||||
raise GitWrapperError(str(e))
|
||||
except GithubException as e:
|
||||
message = 'GitHub Exception during API status retrieval. Exception: {}'.format(str(e))
|
||||
raise GitWrapperError(message)
|
||||
except timeout_decorator.TimeoutError:
|
||||
message = 'GitHub Exception during API status retrieval. Timeout during API request.'
|
||||
raise GitWrapperError(message)
|
||||
return datetime_object
|
||||
|
||||
@retry(stop_max_attempt_number=_RETRY_LIMIT, wait_fixed=_RETRY_COOLDOWN_MS)
|
||||
def get_pull_requests(self):
|
||||
"""Retrieve paginated list of pull requests from GitHub.
|
||||
|
||||
:return: Paginated list of Pull Requests in GitHub repo
|
||||
:rtype: github.PaginatedList.PaginatedList of github.PullRequest.PullRequest
|
||||
"""
|
||||
try:
|
||||
prs = self._get_pull_requests()
|
||||
except GithubException as e:
|
||||
message = 'GitHub Exception during API status retrieval. Exception: {}'.format(str(e))
|
||||
raise GitWrapperError(message)
|
||||
return prs
|
||||
|
||||
@timeout_decorator.timeout(_REQUEST_TIMEOUT_S)
|
||||
def _get_git_time(self):
|
||||
"""Private method retrieving time from GitHub.
|
||||
|
||||
:return: Datetime object describing current time
|
||||
:rtype: datetime
|
||||
"""
|
||||
datetime_string = self.git.get_api_status().raw_headers.get('date', '')
|
||||
datetime_format = '%a, %d %b %Y %H:%M:%S %Z'
|
||||
datetime_object = datetime.strptime(datetime_string, datetime_format)
|
||||
return datetime_object
|
||||
|
||||
@timeout_decorator.timeout(_REQUEST_TIMEOUT_S)
|
||||
def _get_pull_requests(self):
|
||||
"""Private method retrieving pull requests from GitHub.
|
||||
|
||||
:return: Paginated list of Pull Requests in GitHub repo
|
||||
:rtype: github.PaginatedList.PaginatedList of github.PullRequest.PullRequest
|
||||
"""
|
||||
return self.git.get_organization(self.repository).get_repo(self.project).get_pulls()
|
||||
|
||||
|
||||
class GitWrapperError(Exception):
|
||||
"""Base class for exceptions raised in GitWrapper.
|
||||
|
||||
:param message Explanation of the error
|
||||
"""
|
||||
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
log.exception(message)
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import requests
|
||||
import jenkins
|
||||
import logging
|
||||
from retrying import retry
|
||||
|
||||
# Logging
|
||||
logging.basicConfig(format='%(name)s - %(levelname)s - %(message)s')
|
||||
log = logging.getLogger(__name__)
|
||||
log.setLevel(logging.INFO)
|
||||
|
||||
_RETRY_LIMIT = 3
|
||||
_RETRY_COOLDOWN_MS = 5000
|
||||
|
||||
|
||||
class JenkinsWrapper:
|
||||
"""Class wrapping Python-Jenkins API.
|
||||
|
||||
The purpose of this class is to wrap methods from Python-Jenkins API used in Watchdog, for less error-prone and
|
||||
more convenient use. Docs for used API, including wrapped methods can be found at:
|
||||
https://python-jenkins.readthedocs.io/en/latest/
|
||||
|
||||
:param jenkins_token: Token used for Jenkins
|
||||
:param jenkins_user: Username used to connect to Jenkins
|
||||
:param jenkins_server: Jenkins server address
|
||||
:type jenkins_token: String
|
||||
:type jenkins_user: String
|
||||
:type jenkins_server: String
|
||||
"""
|
||||
|
||||
def __init__(self, jenkins_token, jenkins_user, jenkins_server):
|
||||
self.jenkins_server = jenkins_server
|
||||
self.jenkins = jenkins.Jenkins(jenkins_server, username=jenkins_user,
|
||||
password=jenkins_token)
|
||||
|
||||
@retry(stop_max_attempt_number=_RETRY_LIMIT, wait_fixed=_RETRY_COOLDOWN_MS)
|
||||
def get_build_console_output(self, job_name, build_number):
|
||||
return self.jenkins.get_build_console_output(job_name, build_number)
|
||||
|
||||
@retry(stop_max_attempt_number=_RETRY_LIMIT, wait_fixed=_RETRY_COOLDOWN_MS)
|
||||
def get_job_info(self, job_name):
|
||||
return self.jenkins.get_job_info(job_name)
|
||||
|
||||
@retry(stop_max_attempt_number=_RETRY_LIMIT, wait_fixed=_RETRY_COOLDOWN_MS)
|
||||
def get_build_info(self, job_name, build_number):
|
||||
return self.jenkins.get_build_info(job_name, build_number)
|
||||
|
||||
@retry(stop_max_attempt_number=_RETRY_LIMIT, wait_fixed=_RETRY_COOLDOWN_MS)
|
||||
def get_queue_item(self, queue_id):
|
||||
"""Attempt to retrieve Jenkins job queue item.
|
||||
|
||||
Exception communicating queue doesn't exist is expected,
|
||||
in that case method returns empty dict.
|
||||
|
||||
:param queue_id: Jenkins job queue ID number
|
||||
:type queue_id: int
|
||||
:return: Dictionary representing Jenkins job queue item
|
||||
:rtype: dict
|
||||
"""
|
||||
try:
|
||||
return self.jenkins.get_queue_item(queue_id)
|
||||
except Exception as e:
|
||||
# Exception 'queue does not exist' is expected behaviour when job is running
|
||||
if 'queue' in str(e) and 'does not exist' in str(e):
|
||||
return {}
|
||||
else:
|
||||
raise
|
||||
|
||||
@retry(stop_max_attempt_number=_RETRY_LIMIT, wait_fixed=_RETRY_COOLDOWN_MS)
|
||||
def get_idle_ci_hosts(self):
|
||||
"""Query Jenkins for idle servers.
|
||||
|
||||
Send GET request to Jenkins server, querying for idle servers labeled
|
||||
for OpenVino-ONNX CI job.
|
||||
|
||||
:return: Number of idle hosts delegated to OpenVino-ONNX CI
|
||||
:rtype: int
|
||||
"""
|
||||
jenkins_request_url = self.jenkins_server + 'label/ci&&onnx/api/json?pretty=true'
|
||||
try:
|
||||
log.info('Sending request to Jenkins: %s', jenkins_request_url)
|
||||
r = requests.Request(method='GET', url=jenkins_request_url, verify=False)
|
||||
response = self.jenkins.jenkins_request(r).json()
|
||||
return int(response['totalExecutors']) - int(response['busyExecutors'])
|
||||
except Exception as e:
|
||||
log.exception('Failed to send request to Jenkins!\nException message: %s', str(e))
|
||||
raise
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from watchdog import Watchdog
|
||||
|
||||
DEFAULT_MSTEAMS_URL_FILE = '/home/lab_nerval/tokens/msteams_url'
|
||||
DEFAULT_GITHUB_ORGANIZATION = 'openvinotoolkit'
|
||||
DEFAULT_GITHUB_PROJECT = 'openvino'
|
||||
DEFAULT_JENKINS_TOKEN_FILE = '/home/lab_nerval/tokens/crackerjack'
|
||||
DEFAULT_JENKINS_SERVER = 'https://crackerjack.intel.com/'
|
||||
DEFAULT_JENKINS_USER = 'lab_nerval'
|
||||
DEFAULT_CI_JOB_NAME = 'onnx/OpenVino_CI'
|
||||
DEFAULT_WATCHDOG_JOB_NAME = 'onnx/ci_watchdog'
|
||||
|
||||
|
||||
def main(args):
|
||||
"""
|
||||
Read args passed to script, load tokens and run watchdog.
|
||||
|
||||
Keyword arguments:
|
||||
:param args: arguments parsed by argparse ArgumentParser
|
||||
|
||||
:return: returns status code 0 on successful completion
|
||||
|
||||
"""
|
||||
jenkins_server = args.jenkins_server.strip()
|
||||
jenkins_user = args.jenkins_user.strip()
|
||||
jenkins_token = open(args.jenkins_token).read().replace('\n', '').strip()
|
||||
msteams_url = open(args.msteams_url).read().replace('\n', '').strip()
|
||||
github_credentials = args.github_credentials
|
||||
github_org = args.github_org
|
||||
github_project = args.github_project
|
||||
ci_job = args.ci_job.strip()
|
||||
watchdog_job = args.watchdog_job.strip()
|
||||
quiet = args.quiet
|
||||
|
||||
wd = Watchdog(jenkins_token=jenkins_token,
|
||||
jenkins_server=jenkins_server,
|
||||
jenkins_user=jenkins_user,
|
||||
github_credentials=github_credentials,
|
||||
git_org=github_org,
|
||||
git_project=github_project,
|
||||
msteams_url=msteams_url,
|
||||
ci_job_name=ci_job,
|
||||
watchdog_job_name=watchdog_job)
|
||||
wd.run(quiet=quiet)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument('--msteams-url', help='Path to MS Teams channel url to communicate messages.',
|
||||
default=DEFAULT_MSTEAMS_URL_FILE, action='store', required=False)
|
||||
|
||||
parser.add_argument('--github-credentials', help='GitHub user credentials to access repo.',
|
||||
nargs="+", required=True)
|
||||
|
||||
parser.add_argument('--github-org', help='Name of organization on GitHub.',
|
||||
default=DEFAULT_GITHUB_ORGANIZATION, action='store', required=False)
|
||||
|
||||
parser.add_argument('--github-project', help='Name of project on GitHub.',
|
||||
default=DEFAULT_GITHUB_PROJECT, action='store', required=False)
|
||||
|
||||
parser.add_argument('--jenkins-token', help='Path to Jenkins user token to access build info.',
|
||||
default=DEFAULT_JENKINS_TOKEN_FILE, action='store', required=False)
|
||||
|
||||
parser.add_argument('--jenkins-server', help='Jenkins server address.',
|
||||
default=DEFAULT_JENKINS_SERVER, action='store', required=False)
|
||||
|
||||
parser.add_argument('--jenkins-user', help='Jenkins user used to log in.',
|
||||
default=DEFAULT_JENKINS_USER, action='store', required=False)
|
||||
|
||||
parser.add_argument('--ci-job', help='Jenkins CI job name.',
|
||||
default=DEFAULT_CI_JOB_NAME, action='store', required=False)
|
||||
|
||||
parser.add_argument('--watchdog-job', help='Jenkins CI Watchdog job name.',
|
||||
default=DEFAULT_WATCHDOG_JOB_NAME, action='store', required=False)
|
||||
|
||||
parser.add_argument('--quiet', help="Quiet mode - doesn\'t send message to communicator.",
|
||||
action='store_true', required=False)
|
||||
|
||||
args = parser.parse_args()
|
||||
sys.exit(main(args))
|
||||
@@ -1,128 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class MSTeamsCommunicator:
|
||||
"""Class communicating with MSTeams using Incoming Webhook.
|
||||
|
||||
The purpose of this class is to use MSTeams API to send message.
|
||||
Docs for used API, including wrapped methods can be found at:
|
||||
https://docs.microsoft.com/en-us/outlook/actionable-messages/send-via-connectors
|
||||
"""
|
||||
|
||||
def __init__(self, _ci_alerts_channel_url):
|
||||
self._ci_alerts_channel_url = _ci_alerts_channel_url
|
||||
self._queued_messages = {
|
||||
self._ci_alerts_channel_url: [],
|
||||
}
|
||||
|
||||
@property
|
||||
def messages(self):
|
||||
"""
|
||||
Get list of queued messages.
|
||||
|
||||
:return: List of queued messages
|
||||
:return type: List[String]
|
||||
"""
|
||||
return self._queued_messages.values()
|
||||
|
||||
def queue_message(self, message):
|
||||
"""
|
||||
Queue message to be sent later.
|
||||
|
||||
:param message: Message content
|
||||
:type message: String
|
||||
"""
|
||||
self._queued_messages[self._ci_alerts_channel_url].append(message)
|
||||
|
||||
def _parse_text(self, watchdog_log, message):
|
||||
"""
|
||||
Parse text to display as alert.
|
||||
|
||||
:param watchdog_log: Watchdog log content
|
||||
:param message: Unparsed message content
|
||||
:type watchdog_log: String
|
||||
:type message: String
|
||||
"""
|
||||
message_split = message.split('\n')
|
||||
log_url = None
|
||||
if len(message_split) == 3:
|
||||
log_url = message_split[-1]
|
||||
title = message_split[0]
|
||||
text = message_split[1]
|
||||
header = watchdog_log.split(' - ')
|
||||
header_formatted = '{} - [Watchdog Log]({})'.format(header[0], header[1])
|
||||
return title, log_url, '{}\n\n{}'.format(header_formatted, text)
|
||||
|
||||
def _json_request_content(self, title, log_url, text_formatted):
|
||||
"""
|
||||
Create final json request to send message to MS Teams channel.
|
||||
|
||||
:param title: Title of alert
|
||||
:param log_url: URL to PR
|
||||
:param text_formatted: General content of alert - finally formatted
|
||||
:type title: String
|
||||
:type title: String
|
||||
:type title: String
|
||||
"""
|
||||
data = {
|
||||
'@context': 'https://schema.org/extensions',
|
||||
'@type': 'MessageCard',
|
||||
'themeColor': '0072C6',
|
||||
'title': title,
|
||||
'text': text_formatted,
|
||||
'potentialAction':
|
||||
[
|
||||
{
|
||||
'@type': 'OpenUri',
|
||||
'name': 'Open PR',
|
||||
'targets':
|
||||
[
|
||||
{
|
||||
'os': 'default',
|
||||
'uri': log_url,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
return data
|
||||
|
||||
def _send_to_channel(self, watchdog_log, message_queue, channel_url):
|
||||
"""
|
||||
Send MSTeams message to specified channel.
|
||||
|
||||
:param watchdog_log: Watchdog log content
|
||||
:param message_queue: Queued messages to send
|
||||
:param channel_url: Channel url
|
||||
:type watchdog_log: String
|
||||
:type message_queue: String
|
||||
:type channel_url: String
|
||||
|
||||
"""
|
||||
for message in message_queue:
|
||||
title, log_url, text_formatted = self._parse_text(watchdog_log, message)
|
||||
data = self._json_request_content(title, log_url, text_formatted)
|
||||
|
||||
try:
|
||||
requests.post(url=channel_url, json=data)
|
||||
except Exception as ex:
|
||||
raise Exception('!!CRITICAL!! MSTeamsCommunicator: Could not send message '
|
||||
'due to {}'.format(ex))
|
||||
|
||||
def send_message(self, watchdog_log, quiet=False):
|
||||
"""
|
||||
Send queued messages as single communication.
|
||||
|
||||
:param watchdog_log: Watchdog log content
|
||||
:param quiet: Flag for disabling sending report through MS Teams
|
||||
:type watchdog_log: String
|
||||
:type quiet: Boolean
|
||||
"""
|
||||
for channel, message_queue in self._queued_messages.items():
|
||||
if not quiet and message_queue:
|
||||
self._send_to_channel(watchdog_log, message_queue, channel)
|
||||
@@ -1,505 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import datetime
|
||||
import time
|
||||
import re
|
||||
import logging
|
||||
import requests
|
||||
from ms_teams_communicator import MSTeamsCommunicator
|
||||
from jenkins_wrapper import JenkinsWrapper
|
||||
from jenkins import NotFoundException
|
||||
from git_wrapper import GitWrapper, GitWrapperError
|
||||
import os
|
||||
import json
|
||||
|
||||
# Logging
|
||||
logging.basicConfig(format='%(name)s - %(levelname)s - %(message)s')
|
||||
log = logging.getLogger(__name__)
|
||||
log.setLevel(logging.INFO)
|
||||
|
||||
# Watchdog static constant variables
|
||||
_SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
_BUILD_DURATION_THRESHOLD = datetime.timedelta(minutes=60)
|
||||
_CI_START_THRESHOLD = datetime.timedelta(minutes=30)
|
||||
_AWAITING_JENKINS_THRESHOLD = datetime.timedelta(minutes=5)
|
||||
_WATCHDOG_DIR = os.path.expanduser('~')
|
||||
_PR_REPORTS_CONFIG_KEY = 'pr_reports'
|
||||
_CI_BUILD_FAIL_MESSAGE = 'ERROR: py3: commands failed'
|
||||
_CI_BUILD_SUCCESS_MESSAGE = 'py3: commands succeeded'
|
||||
_GITHUB_CI_CHECK_NAME = 'OpenVINO-ONNX'
|
||||
|
||||
INTERNAL_ERROR_MESSAGE_HEADER = '!!! --- !!! INTERNAL WATCHDOG ERROR !!! --- !!!'
|
||||
ERROR_MESSAGE_HEADER = '!!! OpenVino-ONNX CI Error !!!'
|
||||
WARNING_MESSAGE_HEADER = 'OpenVino-ONNX CI WARNING'
|
||||
INFO_MESSAGE_HEADER = 'OpenVino-ONNX CI INFO'
|
||||
|
||||
|
||||
class Watchdog:
|
||||
"""Class describing OpenVino-ONNX-CI Watchdog.
|
||||
|
||||
Watchdog connects to GitHub and retrieves the list of current pull requests (PRs) in
|
||||
OpenVino repository. Then it connects to specified Jenkins server to
|
||||
check CI jobs associated with every PR. Watchdog verifies time durations for Jenkins
|
||||
initial response, job queue and execution against time treshold constants. Every fail
|
||||
is logged and reported through MS Teams communicators.
|
||||
|
||||
:param jenkins_token: Token used for Jenkins
|
||||
:param jenkins_server: Jenkins server address
|
||||
:param jenkins_user: Username used to connect to Jenkins
|
||||
:param github_credentials: Credentials used to connect to GitHub
|
||||
:param msteams_url: URL used to connect to MS Teams channel
|
||||
:param ci_job_name: OpenVino-ONNX CI job name used in Jenkins
|
||||
:param watchdog_job_name: Watchdog job name used in Jenkins
|
||||
:type jenkins_token: String
|
||||
:type jenkins_server: String
|
||||
:type jenkins_user: String
|
||||
:type github_credentials: String
|
||||
:type msteams_url: String
|
||||
:type ci_job_name: String
|
||||
:type watchdog_job_name: String
|
||||
|
||||
.. note::
|
||||
Watchdog and OpenVino-ONNX CI job must be placed on the same Jenkins server.
|
||||
"""
|
||||
|
||||
def __init__(self, jenkins_token, jenkins_server, jenkins_user, github_credentials, git_org,
|
||||
git_project, msteams_url, ci_job_name, watchdog_job_name):
|
||||
self._config_path = os.path.join(_WATCHDOG_DIR, '{}/.{}_ci_watchdog.json'.format(_WATCHDOG_DIR, git_project))
|
||||
# Jenkins Wrapper object for CI job
|
||||
self._jenkins = JenkinsWrapper(jenkins_token,
|
||||
jenkins_user=jenkins_user,
|
||||
jenkins_server=jenkins_server)
|
||||
# Load GitHub token and log in, retrieve pull requests
|
||||
self._git = GitWrapper(github_credentials, repository=git_org, project=git_project)
|
||||
# Create MS Teams api object
|
||||
self._msteams_hook = MSTeamsCommunicator(msteams_url)
|
||||
self._ci_job_name = ci_job_name.lower()
|
||||
self._watchdog_job_name = watchdog_job_name
|
||||
# Read config file
|
||||
self._config = self._read_config_file()
|
||||
# Time at Watchdog initiation
|
||||
self._now_time = datetime.datetime.now()
|
||||
self._current_prs = {}
|
||||
self._ms_teams_enabled = True
|
||||
|
||||
def run(self, quiet=False):
|
||||
"""Run main watchdog logic.
|
||||
|
||||
Retrieve list of pull requests and pass it to the method responsible for checking them.
|
||||
|
||||
:param quiet: Flag for disabling sending report through communicator
|
||||
:type quiet: Boolean
|
||||
"""
|
||||
try:
|
||||
pull_requests = self._git.get_pull_requests()
|
||||
except GitWrapperError:
|
||||
message = 'Failed to retrieve Pull Requests!'
|
||||
log.exception(message)
|
||||
self._queue_message(message, message_severity='internal')
|
||||
# Check all pull requests
|
||||
for pr in pull_requests:
|
||||
try:
|
||||
self._check_pr(pr)
|
||||
except Exception as e:
|
||||
log.exception(str(e))
|
||||
self._queue_message(str(e), message_severity='internal', pr=pr)
|
||||
self._update_config()
|
||||
self._send_message(quiet=quiet)
|
||||
|
||||
def _read_config_file(self):
|
||||
"""Read Watchdog config file stored on the system.
|
||||
|
||||
The file stores every fail already reported along with timestamp. This
|
||||
mechanism is used to prevent Watchdog from reporting same failure
|
||||
multiple times. In case there's no config under the expected path,
|
||||
appropriate data structure is created and returned.
|
||||
|
||||
:return: Returns dict of dicts with reported fails with their timestamps
|
||||
:rtype: dict of dicts
|
||||
"""
|
||||
if os.path.isfile(self._config_path):
|
||||
log.info('Reading config file in: {}'.format(self._config_path))
|
||||
file = open(self._config_path, 'r')
|
||||
data = json.load(file)
|
||||
else:
|
||||
log.info('No config file found in: {}'.format(self._config_path))
|
||||
data = {_PR_REPORTS_CONFIG_KEY: {}}
|
||||
return data
|
||||
|
||||
def _check_pr(self, pr):
|
||||
"""Check pull request (if there's no reason to skip).
|
||||
|
||||
Retrieve list of statuses for every PR's last commit and interpret them. Filters out statuses
|
||||
unrelated to OpenVino-ONNX Jenkins CI and passes relevant statuses to method that interprets them.
|
||||
If no commit statuses related to Jenkins are available after time defined by
|
||||
**_AWAITING_JENKINS_THRESHOLD** calls appropriate method to check for builds waiting in queue.
|
||||
|
||||
:param pr: GitHub Pull Requests
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
"""
|
||||
log.info('===============================================')
|
||||
log.info('Checking PR#{}'.format(pr.number))
|
||||
# Get last Jenkins status
|
||||
last_status = self._get_last_status(pr)
|
||||
# Append PR checked in current run for Watchdog config
|
||||
self._current_prs[str(pr.number)] = self._get_pr_timestamps(pr, last_status)
|
||||
if self._should_ignore(pr) or self._updated_since_last_run(pr):
|
||||
log.info('Ignoring PR#{}'.format(pr.number))
|
||||
|
||||
return
|
||||
|
||||
# Calculate time passed since PR update (any commit, merge or comment)
|
||||
pr_time_delta = self._now_time - pr.updated_at
|
||||
if last_status:
|
||||
# Interpret found CI statuses
|
||||
log.info('Last status: {} at {}'.format(last_status.description, last_status.updated_at))
|
||||
self._interpret_status(last_status, pr)
|
||||
elif pr_time_delta > _CI_START_THRESHOLD:
|
||||
# If there's no status after assumed time - check if build is waiting in queue
|
||||
log.info('CI for PR {}: NO JENKINS STATUS YET'.format(pr.number))
|
||||
self._check_missing_status(pr)
|
||||
|
||||
@staticmethod
|
||||
def _get_pr_timestamps(pr, last_status):
|
||||
"""Get dict containing PR timestamp and last status timestamp.
|
||||
|
||||
:param pr: Single PR being currently checked
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
|
||||
:return: Dictionary with PR and last status update timestamps
|
||||
:rtype: dict
|
||||
"""
|
||||
pr_timestamp = time.mktime(pr.updated_at.timetuple())
|
||||
if last_status:
|
||||
status_timestamp = time.mktime(last_status.updated_at.timetuple())
|
||||
else:
|
||||
status_timestamp = None
|
||||
pr_dict = {'pr_timestamp': pr_timestamp,
|
||||
'status_timestamp': status_timestamp}
|
||||
return pr_dict
|
||||
|
||||
@staticmethod
|
||||
def _get_last_status(pr):
|
||||
"""Get last commit status posted from Jenkins.
|
||||
|
||||
:param pr: Single PR being currently checked
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
|
||||
:return: Either last PR status posted from Jenkins or None
|
||||
:rtype: github.CommitStatus.CommitStatus
|
||||
"""
|
||||
# Find last commit in PR
|
||||
last_commit = pr.get_commits().reversed[0]
|
||||
# Get statuses and filter them to contain only those related to Jenkins CI
|
||||
# and check if CI in Jenkins started
|
||||
statuses = last_commit.get_statuses()
|
||||
jenk_statuses = [stat for stat in statuses if
|
||||
_GITHUB_CI_CHECK_NAME in stat.context]
|
||||
try:
|
||||
last_status = jenk_statuses[0]
|
||||
except IndexError:
|
||||
last_status = None
|
||||
return last_status
|
||||
|
||||
@staticmethod
|
||||
def _should_ignore(pr):
|
||||
"""Determine if PR should be ignored.
|
||||
|
||||
:param pr: Single PR being currently checked
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
|
||||
:return: Returns True if PR should be ignored
|
||||
:rtype: Bool
|
||||
"""
|
||||
# Ignore PR if it has WIP label or WIP in title
|
||||
if 'WIP' in pr.title:
|
||||
log.info('PR#{} should be ignored. WIP tag in title.'.format(pr.number))
|
||||
return True
|
||||
|
||||
label_names = [label.name for label in pr.labels]
|
||||
if 'WIP' in label_names:
|
||||
log.info('PR#{} should be ignored. WIP label present.'.format(pr.number))
|
||||
return True
|
||||
|
||||
# Ignore PR if base ref is not master
|
||||
if 'master' not in pr.base.ref:
|
||||
log.info('PR#{} should be ignored. Base ref is not master'.format(pr.number))
|
||||
return True
|
||||
|
||||
# Ignore PR if mergeable state is 'dirty' or 'behind'.
|
||||
# Practically this ignores PR in case of merge conflicts
|
||||
ignored_mergeable_states = ['behind', 'dirty', 'draft']
|
||||
if pr.mergeable_state in ignored_mergeable_states:
|
||||
log.info('PR#{} should be ignored. Mergeable state is {}. '.format(pr.number, pr.mergeable_state))
|
||||
return True
|
||||
|
||||
# If no criteria for ignoring PR are met - return false
|
||||
return False
|
||||
|
||||
def _updated_since_last_run(self, pr):
|
||||
# Ignore if PR was already checked and there was no update in meantime
|
||||
pr_number = str(pr.number)
|
||||
current_pr_timestamps = self._current_prs.get(pr_number)
|
||||
last_pr_timestamps = self._config[_PR_REPORTS_CONFIG_KEY].get(pr_number)
|
||||
if current_pr_timestamps == last_pr_timestamps:
|
||||
log.info('PR#{} - No update since last check'.format(pr.number))
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def _check_missing_status(self, pr):
|
||||
"""Verify if missing status is expected.
|
||||
|
||||
This method checks if CI build for last was scheduled and still waits in queue for
|
||||
executor.
|
||||
|
||||
:param pr: Single PR being currently checked
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
"""
|
||||
pr_time_delta = self._now_time - pr.updated_at
|
||||
try:
|
||||
build_number = self._build_scheduled(pr)
|
||||
if self._build_in_queue(pr, build_number):
|
||||
message = ('PR# {}: build waiting in queue after {} minutes.'
|
||||
.format(pr.number, pr_time_delta.seconds / 60))
|
||||
severity = 'warning'
|
||||
else:
|
||||
message = ('PR# {}: missing status on GitHub after {} minutes.'
|
||||
.format(pr.number, pr_time_delta.seconds / 60))
|
||||
severity = 'error'
|
||||
self._queue_message(message, message_severity=severity, pr=pr)
|
||||
except TypeError:
|
||||
log.info('Committer outside of OpenVino organization')
|
||||
|
||||
def _build_scheduled(self, pr):
|
||||
"""Check if Jenkins build corresponding to PR was scheduled.
|
||||
|
||||
This method takes last Jenkins build for given PR and compares hash from Jenkins console output
|
||||
and sha from PR object to determine if CI build for appropriate commit was scheduled.
|
||||
|
||||
:param pr: Single PR being currently checked
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
|
||||
:return: Returns build number or -1 if no build found
|
||||
:rtype: int
|
||||
"""
|
||||
pr_number = str(pr.number)
|
||||
project_name_full = self._ci_job_name + '/PR-' + pr_number
|
||||
|
||||
try:
|
||||
# Retrieve console output from last Jenkins build for job corresponding to this PR
|
||||
last_build_number = self._jenkins.get_job_info(project_name_full)['lastBuild']['number']
|
||||
console_output = self._jenkins.get_build_console_output(project_name_full, last_build_number)
|
||||
# Check if CI build was scheduled - commit hash on GH must match hash in last Jenkins build console output
|
||||
# Retrieve hash from Jenkins output
|
||||
match_string = '(?:Obtained .ci/[a-zA-Z/]+Jenkinsfile from ([a-z0-9]{40}))'
|
||||
retrieved_sha = re.search(match_string, console_output).group(1)
|
||||
if retrieved_sha == pr.get_commits().reversed[0].sha:
|
||||
return last_build_number
|
||||
else:
|
||||
return -1
|
||||
except (NotFoundException, AttributeError, requests.exceptions.HTTPError):
|
||||
message = ('PR #{}: Jenkins build corresponding to commit {} not found!'
|
||||
.format(pr_number, pr.get_commits().reversed[0].sha))
|
||||
self._queue_message(message, message_severity='error', pr=pr)
|
||||
return -1
|
||||
|
||||
def _build_in_queue(self, pr, build_number):
|
||||
"""Check if Jenkins build waits in queue.
|
||||
|
||||
This method verifies if CI build is waiting in queue based on console output.
|
||||
|
||||
:param pr: Single PR being currently checked
|
||||
:param build_number: Jenkins build number to retrieve console output from
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
:type build_number: int
|
||||
|
||||
:return: Returns True if CI build is waiting in queue
|
||||
:rtype: Bool
|
||||
"""
|
||||
pr_number = str(pr.number)
|
||||
project_name_full = self._ci_job_name + '/PR-' + pr_number
|
||||
# Retrieve console output
|
||||
try:
|
||||
console_output = self._jenkins.get_build_console_output(project_name_full, build_number)
|
||||
except NotFoundException:
|
||||
return False
|
||||
# Check if build is waiting in queue (and not already running on an executor)
|
||||
if 'Waiting for next available executor on' in console_output \
|
||||
and 'Running on' not in console_output:
|
||||
log.info('CI for PR %s: WAITING IN QUEUE', pr_number)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def _interpret_status(self, status, pr):
|
||||
"""
|
||||
Verify GitHub status passed to the method.
|
||||
|
||||
This method verifies last commit status for given PR, calling appropriate methods
|
||||
to further validate the status.
|
||||
|
||||
:param status: GitHub commit status
|
||||
:param pr: Single PR being currently checked
|
||||
:type status: github.CommitStatus.CommitStatus
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
"""
|
||||
try:
|
||||
# Retrieve build number for Jenkins build related to this PR
|
||||
build_number = self._retrieve_build_number(status.target_url)
|
||||
# CI build finished - verify if expected output is present
|
||||
finished_statuses = ['Build finished', 'This commit cannot be built', 'This commit looks good']
|
||||
pending_statuses = ['This commit is being built', 'Testing in progress',
|
||||
'This commit is scheduled to be built']
|
||||
if any(phrase in status.description for phrase in finished_statuses):
|
||||
self._check_finished(pr, build_number)
|
||||
# CI build in progress - verify timeouts for build queue and duration
|
||||
elif any(phrase in status.description for phrase in pending_statuses):
|
||||
self._check_in_progress(pr, build_number)
|
||||
else:
|
||||
message = 'ONNX CI job for PR# {}: unrecognized status: {}'.format(pr.number, status.description)
|
||||
self._queue_message(message, message_severity='error', pr=pr)
|
||||
except Exception:
|
||||
# Log Watchdog internal error in case any status can't be properly verified
|
||||
message = 'Failed to verify status "{}" for PR# {}'.format(status.description, pr.number)
|
||||
log.exception(message)
|
||||
self._queue_message(message, message_severity='internal', pr=pr)
|
||||
|
||||
def _retrieve_build_number(self, url):
|
||||
"""Retrieve Jenkins CI job build number from URL address coming from GitHub commit status.
|
||||
|
||||
:param url: URL address from GitHub commit status
|
||||
:type url: String
|
||||
|
||||
:return: Returns build number
|
||||
:rtype: int
|
||||
"""
|
||||
# Retrieve the build number from url string
|
||||
match_obj = re.search('(?:/PR-[0-9]+/)([0-9]+)', url)
|
||||
try:
|
||||
number = int(match_obj.group(1))
|
||||
return number
|
||||
except Exception:
|
||||
log.exception('Failed to retrieve build number from url link: %s', url)
|
||||
raise
|
||||
|
||||
def _queue_message(self, message, message_severity='info', pr=None):
|
||||
"""Add a message to message queue in communicator object.
|
||||
|
||||
The queued message is constructed based on message string passed as
|
||||
a method argument and message header. Message header is mapped to message severity
|
||||
also passed as an argument.
|
||||
|
||||
:param message: Message content
|
||||
:param message_severity: Message severity level
|
||||
:type message: String
|
||||
:type message_severity: int
|
||||
"""
|
||||
log.info(message)
|
||||
internal = False
|
||||
if 'internal' in message_severity:
|
||||
message_header = INTERNAL_ERROR_MESSAGE_HEADER
|
||||
internal = True
|
||||
elif 'error' in message_severity:
|
||||
message_header = ERROR_MESSAGE_HEADER
|
||||
elif 'warning' in message_severity:
|
||||
message_header = WARNING_MESSAGE_HEADER
|
||||
else:
|
||||
message_header = INFO_MESSAGE_HEADER
|
||||
# If message is related to PR attatch url
|
||||
if pr:
|
||||
message = message + '\n' + pr.html_url
|
||||
|
||||
send = message_header + '\n' + message
|
||||
if self._ms_teams_enabled:
|
||||
self._msteams_hook.queue_message(send)
|
||||
|
||||
def _check_finished(self, pr, build_number):
|
||||
"""Verify if finished build output contains expected string for either fail or success.
|
||||
|
||||
:param pr: Single PR being currently checked
|
||||
:param build_number: Jenkins CI job build number
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
:type build_number: int
|
||||
"""
|
||||
pr_number = str(pr.number)
|
||||
log.info('CI for PR %s: FINISHED', pr_number)
|
||||
# Check if FINISH was valid FAIL / SUCCESS
|
||||
project_name_full = self._ci_job_name + '/PR-' + pr_number
|
||||
build_output = self._jenkins.get_build_console_output(project_name_full, build_number)
|
||||
if _CI_BUILD_FAIL_MESSAGE not in build_output \
|
||||
and _CI_BUILD_SUCCESS_MESSAGE not in build_output:
|
||||
message = ('ONNX CI job for PR #{}: finished but no tests success or fail '
|
||||
'confirmation is present in console output!'.format(pr_number))
|
||||
self._queue_message(message, message_severity='error', pr=pr)
|
||||
|
||||
def _send_message(self, quiet=False):
|
||||
"""Send messages queued in MS Teams objects to designated channel.
|
||||
|
||||
Queued messages are being sent as a single communication.
|
||||
|
||||
:param quiet: Flag for disabling sending report through communicator
|
||||
:type quiet: Boolean
|
||||
"""
|
||||
if any(messages for messages in self._msteams_hook.messages):
|
||||
try:
|
||||
watchdog_build = self._jenkins.get_job_info(self._watchdog_job_name)['lastBuild']
|
||||
watchdog_build_number = watchdog_build['number']
|
||||
watchdog_build_link = watchdog_build['url']
|
||||
except Exception:
|
||||
watchdog_build_number = 'UNKNOWN'
|
||||
watchdog_build_link = self._jenkins.jenkins_server
|
||||
send = self._watchdog_job_name + '- build ' + str(
|
||||
watchdog_build_number) + ' - ' + watchdog_build_link
|
||||
|
||||
if self._ms_teams_enabled:
|
||||
self._msteams_hook.send_message(send, quiet=quiet)
|
||||
else:
|
||||
log.info('Nothing to report.')
|
||||
|
||||
def _check_in_progress(self, pr, build_number):
|
||||
"""Check if CI build succesfully started.
|
||||
|
||||
Checks if build started within designated time threshold, and job is
|
||||
currently running - it didn't cross the time threshold.
|
||||
|
||||
:param pr: Single PR being currently checked
|
||||
:param build_number: Jenkins CI job build number
|
||||
:type pr: github.PullRequest.PullRequest
|
||||
:type build_number: int
|
||||
"""
|
||||
pr_number = str(pr.number)
|
||||
log.info('CI for PR %s: TESTING IN PROGRESS', pr_number)
|
||||
project_name_full = self._ci_job_name + '/PR-' + pr_number
|
||||
build_info = self._jenkins.get_build_info(project_name_full, build_number)
|
||||
build_datetime = datetime.datetime.fromtimestamp(build_info['timestamp'] / 1000.0)
|
||||
build_delta = self._now_time - build_datetime
|
||||
log.info('Build %s: IN PROGRESS, started: %s minutes ago', str(build_number),
|
||||
str(build_delta))
|
||||
# If build still waiting in queue
|
||||
if build_delta > _CI_START_THRESHOLD and self._build_in_queue(pr, build_number):
|
||||
message = ('ONNX CI job build #{}, for PR #{} waiting in queue after {} '
|
||||
'minutes'.format(build_number, pr_number, str(build_delta.seconds / 60)))
|
||||
self._queue_message(message, message_severity='warning', pr=pr)
|
||||
elif build_delta > _BUILD_DURATION_THRESHOLD:
|
||||
# CI job take too long, possibly froze - communicate failure
|
||||
message = ('ONNX CI job build #{}, for PR #{} started, '
|
||||
'but did not finish in designated time of {} '
|
||||
'minutes!'.format(build_number, pr_number,
|
||||
str(_BUILD_DURATION_THRESHOLD.seconds / 60)))
|
||||
self._queue_message(message, message_severity='error', pr=pr)
|
||||
|
||||
def _update_config(self):
|
||||
"""Update Watchdog config file with PRs checked in current Watchdog run, remove old entries.
|
||||
|
||||
:param current_prs: List of PR numbers checked during current Watchdog run
|
||||
:type current_prs: list of ints
|
||||
"""
|
||||
# Cleanup config of old reports
|
||||
log.info('Writing to config file at: {}'.format(self._config_path))
|
||||
new_config = {_PR_REPORTS_CONFIG_KEY: self._current_prs}
|
||||
file = open(self._config_path, 'w+')
|
||||
json.dump(new_config, file)
|
||||
14
.ci/pot/Jenkinsfile
vendored
14
.ci/pot/Jenkinsfile
vendored
@@ -1,14 +0,0 @@
|
||||
#!groovy
|
||||
|
||||
|
||||
properties([
|
||||
parameters([
|
||||
string(defaultValue: '',
|
||||
description: 'Pipeline shared library version (branch/tag/commit). Determined automatically if empty',
|
||||
name: 'library_version')
|
||||
])
|
||||
])
|
||||
|
||||
loadOpenVinoLibrary {
|
||||
potEntrypoint(this)
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
branch = True
|
||||
|
||||
source =
|
||||
extensions/
|
||||
mo/
|
||||
mo.py
|
||||
|
||||
@@ -14,7 +13,6 @@ omit =
|
||||
/usr/*
|
||||
# omit tests
|
||||
*/test_*.py
|
||||
*_test.py
|
||||
# init scripts
|
||||
*/__init__.py
|
||||
|
||||
@@ -38,4 +36,4 @@ exclude_lines =
|
||||
ignore_errors = True
|
||||
|
||||
[html]
|
||||
directory = htmlcov
|
||||
directory = htmlcov
|
||||
23
.gitattributes
vendored
23
.gitattributes
vendored
@@ -2,6 +2,7 @@
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
@@ -10,7 +11,9 @@
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
*.py text eol=lf
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
@@ -33,6 +36,7 @@
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
@@ -41,6 +45,7 @@
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
@@ -58,21 +63,3 @@
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
*.PNG filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||
*.vsdx filter=lfs diff=lfs merge=lfs -text
|
||||
*.bmp filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
#POT attributes
|
||||
tools/pot/tests/data/test_cases_refs/* filter=lfs diff=lfs merge=lfs -text
|
||||
tools/pot/tests/data/models/*/* filter=lfs diff=lfs merge=lfs -text
|
||||
tools/pot/tests/data/reference_models/* filter=lfs diff=lfs merge=lfs -text
|
||||
tools/pot/tests/data/video/* filter=lfs diff=lfs merge=lfs -text
|
||||
tools/pot/tests/data/reference_fake_quantize_conf/* filter=lfs diff=lfs merge=lfs -text
|
||||
/tools/pot/tests/** -pot_package
|
||||
/tools/pot/tools/auxilary/** -pot_package
|
||||
/tools/pot/tools/run_series_experiments.py -pot_package
|
||||
/tools/pot/.pylintrc -pot_package
|
||||
/tools/pot/README_dev.md -pot_package
|
||||
|
||||
58
.github/ISSUE_TEMPLATE/bug.md
vendored
58
.github/ISSUE_TEMPLATE/bug.md
vendored
@@ -1,58 +0,0 @@
|
||||
---
|
||||
name: Bug
|
||||
about: Create a report to help us improve
|
||||
title: "[Bug]"
|
||||
labels: bug, support_request
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
##### System information (version)
|
||||
<!-- Example
|
||||
- OpenVINO => 2020.4
|
||||
- Operating System / Platform => Windows 64 Bit
|
||||
- Compiler => Visual Studio 2017
|
||||
- Problem classification: Model Conversion
|
||||
- Framework: TensorFlow (if applicable)
|
||||
- Model name: ResNet50 (if applicable)
|
||||
-->
|
||||
|
||||
- OpenVINO=> :grey_question:
|
||||
- Operating System / Platform => :grey_question:
|
||||
- Compiler => :grey_question:
|
||||
- Problem classification => :grey_question:
|
||||
|
||||
##### Detailed description
|
||||
<!-- your description -->
|
||||
|
||||
##### Steps to reproduce
|
||||
|
||||
<!--
|
||||
Describe your problem and steps you've done before you got to this point.
|
||||
to add code example fence it with triple backticks and optional file extension
|
||||
```.cpp
|
||||
// C++ code example
|
||||
```
|
||||
or attach as .txt or .zip file
|
||||
-->
|
||||
|
||||
##### Issue submission checklist
|
||||
|
||||
- [ ] I report the issue, it's not a question
|
||||
<!--
|
||||
OpenVINO team works with support forum, Stack Overflow and other communities
|
||||
to discuss problems. Tickets with question without real issue statement will be
|
||||
closed.
|
||||
-->
|
||||
- [ ] I checked the problem with documentation, FAQ, open issues, Stack Overflow, etc and have not found solution
|
||||
<!--
|
||||
Places to check:
|
||||
* OpenVINO documentation: https://docs.openvinotoolkit.org/
|
||||
* OpenVINO forum: https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/bd-p/distribution-openvino-toolkit
|
||||
* OpenVINO issue tracker: https://github.com/openvinotoolkit/openvino/issues?q=is%3Aissue
|
||||
* Stack Overflow branch: https://stackoverflow.com/questions/tagged/openvino
|
||||
-->
|
||||
- [ ] There is reproducer code and related data files: images, videos, models, etc.
|
||||
<!--
|
||||
The best reproducer -- test case for OpenVINO that we can add to the library.
|
||||
-->
|
||||
18
.github/dependabot.yml
vendored
18
.github/dependabot.yml
vendored
@@ -1,18 +0,0 @@
|
||||
# See help here: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/enabling-and-disabling-version-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
# Enable version updates for nGraph Python API
|
||||
- package-ecosystem: pip
|
||||
directory: "/src/bindings/python"
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
time: "13:00"
|
||||
open-pull-requests-limit: 10
|
||||
reviewers:
|
||||
- jiwaszki
|
||||
- akuporos
|
||||
labels:
|
||||
- "category: dependencies"
|
||||
|
||||
139
.github/github_org_control/check_org.py
vendored
139
.github/github_org_control/check_org.py
vendored
@@ -1,139 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
"""
|
||||
Check GitHub organization and invite members
|
||||
"""
|
||||
|
||||
# pylint: disable=fixme,no-member,too-many-locals
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
from github_org_control.configs import Config
|
||||
from github_org_control.github_api import GithubOrgApi, get_dev_emails, print_users
|
||||
from github_org_control.ldap_api import LdapApi, print_user_info, InfoLevel
|
||||
|
||||
|
||||
def remove_members(gh_api, cfg_emails, org_emails, dev_emails, org_emails_no_in_ldap):
|
||||
"""Checks and remove members"""
|
||||
print(
|
||||
f"\n{'=' * 10} Check accounts below and remove from the GitHub organization or "
|
||||
f"configuration {'=' * 10}"
|
||||
)
|
||||
|
||||
cfg_emails_no_in_org = sorted(cfg_emails.difference(org_emails))
|
||||
print(
|
||||
f"\nCfg developer emails - absent in GitHub organization {len(cfg_emails_no_in_org)}:",
|
||||
"; ".join(cfg_emails_no_in_org),
|
||||
)
|
||||
|
||||
non_member_ignored_logins = set(Config().IGNORE_LOGINS).difference(
|
||||
set(gh_api.org_members_by_login.keys())
|
||||
)
|
||||
print(
|
||||
f"\nIgnored logins - absent in GitHub organization {len(non_member_ignored_logins)}:\n",
|
||||
"\n".join(non_member_ignored_logins),
|
||||
)
|
||||
|
||||
org_emails_no_in_dev = sorted(org_emails.difference(dev_emails))
|
||||
print(
|
||||
f"\nOrg member emails - absent in cfg and LDAP PDLs {len(org_emails_no_in_dev)}:",
|
||||
"; ".join(org_emails_no_in_dev),
|
||||
)
|
||||
|
||||
print(
|
||||
f"\nOrg member emails - absent in LDAP at all {len(org_emails_no_in_ldap)}:",
|
||||
"; ".join(sorted(org_emails_no_in_ldap)),
|
||||
)
|
||||
|
||||
print("\nOrg members - no real name:")
|
||||
members_to_fix_name = sorted(gh_api.members_to_fix_name, key=lambda member: member.email)
|
||||
print_users(members_to_fix_name)
|
||||
print(
|
||||
"\nOrg member emails - no real name:",
|
||||
"; ".join([member.email.lower() for member in members_to_fix_name]),
|
||||
)
|
||||
|
||||
print("\nOrg members - no Intel emails:")
|
||||
print_users(gh_api.members_to_remove)
|
||||
|
||||
gh_api.remove_users(org_emails_no_in_ldap | gh_api.members_to_remove)
|
||||
|
||||
|
||||
def main():
|
||||
"""The main entry point function"""
|
||||
arg_parser = ArgumentParser()
|
||||
arg_parser.add_argument(
|
||||
"--cfg-file",
|
||||
metavar="PATH",
|
||||
default=Config.default_cfg_path,
|
||||
help=f"Path to json configuration file, e.g. {Config.default_cfg_path}",
|
||||
)
|
||||
arg_parser.add_argument("--teams", action="store_true", help="Check GitHub teams")
|
||||
arg_parser.add_argument("--no-ldap", action="store_true", help="Don't use LDAP info")
|
||||
args, unknown_args = arg_parser.parse_known_args()
|
||||
|
||||
Config(args.cfg_file, unknown_args)
|
||||
gh_api = GithubOrgApi()
|
||||
|
||||
if args.teams:
|
||||
gh_api.get_org_teams()
|
||||
return
|
||||
|
||||
cfg_emails = get_dev_emails()
|
||||
print(f"\nCfg developer emails {len(cfg_emails)}:", "; ".join(sorted(cfg_emails)))
|
||||
|
||||
dev_emails = set()
|
||||
dev_emails.update(cfg_emails)
|
||||
|
||||
if not args.no_ldap:
|
||||
ldap_api = LdapApi()
|
||||
ldap_emails = ldap_api.get_user_emails()
|
||||
dev_emails.update(ldap_emails)
|
||||
print(f"\nLDAP developer emails {len(ldap_emails)}:", "; ".join(sorted(ldap_emails)))
|
||||
|
||||
cfg_emails_no_in_ldap = ldap_api.get_absent_emails(cfg_emails)
|
||||
print(
|
||||
f"\nCfg developer emails - absent in LDAP at all {len(cfg_emails_no_in_ldap)}:",
|
||||
"; ".join(sorted(cfg_emails_no_in_ldap)),
|
||||
)
|
||||
|
||||
cfg_ldap_inters = cfg_emails.intersection(ldap_emails)
|
||||
print(
|
||||
f"\nCfg developer emails - present in LDAP developers {len(cfg_ldap_inters)}:",
|
||||
"; ".join(sorted(cfg_ldap_inters)),
|
||||
)
|
||||
|
||||
org_emails = gh_api.get_org_emails()
|
||||
print(f"\nOrg emails {len(org_emails)}:", "; ".join(sorted(org_emails)))
|
||||
|
||||
org_emails_no_in_ldap = set()
|
||||
if not args.no_ldap:
|
||||
org_ldap_diff = org_emails.difference(ldap_emails)
|
||||
print(
|
||||
f"\nOrg member emails - absent in LDAP developers {len(org_ldap_diff)}:",
|
||||
"; ".join(sorted(org_ldap_diff)),
|
||||
)
|
||||
|
||||
for email in org_ldap_diff:
|
||||
user_info = ldap_api.get_user_info_by_email(email)
|
||||
if user_info:
|
||||
print_user_info(user_info, InfoLevel.PDL)
|
||||
else:
|
||||
org_emails_no_in_ldap.add(email)
|
||||
|
||||
org_pendig_invitation_emails = gh_api.get_org_invitation_emails()
|
||||
invite_emails = dev_emails.difference(org_emails).difference(org_pendig_invitation_emails)
|
||||
print(f"\nInvite emails {len(invite_emails)}:", "; ".join(sorted(invite_emails)))
|
||||
|
||||
valid_github_users = gh_api.get_valid_github_users(invite_emails)
|
||||
gh_api.invite_users(valid_github_users)
|
||||
|
||||
remove_members(gh_api, cfg_emails, org_emails, dev_emails, org_emails_no_in_ldap)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
261
.github/github_org_control/check_pr.py
vendored
261
.github/github_org_control/check_pr.py
vendored
@@ -1,261 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
"""
|
||||
Check GitHub PRs and set labels by type and categories, e.g. 'ExternalPR', 'category: ci'
|
||||
"""
|
||||
|
||||
# pylint: disable=fixme,no-member
|
||||
|
||||
import re
|
||||
import sys
|
||||
import datetime
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
from github_org_control import github_api
|
||||
from github_org_control.configs import Config
|
||||
|
||||
|
||||
class PrType(Enum):
|
||||
"""Constants for type of GitHub pull request by author membership"""
|
||||
|
||||
EXTERNAL = "ExternalPR"
|
||||
INTEL = "ExternalIntelPR"
|
||||
ORG = "OpenvinoPR"
|
||||
BAD = "BadPR"
|
||||
|
||||
|
||||
def get_pr_labels(pull):
|
||||
"""Gets PR labels as set"""
|
||||
pr_lables = set()
|
||||
for label in pull.labels:
|
||||
pr_lables.add(label.name)
|
||||
return pr_lables
|
||||
|
||||
|
||||
def set_pr_labels(pull, labels):
|
||||
"""Sets new PR labels (all previously set labels are removed)"""
|
||||
if not labels or Config().DRY_RUN:
|
||||
return
|
||||
print("Set PR labels:", labels)
|
||||
# set_labels() should accept list but fails with empty "AssertionError:"
|
||||
pull.set_labels(labels)
|
||||
|
||||
|
||||
def add_pr_labels(pull, labels):
|
||||
"""Adds PR labels"""
|
||||
if not labels or Config().DRY_RUN:
|
||||
return
|
||||
print("Add PR labels:", labels)
|
||||
for label in labels:
|
||||
pull.add_to_labels(label)
|
||||
|
||||
|
||||
def get_pr_type_by_labels(pull):
|
||||
"""Gets PR type using labels"""
|
||||
pr_lables = get_pr_labels(pull)
|
||||
pr_types = set(type.value for type in PrType)
|
||||
pr_types_labels = pr_lables & pr_types
|
||||
if not pr_types_labels:
|
||||
return None
|
||||
if len(pr_types_labels) > 1:
|
||||
print(f"Duplicated labels: {pr_types_labels}")
|
||||
return PrType.BAD
|
||||
return PrType(PrType(pr_types_labels.pop()))
|
||||
|
||||
|
||||
def get_label_by_team_name_re(team_name):
|
||||
"""Generates label by PR reviwer team name using regular expressions"""
|
||||
if "admins" in team_name:
|
||||
return "category: ci"
|
||||
re_compile_label = re.compile(rf"{Config().GITHUB_REPO}-(.+)-maintainers")
|
||||
re_label = re_compile_label.match(team_name)
|
||||
if re_label:
|
||||
return f"category: {re_label.group(1).strip()}"
|
||||
return None
|
||||
|
||||
|
||||
def get_label_by_team_name_map(team_name):
|
||||
"""Generates label by PR reviwer team name using config map"""
|
||||
return Config().TEAM_TO_LABEL.get(team_name)
|
||||
|
||||
|
||||
def get_category_labels(pull):
|
||||
"""Gets list of category labels by all PR reviwer teams"""
|
||||
labels = []
|
||||
pr_lables = get_pr_labels(pull)
|
||||
for reviewer_team in pull.get_review_requests()[1]:
|
||||
reviewer_label = get_label_by_team_name_map(reviewer_team.name)
|
||||
if reviewer_label and reviewer_label not in pr_lables:
|
||||
labels.append(reviewer_label)
|
||||
return labels
|
||||
|
||||
|
||||
def get_pr_info_str(pull):
|
||||
"""Gets info about PR using a few workarounds"""
|
||||
pr_title = pull.title.encode("ASCII", "ignore").decode()
|
||||
|
||||
# Workaround for PyGithub issue: https://github.com/PyGithub/PyGithub/issues/512
|
||||
pr_created_at = pull.created_at.replace(tzinfo=datetime.timezone.utc).astimezone()
|
||||
|
||||
return (
|
||||
f"PR: {pull.number} - {pr_title} - Created: {pr_created_at} - "
|
||||
f"Labels: {get_pr_labels(pull)} - Type: {get_pr_type_by_labels(pull)}"
|
||||
)
|
||||
|
||||
|
||||
def update_labels(gh_api, pull, non_org_intel_pr_users, non_org_pr_users):
|
||||
"""Checks and updates labels"""
|
||||
print("Check and update labels:")
|
||||
pr_type_by_labels = get_pr_type_by_labels(pull)
|
||||
add_labels = []
|
||||
|
||||
# Checks PR source type
|
||||
if gh_api.is_org_user(pull.user):
|
||||
print(" - Org user")
|
||||
elif github_api.is_intel_email(pull.user.email) or github_api.is_intel_company(
|
||||
pull.user.company
|
||||
):
|
||||
print(" - Non org user with Intel email or company")
|
||||
non_org_intel_pr_users.add(pull.user)
|
||||
if pr_type_by_labels is not PrType.INTEL:
|
||||
print(f'NO "{PrType.INTEL.value}" label: ', end="")
|
||||
github_api.print_users(pull.user)
|
||||
add_labels.append(PrType.INTEL.value)
|
||||
elif github_api.is_user_ignored(pull.user):
|
||||
print(" - IGNORED non org user with NO Intel email or company")
|
||||
else:
|
||||
print(" - Non org user with NO Intel email or company")
|
||||
non_org_pr_users.add(pull.user)
|
||||
if pr_type_by_labels is not PrType.EXTERNAL:
|
||||
print(f'NO "{PrType.EXTERNAL.value}" label: ', end="")
|
||||
github_api.print_users(pull.user)
|
||||
add_labels.append(PrType.EXTERNAL.value)
|
||||
|
||||
add_labels += get_category_labels(pull)
|
||||
add_pr_labels(pull, add_labels)
|
||||
|
||||
|
||||
def get_wrong_commits(pull):
|
||||
"""Returns commits with incorrect user and email"""
|
||||
pr_author_email = (pull.user.email or "").lower()
|
||||
print("GitHub PR author email:", pr_author_email)
|
||||
print("Check commits:")
|
||||
wrong_commits = set()
|
||||
for commit in pull.get_commits():
|
||||
# import pprint; pprint.pprint(commit.raw_data)
|
||||
print("Commit SHA:", commit.sha)
|
||||
# Use raw data because commit author can be non GitHub user
|
||||
commit_author_email = (commit.raw_data["commit"]["author"]["email"] or "").lower()
|
||||
commit_committer_email = (commit.raw_data["commit"]["committer"]["email"] or "").lower()
|
||||
print(" Commit author email:", commit_author_email)
|
||||
print(" Commit committer email:", commit_committer_email)
|
||||
if not github_api.is_valid_user(commit.author):
|
||||
print(
|
||||
" ERROR: User with the commit author email is absent in GitHub:",
|
||||
commit.raw_data["commit"]["author"]["name"],
|
||||
)
|
||||
wrong_commits.add(commit.sha)
|
||||
if not github_api.is_valid_user(commit.committer):
|
||||
print(
|
||||
" ERROR: User with the commit committer email is absent in GitHub:",
|
||||
commit.raw_data["commit"]["committer"]["name"],
|
||||
)
|
||||
wrong_commits.add(commit.sha)
|
||||
if not commit.raw_data["commit"]["verification"]["verified"]:
|
||||
print(
|
||||
" WARNING: The commit is not verified. Reason:",
|
||||
commit.raw_data["commit"]["verification"]["reason"],
|
||||
)
|
||||
if pr_author_email != commit_author_email or pr_author_email != commit_committer_email:
|
||||
print(" WARNING: Commit emails and GitHub PR author public email are differnt")
|
||||
return wrong_commits
|
||||
|
||||
|
||||
def main():
|
||||
"""The main entry point function"""
|
||||
arg_parser = ArgumentParser()
|
||||
arg_parser.add_argument(
|
||||
"--cfg-file",
|
||||
metavar="PATH",
|
||||
default=Config.default_cfg_path,
|
||||
help=f"Path to json configuration file, e.g. {Config.default_cfg_path}",
|
||||
)
|
||||
arg_parser.add_argument(
|
||||
"--pr", metavar="NUMBER", help="Get GitHub pull request with the number"
|
||||
)
|
||||
arg_parser.add_argument(
|
||||
"--pr-state",
|
||||
default="open",
|
||||
choices=["open", "closed"],
|
||||
help="Set GitHub pull request state",
|
||||
)
|
||||
arg_parser.add_argument(
|
||||
"--newer", metavar="MINUTES", help="Get newly created GitHub pull request only"
|
||||
)
|
||||
arg_parser.add_argument(
|
||||
"--check-commits",
|
||||
action="store_true",
|
||||
help="Check and compare git commit email with GitHub account email",
|
||||
)
|
||||
args, unknown_args = arg_parser.parse_known_args()
|
||||
|
||||
Config(args.cfg_file, unknown_args)
|
||||
gh_api = github_api.GithubOrgApi()
|
||||
|
||||
if args.pr:
|
||||
pulls = [gh_api.repo.get_pull(int(args.pr))]
|
||||
else:
|
||||
pulls = gh_api.repo.get_pulls(state=args.pr_state)
|
||||
print(f"\nPRs count ({args.pr_state}):", pulls.totalCount)
|
||||
|
||||
if args.newer:
|
||||
pr_created_after = (
|
||||
datetime.datetime.now() - datetime.timedelta(minutes=int(args.newer))
|
||||
).astimezone()
|
||||
print("Checking PRs created after:", pr_created_after)
|
||||
|
||||
non_org_intel_pr_users = set()
|
||||
non_org_pr_users = set()
|
||||
wrong_pulls = {}
|
||||
|
||||
for pull in pulls:
|
||||
pr_created_at = pull.created_at.replace(tzinfo=datetime.timezone.utc).astimezone()
|
||||
if args.newer and pr_created_at <= pr_created_after:
|
||||
print(f"\nIGNORE: {get_pr_info_str(pull)}")
|
||||
continue
|
||||
|
||||
print(f"\n{get_pr_info_str(pull)}")
|
||||
if args.check_commits:
|
||||
wrong_commits = get_wrong_commits(pull)
|
||||
if wrong_commits:
|
||||
wrong_pulls[pull.number] = wrong_commits
|
||||
else:
|
||||
update_labels(gh_api, pull, non_org_intel_pr_users, non_org_pr_users)
|
||||
|
||||
if wrong_pulls:
|
||||
for pull_number, wrong_commits in wrong_pulls.items():
|
||||
print(
|
||||
f"\nERROR: Remove or replace wrong commits in the PR {pull_number}:\n ",
|
||||
"\n ".join(wrong_commits),
|
||||
)
|
||||
print(
|
||||
"\nAbout commit signature verification:\n ",
|
||||
"https://docs.github.com/en/github/authenticating-to-github/"
|
||||
"managing-commit-signature-verification/about-commit-signature-verification",
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
if non_org_intel_pr_users:
|
||||
print("\nNon org user with Intel email or company:")
|
||||
github_api.print_users(non_org_intel_pr_users)
|
||||
if non_org_pr_users:
|
||||
print("\nNon org user with NO Intel email or company:")
|
||||
github_api.print_users(non_org_pr_users)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
45
.github/github_org_control/config.json
vendored
45
.github/github_org_control/config.json
vendored
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"GITHUB_TOKEN": "<Put token here or set as arg or as env variable>",
|
||||
"GITHUB_ORGANIZATION": "openvinotoolkit",
|
||||
"GITHUB_REPO": "openvino",
|
||||
"IGNORE_LOGINS": [
|
||||
"openvino-ci",
|
||||
"openvino-pushbot",
|
||||
"lab-nerval",
|
||||
"lab-nerval-onnx-ci",
|
||||
"onnx-watchdog-agent",
|
||||
"workbench-ci-bot",
|
||||
"openvino-pot-ci"
|
||||
],
|
||||
"MAX_MEMBERS_TO_REMOVE": 15,
|
||||
"EMAILS_FILE_PATH": "dev_emails-test.txt",
|
||||
"PROXIES": {
|
||||
"HTTP_PROXY": null,
|
||||
"HTTPS_PROXY": null,
|
||||
"NO_PROXY": "localhost,127.0.0.1,.intel.com"
|
||||
},
|
||||
"DRY_RUN": false,
|
||||
"TEAM_TO_LABEL": {
|
||||
"openvino-admins": "category: CI",
|
||||
"openvino-maintainers": "category: IE common",
|
||||
"openvino-docs-maintainers": "category: docs",
|
||||
"openvino-ie-maintainers": "category: IE common",
|
||||
"openvino-ie-cpu-maintainers": "category: CPU",
|
||||
"openvino-ie-gna-maintainers": "category: GNA",
|
||||
"openvino-ie-gpu-maintainers": "category: GPU",
|
||||
"openvino-ie-lpt-maintainers": "category: LP transformations",
|
||||
"openvino-ie-multi-maintainers": "category: MULTI",
|
||||
"openvino-ie-python-api-maintainers": "category: python api",
|
||||
"openvino-ie-template-maintainers": "category: TEMPLATE",
|
||||
"openvino-ie-tests-maintainers": "category: IE Tests",
|
||||
"openvino-ie-vpu-maintainers": "category: VPU",
|
||||
"openvino-mo-maintainers": "category: MO",
|
||||
"openvino-ngraph-maintainers": "category: nGraph",
|
||||
"openvino-scripts-maintainers": "category: build",
|
||||
"openvino-tests-maintainers": "category: IE Tests",
|
||||
"openvino-tools-maintainers": "category: tools",
|
||||
"openvino-pot-maintainers": "category: POT",
|
||||
"openvino-configuration-mgmt": "category: dependency_changes",
|
||||
"openvino-samples-maintainers": "category: samples"
|
||||
}
|
||||
}
|
||||
120
.github/github_org_control/configs.py
vendored
120
.github/github_org_control/configs.py
vendored
@@ -1,120 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
"""
|
||||
Configurations management
|
||||
"""
|
||||
|
||||
# pylint: disable=fixme,broad-except
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ast
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
if sys.hexversion < 0x3060000:
|
||||
raise Exception("Python version must be >= 3.6")
|
||||
|
||||
|
||||
class ConfigException(Exception):
|
||||
"""Base configuration exception"""
|
||||
|
||||
|
||||
class Config:
|
||||
"""Configuration wrapper"""
|
||||
|
||||
_instance = None
|
||||
_properties = None
|
||||
|
||||
default_cfg_path = Path(__file__).resolve().parent / "config.json"
|
||||
|
||||
def __new__(cls, *_args, **_kwargs):
|
||||
if not Config._instance:
|
||||
Config._instance = super(Config, cls).__new__(cls)
|
||||
return Config._instance
|
||||
|
||||
def __init__(self, file_path=None, cli_args=None):
|
||||
"""
|
||||
:param file_path: Path to json configuration file
|
||||
:type file_path: String
|
||||
|
||||
:param args: List of argparse arguments with patterns: 'name=value' or 'name'
|
||||
:type args: list
|
||||
"""
|
||||
if Config._properties:
|
||||
return
|
||||
|
||||
self._file_path = file_path or Config.default_cfg_path
|
||||
self._cli_args = cli_args or []
|
||||
|
||||
self._json_cfg = {}
|
||||
self._args = {}
|
||||
|
||||
self._load_cfg()
|
||||
self._parse_cli_args()
|
||||
|
||||
Config._properties = {}
|
||||
for name, value in self._json_cfg.items():
|
||||
if hasattr(self, name):
|
||||
raise ConfigException(f"Duplicating prosperity: {name}")
|
||||
property_value = self._args.get(name) or os.getenv(name)
|
||||
if property_value:
|
||||
# Try to set prosperity_value as Python literal structures, e.g. DRY_RUN=False
|
||||
try:
|
||||
property_value = ast.literal_eval(property_value)
|
||||
except Exception:
|
||||
pass
|
||||
if not isinstance(property_value, type(value)):
|
||||
raise ConfigException(f"Python type of {name} parameter must be {type(value)}")
|
||||
else:
|
||||
property_value = value
|
||||
Config._properties[name] = property_value
|
||||
|
||||
self.set_proxy()
|
||||
|
||||
def __getattr__(self, attr_name):
|
||||
if attr_name in self._properties:
|
||||
return self._properties.get(attr_name)
|
||||
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{attr_name}'")
|
||||
|
||||
def _load_cfg(self):
|
||||
"""Load the json configuration file"""
|
||||
try:
|
||||
with open(self._file_path, encoding="utf-8") as conf:
|
||||
self._json_cfg = json.load(conf)
|
||||
except Exception as exc:
|
||||
raise ConfigException("Failed to load configuration from:", self._file_path) from exc
|
||||
|
||||
def _parse_cli_args(self):
|
||||
"""Parse argparse arguments with patterns: 'name=value' or 'name'"""
|
||||
for cli_arg in self._cli_args:
|
||||
arg = cli_arg.split("=")
|
||||
if arg[0] not in self._json_cfg:
|
||||
raise ConfigException(f"Unsupported argument: {arg}")
|
||||
self._args[arg[0]] = True if len(arg) == 1 else "=".join(arg[1:])
|
||||
|
||||
@property
|
||||
def properties(self):
|
||||
"""Get all properties as Dict"""
|
||||
return self._properties
|
||||
|
||||
def set_proxy(self):
|
||||
"""Set proxies"""
|
||||
for proxy_name, url in self._properties["PROXIES"].items():
|
||||
if url is not None:
|
||||
print(f"Set proxy: {proxy_name}={url}")
|
||||
os.environ[proxy_name] = url
|
||||
|
||||
|
||||
def _test():
|
||||
"""Test and debug"""
|
||||
print("Config.default_cfg_path:", Config.default_cfg_path)
|
||||
cfg = Config(cli_args=["DRY_RUN", 'PROXIES={"NO_PROXY": "localhost"}'])
|
||||
print("Config.properties:", cfg.properties)
|
||||
print("cfg.PROXIES:", cfg.PROXIES)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
_test()
|
||||
@@ -1,9 +0,0 @@
|
||||
# good comment
|
||||
Last_name, First_name <first_name.last_name@intel.com>
|
||||
first_name.last_name@intel.com
|
||||
openvino_pushbot@intel.com
|
||||
|
||||
# Wrong emails
|
||||
foo@foo.com
|
||||
foo1 foo2
|
||||
foo1 foo2@intel.com
|
||||
384
.github/github_org_control/github_api.py
vendored
384
.github/github_org_control/github_api.py
vendored
@@ -1,384 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
"""
|
||||
GitHub API for controlling organization
|
||||
"""
|
||||
|
||||
# pylint: disable=fixme,no-member
|
||||
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import typing
|
||||
from pathlib import Path
|
||||
|
||||
from github import Github, GithubException, RateLimitExceededException, IncompletableObject
|
||||
from github.PaginatedList import PaginatedList
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
from github_org_control.configs import Config
|
||||
|
||||
|
||||
class GithubApiException(Exception):
|
||||
"""Base GitHub API exception"""
|
||||
|
||||
|
||||
def is_valid_user(user):
|
||||
"""Checks that user is valid github.Github object"""
|
||||
try:
|
||||
return user and user.login
|
||||
except IncompletableObject:
|
||||
return False
|
||||
|
||||
|
||||
def is_user_ignored(user):
|
||||
"""Checks that user should be ignored"""
|
||||
if is_valid_user(user) and user.login.lower() not in Config().IGNORE_LOGINS:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def is_valid_name(name):
|
||||
"""Checks that GitHub user's name is valid"""
|
||||
return name and len(name) >= 3 and " " in name
|
||||
|
||||
|
||||
def is_intel_email(email):
|
||||
"""Checks that email is valid Intel email"""
|
||||
return email and len(email) > 10 and " " not in email and email.lower().endswith("@intel.com")
|
||||
|
||||
|
||||
def is_intel_company(company):
|
||||
"""Checks that company contains intel"""
|
||||
return company and "intel" in company.lower()
|
||||
|
||||
|
||||
def is_valid_intel_user(user):
|
||||
"""Checks that user is valid GitHub and Intel user"""
|
||||
try:
|
||||
return is_valid_user(user) and is_valid_name(user.name) and is_intel_email(user.email)
|
||||
except IncompletableObject:
|
||||
return False
|
||||
|
||||
|
||||
def print_users(users):
|
||||
"""Print list of users in different formats: list, set, PaginatedList"""
|
||||
if isinstance(users, (list, set, PaginatedList)):
|
||||
users_count = users.totalCount if isinstance(users, PaginatedList) else len(users)
|
||||
print(f"GitHub users {users_count} (login - name - company - email - valid):")
|
||||
else:
|
||||
users = [users]
|
||||
for user in users:
|
||||
if not is_valid_user(user):
|
||||
print("WRONG GitHub user: ???")
|
||||
continue
|
||||
|
||||
try:
|
||||
name = user.name
|
||||
except IncompletableObject:
|
||||
name = "???"
|
||||
|
||||
try:
|
||||
company = user.company
|
||||
except IncompletableObject:
|
||||
company = "???"
|
||||
|
||||
try:
|
||||
email = user.email
|
||||
except IncompletableObject:
|
||||
email = "???"
|
||||
|
||||
valid_check = "OK" if is_valid_intel_user(user) else "FIX"
|
||||
if not is_intel_email(email):
|
||||
valid_check += " email"
|
||||
if not is_valid_name(name):
|
||||
valid_check += " name"
|
||||
print(f'{user.login} - "{name}" - "{company}" - {email} - {valid_check}')
|
||||
|
||||
|
||||
def get_dev_emails():
|
||||
"""
|
||||
Read a file with developer emails. Supported email formats
|
||||
first_name.last_name@intel.com
|
||||
Import from Outlook: Last_name, First_name <first_name.last_name@intel.com>
|
||||
"""
|
||||
re_email = re.compile(r".+<(.+)>")
|
||||
emails = set()
|
||||
cfg = Config()
|
||||
with open(cfg.properties["EMAILS_FILE_PATH"]) as file_obj:
|
||||
for line in file_obj:
|
||||
line = line.strip().lower()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
re_outlook_email = re_email.match(line)
|
||||
if re_outlook_email:
|
||||
line = re_outlook_email.group(1).strip()
|
||||
if not is_intel_email(line):
|
||||
print(f'Wrong email in {cfg.properties["EMAILS_FILE_PATH"]}: {line}')
|
||||
continue
|
||||
emails.add(line)
|
||||
return emails
|
||||
|
||||
|
||||
class GithubOrgApi:
|
||||
"""Common API for GitHub organization"""
|
||||
|
||||
def __init__(self):
|
||||
self._cfg = Config()
|
||||
self.github = Github(self._cfg.GITHUB_TOKEN)
|
||||
self.github_org = self.github.get_organization(self._cfg.GITHUB_ORGANIZATION)
|
||||
self.repo = self.github.get_repo(f"{self._cfg.GITHUB_ORGANIZATION}/{self._cfg.GITHUB_REPO}")
|
||||
self.github_users_by_email = {}
|
||||
self.org_members_by_login = {}
|
||||
self.members_to_remove = set()
|
||||
self.members_to_fix_name = set()
|
||||
|
||||
def is_org_user(self, user):
|
||||
"""Checks that user is a member of GitHub organization"""
|
||||
if is_valid_user(user):
|
||||
# user.get_organization_membership(self.github_org) doesn't work with org members
|
||||
# permissions, GITHUB_TOKEN must be org owner now
|
||||
return self.github_org.has_in_members(user)
|
||||
return False
|
||||
|
||||
def get_org_emails(self):
|
||||
"""Gets and prints emails of all GitHub organization members"""
|
||||
org_members = self.github_org.get_members()
|
||||
org_emails = set()
|
||||
|
||||
print(f"\nOrg members {org_members.totalCount} (login - name - company - email - valid):")
|
||||
for org_member in org_members:
|
||||
self.org_members_by_login[org_member.login.lower()] = org_member
|
||||
print_users(org_member)
|
||||
if is_intel_email(org_member.email):
|
||||
email = org_member.email.lower()
|
||||
org_emails.add(email)
|
||||
self.github_users_by_email[email] = org_member
|
||||
if not is_valid_name(org_member.name):
|
||||
self.members_to_fix_name.add(org_member)
|
||||
elif not is_user_ignored(org_member):
|
||||
self.members_to_remove.add(org_member)
|
||||
|
||||
print("\nOrg members - no Intel emails:")
|
||||
print_users(self.members_to_remove)
|
||||
|
||||
print("\nOrg members - no real name:")
|
||||
print_users(self.members_to_fix_name)
|
||||
print(
|
||||
"\nOrg member emails - no real name:",
|
||||
"; ".join([member.email.lower() for member in self.members_to_fix_name]),
|
||||
)
|
||||
|
||||
return org_emails
|
||||
|
||||
def get_org_invitation_emails(self):
|
||||
"""Gets GitHub organization teams prints info"""
|
||||
org_invitations = self.github_org.invitations()
|
||||
org_invitation_emails = set()
|
||||
|
||||
print(
|
||||
f"\nOrg invitations {org_invitations.totalCount} "
|
||||
"(login - name - company - email - valid):"
|
||||
)
|
||||
for org_invitation in org_invitations:
|
||||
print_users(org_invitation)
|
||||
if is_user_ignored(org_invitation):
|
||||
continue
|
||||
if is_intel_email(org_invitation.email):
|
||||
org_invitation_emails.add(org_invitation.email.lower())
|
||||
else:
|
||||
print("Strange org invitation:", org_invitation)
|
||||
|
||||
print(
|
||||
f"\nOrg invitation emails {len(org_invitation_emails)}:",
|
||||
"; ".join(org_invitation_emails),
|
||||
)
|
||||
return org_invitation_emails
|
||||
|
||||
def get_org_teams(self):
|
||||
"""Gets GitHub organization teams prints info"""
|
||||
teams = []
|
||||
org_teams = self.github_org.get_teams()
|
||||
print("\nOrg teams count:", org_teams.totalCount)
|
||||
for team in org_teams:
|
||||
teams.append(team.name)
|
||||
print(f"\nTeam: {team.name} - parent: {team.parent}")
|
||||
|
||||
repos = team.get_repos()
|
||||
print("Repos:")
|
||||
for repo in repos:
|
||||
print(f" {repo.name} -", team.get_repo_permission(repo))
|
||||
|
||||
team_maintainers = team.get_members(role="maintainer")
|
||||
team_maintainer_logins = set()
|
||||
for maintainer in team_maintainers:
|
||||
team_maintainer_logins.add(maintainer.login)
|
||||
team_members = team.get_members(role="member")
|
||||
team_member_logins = set()
|
||||
for member in team_members:
|
||||
team_member_logins.add(member.login)
|
||||
members = team.get_members(role="all")
|
||||
member_emails = []
|
||||
print("Members (role - login - name - company - email - valid):")
|
||||
for user in members:
|
||||
if user.login in team_maintainer_logins:
|
||||
print(" Maintainer - ", end="")
|
||||
elif user.login in team_member_logins:
|
||||
print(" Member - ", end="")
|
||||
else:
|
||||
# It is not possible to check child teams members
|
||||
print(" ??? - ", end="")
|
||||
print_users(user)
|
||||
if is_intel_email(user.email) and not is_user_ignored(user):
|
||||
member_emails.append(user.email.lower())
|
||||
print(f"Intel emails {len(member_emails)}:", "; ".join(member_emails))
|
||||
return teams
|
||||
|
||||
def get_github_user_by_email(self, email):
|
||||
"""Gets GitHub user by email"""
|
||||
if email in self.github_users_by_email:
|
||||
return self.github_users_by_email.get(email)
|
||||
|
||||
def search_users():
|
||||
paginated_users = self.github.search_users(f"{email} in:email")
|
||||
# Minimize the GitHub Rate Limit
|
||||
users = []
|
||||
for user in paginated_users:
|
||||
users.append(user)
|
||||
if len(users) == 1:
|
||||
return users[0]
|
||||
if len(users) == 0:
|
||||
return None
|
||||
raise GithubApiException(
|
||||
f"ERROR: Found {len(users)} GitHub accounts with the same email {email}"
|
||||
)
|
||||
|
||||
try:
|
||||
user = search_users()
|
||||
except RateLimitExceededException:
|
||||
print("WARNING: RateLimitExceededException")
|
||||
time.sleep(30)
|
||||
user = search_users()
|
||||
self.github_users_by_email[email] = user
|
||||
|
||||
return user
|
||||
|
||||
def get_valid_github_users(self, emails):
|
||||
"""Gets valid GitHub users by email and prints status"""
|
||||
valid_users = set()
|
||||
wrong_emails = set()
|
||||
no_account_emails = set()
|
||||
no_account_names = set()
|
||||
print(f"\nGitHub users from {len(emails)} invite emails (email - status):")
|
||||
for email in emails:
|
||||
if not is_intel_email(email):
|
||||
print(f"{email} - Non Intel email")
|
||||
wrong_emails.add(email)
|
||||
continue
|
||||
|
||||
# You can make up to 30 requests per minute; https://developer.github.com/v3/search/
|
||||
time.sleep(2)
|
||||
user = self.get_github_user_by_email(email)
|
||||
|
||||
if not user:
|
||||
print(f"{email} - No valid GitHub account")
|
||||
no_account_emails.add(email)
|
||||
continue
|
||||
|
||||
if user.email and user.email.lower() == email:
|
||||
if is_valid_name(user.name):
|
||||
print(f"{email} - OK")
|
||||
valid_users.add(user)
|
||||
else:
|
||||
print(f"{email} - No valid name in GitHub account: ", end="")
|
||||
print_users(user)
|
||||
no_account_names.add(email)
|
||||
else:
|
||||
print(f"{email} - Non public or wrong email in GitHub account: ", end="")
|
||||
print_users(user)
|
||||
no_account_emails.add(email)
|
||||
|
||||
print("\nValid users:")
|
||||
print_users(valid_users)
|
||||
|
||||
print(f"\nWrong emails {len(wrong_emails)}:", "; ".join(wrong_emails))
|
||||
|
||||
print(
|
||||
f"\nIntel emails - No valid GitHub account {len(no_account_emails)}:",
|
||||
"; ".join(no_account_emails),
|
||||
)
|
||||
|
||||
print(
|
||||
f"\nIntel emails - No valid name in GitHub account {len(no_account_names)}:",
|
||||
"; ".join(no_account_names),
|
||||
)
|
||||
return valid_users
|
||||
|
||||
def invite_users(self, users):
|
||||
"""Invites users to GitHub organization and prints status"""
|
||||
if not isinstance(users, typing.Iterable):
|
||||
users = [users]
|
||||
print(f"\nInvite {len(users)} users:")
|
||||
|
||||
for user in users:
|
||||
if isinstance(user, str):
|
||||
print(f"Email: {user}")
|
||||
self.github_org.invite_user(email=user)
|
||||
else:
|
||||
print(f'{user.login} - "{user.name}" - {user.email} - ', end="")
|
||||
try:
|
||||
if is_user_ignored(user):
|
||||
print("Ignored")
|
||||
continue
|
||||
if self._cfg.DRY_RUN:
|
||||
print("Dry run")
|
||||
continue
|
||||
self.github_org.invite_user(user=user)
|
||||
print("OK")
|
||||
except GithubException as exc:
|
||||
print(f'FAIL: {exc.data["errors"][0]["message"]}')
|
||||
|
||||
def remove_users(self, users):
|
||||
"""Removes users from GitHub organization"""
|
||||
if not isinstance(users, typing.Iterable):
|
||||
users = [users]
|
||||
print(f"\nRemove {len(users)} users:")
|
||||
|
||||
dry_run = self._cfg.DRY_RUN
|
||||
if not dry_run and len(users) > self._cfg.MAX_MEMBERS_TO_REMOVE:
|
||||
print(
|
||||
"WARNING: Review is required for removing members more than "
|
||||
f"{self._cfg.MAX_MEMBERS_TO_REMOVE}"
|
||||
)
|
||||
# TODO: Add notification
|
||||
dry_run = True
|
||||
|
||||
for user in users:
|
||||
member = self.get_github_user_by_email(user) if isinstance(user, str) else user
|
||||
print(f'{member.login} - "{member.name}" - {member.email} - ', end="")
|
||||
try:
|
||||
if is_user_ignored(member):
|
||||
print("Ignored")
|
||||
continue
|
||||
if dry_run:
|
||||
print("Dry run")
|
||||
continue
|
||||
self.github_org.remove_from_membership(member)
|
||||
print("OK")
|
||||
except GithubException as exc:
|
||||
print(f'FAIL: {exc.data["errors"][0]["message"]}')
|
||||
|
||||
|
||||
def _test():
|
||||
"""Test and debug"""
|
||||
Config(cli_args=["DRY_RUN=True"])
|
||||
dev_emails = get_dev_emails()
|
||||
print("dev_emails:", dev_emails)
|
||||
|
||||
gh_api = GithubOrgApi()
|
||||
gh_api.get_org_emails()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
_test()
|
||||
247
.github/github_org_control/ldap_api.py
vendored
247
.github/github_org_control/ldap_api.py
vendored
@@ -1,247 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
"""
|
||||
Gets info about users and groups via LDAP
|
||||
"""
|
||||
|
||||
# pylint: disable=fixme,no-member
|
||||
|
||||
import sys
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
|
||||
from ldap3 import Server, Connection, ALL, SUBTREE
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
from github_org_control.configs import Config
|
||||
|
||||
|
||||
class LdapApiException(Exception):
|
||||
"""Base LDAP API exception"""
|
||||
|
||||
|
||||
class InfoLevel(Enum):
|
||||
"""Constants for printing user info from LDAP"""
|
||||
|
||||
PDL = "PDL" # Public Distribution List (group of e-mail addresses)
|
||||
FULL = "Full"
|
||||
|
||||
|
||||
def print_user_info(info, info_level=None):
|
||||
"""Pretty-print of a user info data structure (dict). info_level is the InfoLevel Enum"""
|
||||
if not info or not info.get("mail"):
|
||||
raise LdapApiException("ERROR: No info or absent mail")
|
||||
|
||||
def get_membership():
|
||||
if info_level == InfoLevel.PDL:
|
||||
membership_info = " PDLs:"
|
||||
elif info_level == InfoLevel.FULL:
|
||||
membership_info = " memberOf :"
|
||||
else:
|
||||
return ""
|
||||
# Grouping groups by purpose
|
||||
if info_level == InfoLevel.PDL:
|
||||
sort_key = lambda i: i.split(",", 1)[0].lower()
|
||||
else:
|
||||
sort_key = lambda i: i.split(",", 1)[1] + i.split(",", 1)[0].lower()
|
||||
for item in sorted(info["memberOf"], key=sort_key):
|
||||
if info_level == InfoLevel.PDL and "OU=Delegated" not in item:
|
||||
continue
|
||||
membership_info += f"\n {item}"
|
||||
return membership_info
|
||||
|
||||
try:
|
||||
text_info = (
|
||||
f'\n{info["cn"]} <{info["mail"]}>; {info["sAMAccountName"]}; {info["employeeID"]}'
|
||||
f'\n Org group: {info["intelSuperGroupDescr"]} ({info["intelSuperGroupShortName"]}) /'
|
||||
f' {info["intelGroupDescr"]} ({info["intelGroupShortName"]}) /'
|
||||
f' {info["intelDivisionDescr"]} ({info["intelDivisionShortName"]}) /'
|
||||
f' {info["intelOrgUnitDescr"]}'
|
||||
f'\n Manager: {info.get("manager")}'
|
||||
f'\n Location: {info["intelRegionCode"]} / {info["co"]} / {info["intelSiteCode"]} /'
|
||||
f' {info["intelBldgCode"]} ({info.get("intelSiteName")}) /'
|
||||
f' {info["physicalDeliveryOfficeName"]}'
|
||||
f'\n Other: {info["employeeType"]} | {info["intelExportCountryGroup"]} |'
|
||||
f' {info["whenCreated"]} | {info["intelCostCenterDescr"]} | {info["jobDescription"]}'
|
||||
)
|
||||
except Exception as exc:
|
||||
raise LdapApiException(
|
||||
f'ERROR: Failed to get info about "{info["mail"]}". '
|
||||
f"Exception occurred:\n{repr(exc)}"
|
||||
) from exc
|
||||
print(text_info)
|
||||
|
||||
membership = get_membership()
|
||||
if info_level == InfoLevel.PDL and membership:
|
||||
print(membership)
|
||||
elif info_level == InfoLevel.FULL:
|
||||
for key in sorted(info):
|
||||
if isinstance(info[key], list):
|
||||
if key == "memberOf":
|
||||
print(membership)
|
||||
else:
|
||||
print(f" {key} :")
|
||||
for item in info[key]:
|
||||
print(" ", item)
|
||||
else:
|
||||
print(f" {key} : {info[key]}")
|
||||
|
||||
|
||||
class LdapApi:
|
||||
"""LDAP API for getting user info and emails"""
|
||||
|
||||
_binary_blobs = ["thumbnailPhoto", "msExchUMSpokenName", "msExchBlockedSendersHash"]
|
||||
_check_existing = [
|
||||
"intelExportCountryGroup",
|
||||
"physicalDeliveryOfficeName",
|
||||
"intelSuperGroupShortName",
|
||||
"intelGroupShortName",
|
||||
"intelDivisionShortName",
|
||||
]
|
||||
|
||||
null = "<null>"
|
||||
|
||||
def __init__(self):
|
||||
self._cfg = Config()
|
||||
self.server = Server(self._cfg.LDAP_SERVER, get_info=ALL)
|
||||
self.connection = Connection(
|
||||
self.server, user=self._cfg.LDAP_USER, password=self._cfg.LDAP_PASSWORD, auto_bind=True
|
||||
)
|
||||
self.connection.bind()
|
||||
|
||||
def get_user_emails(self, groups=None):
|
||||
"""Gets emails of LDAP groups and sub-groups"""
|
||||
print("\nGet emails from LDAP groups:")
|
||||
processed_ldap_members = {}
|
||||
|
||||
def process_group_members(member, parent_group):
|
||||
if member in processed_ldap_members:
|
||||
processed_ldap_members[member]["parent_groups"].append(parent_group)
|
||||
print(
|
||||
"\nWARNING: Ignore LDAP member to avoid duplication and recursive cycling "
|
||||
f"of PDLs: {member}\n "
|
||||
f'email: {processed_ldap_members[member].get("email")}\n parent_groups:'
|
||||
)
|
||||
for group in processed_ldap_members[member].get("parent_groups", []):
|
||||
print(7 * " ", group)
|
||||
|
||||
return
|
||||
processed_ldap_members[member] = {"email": None, "parent_groups": [parent_group]}
|
||||
|
||||
# AD moves terminated users to the boneyard OU in case the user returns,
|
||||
# so it can be reactivated with little effort.
|
||||
# After 30 days it is removed and the unix personality becomes unlinked.
|
||||
if "OU=Boneyard" in member:
|
||||
return
|
||||
self.connection.search(
|
||||
member, r"(objectClass=*)", SUBTREE, attributes=["cn", "member", "mail"]
|
||||
)
|
||||
|
||||
# print(self.connection.entries)
|
||||
if not self.connection.response:
|
||||
raise LdapApiException(f"ERROR: empty response. LDAP member: {member}")
|
||||
|
||||
# Check that the member is worker.
|
||||
# The response can contain several items, but the first item is valid only
|
||||
if "OU=Workers" in member:
|
||||
if self.connection.response[0]["attributes"]["mail"]:
|
||||
processed_ldap_members[member]["email"] = self.connection.response[0][
|
||||
"attributes"
|
||||
]["mail"].lower()
|
||||
return
|
||||
raise LdapApiException(
|
||||
f"ERROR: no mail. LDAP worker: {member}\n" f"{self.connection.entries}"
|
||||
)
|
||||
|
||||
if len(self.connection.response) > 1:
|
||||
raise LdapApiException(
|
||||
f"ERROR: multiple responses for {member}: "
|
||||
f"{len(self.connection.response)}\n"
|
||||
f"{self.connection.entries}"
|
||||
)
|
||||
|
||||
if self.connection.response[0]["attributes"]["member"]:
|
||||
for group_member in self.connection.response[0]["attributes"]["member"]:
|
||||
process_group_members(group_member, member)
|
||||
else:
|
||||
print(f"\nERROR: no members in LDAP group: {member}\n{self.connection.entries}")
|
||||
|
||||
for group in groups or self._cfg.LDAP_PDLs:
|
||||
print("\nProcess ROOT LDAP group:", group)
|
||||
process_group_members(group, "ROOT")
|
||||
return {
|
||||
member.get("email") for member in processed_ldap_members.values() if member.get("email")
|
||||
}
|
||||
|
||||
def _get_user_info(self, query):
|
||||
"""Gets user info from LDAP as dict matching key and values pairs from query"""
|
||||
query_filter = "".join(f"({key}={value})" for key, value in query.items())
|
||||
|
||||
for domain in self._cfg.LDAP_DOMAINS:
|
||||
search_base = f"OU=Workers,DC={domain},DC=corp,DC=intel,DC=com"
|
||||
self.connection.search(
|
||||
search_base,
|
||||
f"(&(objectcategory=person)(objectclass=user)(intelflags=1){query_filter})",
|
||||
SUBTREE,
|
||||
attributes=["*"],
|
||||
)
|
||||
|
||||
if self.connection.response:
|
||||
if len(self.connection.response) > 1:
|
||||
raise LdapApiException(
|
||||
f"ERROR: multiple responses for {query_filter}: "
|
||||
f"{len(self.connection.response)}\n"
|
||||
f"{self.connection.entries}"
|
||||
)
|
||||
info = self.connection.response[0]["attributes"]
|
||||
|
||||
# remove long binary blobs
|
||||
for blob in LdapApi._binary_blobs:
|
||||
info[blob] = b""
|
||||
for key in LdapApi._check_existing:
|
||||
if not info.get(key):
|
||||
info[key] = LdapApi.null
|
||||
return info
|
||||
return {}
|
||||
|
||||
def get_user_info_by_idsid(self, idsid):
|
||||
"""Gets user info from LDAP as dict using account name for searching"""
|
||||
return self._get_user_info({"sAMAccountName": idsid})
|
||||
|
||||
def get_user_info_by_name(self, name):
|
||||
"""Gets user info from LDAP as dict using common name for searching"""
|
||||
return self._get_user_info({"cn": name})
|
||||
|
||||
def get_user_info_by_email(self, email):
|
||||
"""Gets user info from LDAP as dict using emails for searching"""
|
||||
return self._get_user_info({"mail": email})
|
||||
|
||||
def get_absent_emails(self, emails):
|
||||
"""Checks users by email in LDAP and returns absent emails"""
|
||||
absent_emails = set()
|
||||
for email in emails:
|
||||
if not self.get_user_info_by_email(email):
|
||||
absent_emails.add(email)
|
||||
return absent_emails
|
||||
|
||||
|
||||
def _test():
|
||||
"""Test and debug"""
|
||||
ldap = LdapApi()
|
||||
|
||||
emails = ldap.get_user_emails()
|
||||
print(f'\nLDAP emails count: {len(emails)}\n{"; ".join(emails)}')
|
||||
|
||||
emails = ["foo@intel.com"]
|
||||
|
||||
for email in emails:
|
||||
info = ldap.get_user_info_by_email(email)
|
||||
if info:
|
||||
print_user_info(info, InfoLevel.PDL)
|
||||
else:
|
||||
print(f"\n{email} - not found")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
_test()
|
||||
@@ -1 +0,0 @@
|
||||
pylint==2.11.1
|
||||
2
.github/github_org_control/requirements.txt
vendored
2
.github/github_org_control/requirements.txt
vendored
@@ -1,2 +0,0 @@
|
||||
PyGithub==1.55
|
||||
ldap3==2.7
|
||||
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@@ -1,6 +0,0 @@
|
||||
### Details:
|
||||
- *item1*
|
||||
- *...*
|
||||
|
||||
### Tickets:
|
||||
- *ticket-id*
|
||||
79
.github/workflows/build_doc.yml
vendored
79
.github/workflows/build_doc.yml
vendored
@@ -1,79 +0,0 @@
|
||||
name: Documentation
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
Build_Doc:
|
||||
if: github.repository == 'openvinotoolkit/openvino'
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Clone OpenVINO
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
lfs: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
set -e
|
||||
# install doc dependencies
|
||||
sudo apt update
|
||||
sudo apt --assume-yes install libusb-1.0-0-dev graphviz texlive
|
||||
cd docs
|
||||
python -m pip install -r requirements.txt --user
|
||||
cd openvino_sphinx_theme
|
||||
python setup.py install --user
|
||||
cd ../..
|
||||
# install doxyrest
|
||||
wget https://github.com/vovkos/doxyrest/releases/download/doxyrest-2.1.3/doxyrest-2.1.3-linux-amd64.tar.xz
|
||||
tar -xf doxyrest-2.1.3-linux-amd64.tar.xz
|
||||
echo "$(pwd)/doxyrest-2.1.3-linux-amd64/bin/" >> $GITHUB_PATH
|
||||
# install doxygen
|
||||
mkdir doxygen
|
||||
cd doxygen
|
||||
git clone https://github.com/doxygen/doxygen.git
|
||||
cd doxygen
|
||||
git checkout Release_1_9_2
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build . -j`nproc`
|
||||
sudo make install
|
||||
|
||||
- name: CMake doc
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DENABLE_DOCS=ON -DENABLE_PYTHON=ON -DNGRAPH_PYTHON_BUILD_ENABLE=ON -DCMAKE_BUILD_TYPE=Release ..
|
||||
|
||||
- name: Build doc
|
||||
run: |
|
||||
cmake --build . --target sphinx_docs
|
||||
working-directory: build
|
||||
|
||||
- name: Archive HTML
|
||||
run: |
|
||||
zip -r openvino_html.zip _build
|
||||
working-directory: build/docs
|
||||
|
||||
- name: Run Pytest
|
||||
run: |
|
||||
pytest --doxygen="./build/docs/doxygen.log" \
|
||||
--confcutdir="./docs/scripts/tests/" \
|
||||
--html="./build/docs/_artifacts/doc-generation.html" \
|
||||
--doxygen-strip="$(pwd)" \
|
||||
--doxygen-xfail="./docs/doxygen-xfail.txt" \
|
||||
--self-contained-html ./docs/scripts/tests/test_docs.py
|
||||
|
||||
- name: 'Upload test results'
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openvino_doc_pytest
|
||||
path: build/docs/_artifacts/
|
||||
|
||||
- name: 'Upload html'
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openvino_html
|
||||
path: build/docs/openvino_html.zip
|
||||
17
.github/workflows/check_pr_commits.yml
vendored
17
.github/workflows/check_pr_commits.yml
vendored
@@ -1,17 +0,0 @@
|
||||
name: PR Commits
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
Checks:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Clone OpenVINO
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: python3 -m pip install -r ./.github/github_org_control/requirements.txt
|
||||
|
||||
- name: PR commits
|
||||
run: python3 ./.github/github_org_control/check_pr.py --pr=${{ github.event.number }} --check-commits DRY_RUN
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
98
.github/workflows/code_style.yml
vendored
98
.github/workflows/code_style.yml
vendored
@@ -1,98 +0,0 @@
|
||||
name: Code Style
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
clang-format:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install clang-format-9
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt --assume-yes install clang-format-9
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt --assume-yes install libusb-1.0-0-dev
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install -r ./inference-engine/ie_bridges/python/requirements.txt
|
||||
# Add for -DENABLE_PYTHON=ON, no cython
|
||||
python3 -m pip install -r ./inference-engine/ie_bridges/python/src/requirements-dev.txt
|
||||
|
||||
# Run cmake with -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT in order to enable codestyle check for ITT collector
|
||||
- name: CMake
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT ..
|
||||
|
||||
- name: Check code style
|
||||
run: cmake --build . --target clang_format_check_all -j8
|
||||
working-directory: build
|
||||
|
||||
- name: Create code style diff
|
||||
if: failure()
|
||||
run: |
|
||||
cmake --build . --target clang_format_fix_all -j8
|
||||
git diff > code_style_diff.diff
|
||||
working-directory: build
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
name: code_style_diff
|
||||
path: build/code_style_diff.diff
|
||||
|
||||
ShellCheck:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install ShellCheck
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt --assume-yes install shellcheck
|
||||
|
||||
- name: Install dependencies
|
||||
run: python3 -m pip install -r ./inference-engine/ie_bridges/python/requirements.txt
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DENABLE_VPU=OFF ..
|
||||
|
||||
- name: ShellCheck
|
||||
run: cmake --build . --target ie_shellcheck -j8
|
||||
working-directory: build
|
||||
|
||||
NamingConventionCheck:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Clang dependency
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt --assume-yes install libclang-9-dev
|
||||
|
||||
- name: Install Python-based dependencies
|
||||
run: python3 -m pip install -r cmake/developer_package/ncc_naming_style/requirements_dev.txt
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DENABLE_VPU=OFF ..
|
||||
|
||||
- name: Naming convention check
|
||||
run: cmake --build . --target ncc_all -j8
|
||||
working-directory: build
|
||||
17
.github/workflows/files_size.yml
vendored
17
.github/workflows/files_size.yml
vendored
@@ -1,17 +0,0 @@
|
||||
name: Files Size
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
Check_Files_Size:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: git ls-tree
|
||||
run: |
|
||||
git ls-tree -r -t -l --full-name HEAD | sort -n -r -k 4
|
||||
|
||||
- name: git lfs ls-files
|
||||
run: |
|
||||
git lfs ls-files --size
|
||||
|
||||
65
.github/workflows/mo.yml
vendored
65
.github/workflows/mo.yml
vendored
@@ -1,65 +0,0 @@
|
||||
name: MO
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'openvino/tools/mo/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'openvino/tools/mo/**'
|
||||
|
||||
jobs:
|
||||
Pylint-UT:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.6
|
||||
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('openvino/tools/mo/requirements*.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
${{ runner.os }}-
|
||||
|
||||
# tensorflow 1.15 causes modules import
|
||||
# errors, most likely due to https://github.com/PyCQA/pylint/issues/2603
|
||||
# for tensorflow.core.framework and tensorflow.contrib
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools
|
||||
# For UT
|
||||
pip install unittest-xml-reporting==3.0.2
|
||||
# MO requirements
|
||||
pip install -r requirements.txt
|
||||
pip install -r requirements_dev.txt
|
||||
# requrements for CMake
|
||||
sudo apt update
|
||||
sudo apt --assume-yes install libusb-1.0-0-dev
|
||||
working-directory: openvino/tools/mo
|
||||
|
||||
- name: Pylint
|
||||
run: pylint -d C,R,W openvino/tools/mo/ openvino/tools/mo/mo.py
|
||||
working-directory: openvino/tools/mo
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
|
||||
- name: UT
|
||||
run: |
|
||||
export PYTHONPATH=$PYTHONPATH:`pwd`
|
||||
export MO_ROOT=`pwd`
|
||||
env
|
||||
mkdir ../mo-ut-logs
|
||||
python3 -m xmlrunner discover -p *_test.py --output=../mo-ut-logs
|
||||
working-directory: openvino/tools/mo
|
||||
77
.github/workflows/py_checks.yml
vendored
77
.github/workflows/py_checks.yml
vendored
@@ -1,77 +0,0 @@
|
||||
name: IE Python Checks
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'inference-engine/ie_bridges/python/**'
|
||||
- 'samples/python/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'inference-engine/ie_bridges/python/**'
|
||||
- 'samples/python/**'
|
||||
jobs:
|
||||
linters:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Code checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.6'
|
||||
- name: Install dependencies
|
||||
run: python -m pip install -r inference-engine/ie_bridges/python/requirements_dev.txt
|
||||
- name: Run Flake on samples
|
||||
run: python -m flake8 ./ --config=setup.cfg
|
||||
working-directory: samples/python
|
||||
- name: Create code style diff for samples
|
||||
if: failure()
|
||||
run: |
|
||||
python -m black -l 160 -S ./
|
||||
git diff > samples_diff.diff
|
||||
working-directory: samples/python
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
name: samples_diff
|
||||
path: samples_diff.diff
|
||||
- name: Run Flake on src
|
||||
run: python -m flake8 ./ --config=../setup.cfg
|
||||
working-directory: inference-engine/ie_bridges/python/src
|
||||
- name: Create code style diff for Python src
|
||||
if: failure()
|
||||
run: |
|
||||
python -m black -l 160 -S ./
|
||||
git diff > src_diff.diff
|
||||
working-directory: inference-engine/ie_bridges/python/src
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
name: src_diff
|
||||
path: src_diff.diff
|
||||
- name: Run Flake on wheel
|
||||
run: python -m flake8 ./ --config=../setup.cfg
|
||||
working-directory: inference-engine/ie_bridges/python/wheel
|
||||
- name: Create code style diff for wheel
|
||||
if: failure()
|
||||
run: |
|
||||
python -m black -l 160 -S ./
|
||||
git diff > wheel_diff.diff
|
||||
working-directory: inference-engine/ie_bridges/python/wheel
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
name: wheel_diff
|
||||
path: wheel_diff.diff
|
||||
|
||||
- name: Run MyPy
|
||||
run: python -m mypy ./ --config-file ./setup.cfg
|
||||
working-directory: inference-engine/ie_bridges/python
|
||||
- name: Run Bandit
|
||||
run: python -m bandit -r ./ -f screen
|
||||
working-directory: inference-engine/ie_bridges/python
|
||||
|
||||
|
||||
379
.gitignore
vendored
379
.gitignore
vendored
@@ -1,63 +1,342 @@
|
||||
# build/artifact dirs
|
||||
_*
|
||||
# but ensure we don't skip __init__.py and __main__.py
|
||||
!__init__.py
|
||||
!__main__.py
|
||||
# and sphinx documentation folders
|
||||
!docs/_*
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# developer tools
|
||||
*.idea
|
||||
.vscode
|
||||
cmake-build-*
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
[Xx]64/
|
||||
[Xx]86/
|
||||
[Bb]uild/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# PY.TEST
|
||||
*.pyc
|
||||
tests/integration/report.html
|
||||
tests/integration/report.xml
|
||||
tests/integration/assets/
|
||||
tests/integration/__pycache__/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
|
||||
# TODO: Un-comment the next line if you do not want to checkin
|
||||
# your web deploy settings because they may include unencrypted
|
||||
# passwords
|
||||
#*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Microsoft Azure ApplicationInsights config file
|
||||
ApplicationInsights.config
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Target VS files:
|
||||
vsx64
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
ModelManifest.xml
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
*.filters
|
||||
/External
|
||||
/Output
|
||||
/InferenceEngineMain/models
|
||||
/Test
|
||||
/HTTPClient/*.a
|
||||
/InferenceEngineMain/newModels
|
||||
.DS_Store
|
||||
**/tags
|
||||
compile_commands.json
|
||||
bin/
|
||||
build/
|
||||
.local_vimrc
|
||||
.gdb_history
|
||||
.vimspector.json
|
||||
doc/
|
||||
!ngraph/doc
|
||||
docs/build_documentation/work_dir/
|
||||
inference-engine/plugins/
|
||||
inference-engine/report
|
||||
temp/
|
||||
.repo/
|
||||
docs/template_plugin/html/
|
||||
CMakeLists.txt.user
|
||||
docs/IE_PLUGIN_DG/html/
|
||||
inference-engine/ie_bridges/python/wheel/.env
|
||||
|
||||
*.project
|
||||
*.cproject
|
||||
*.pydevproject
|
||||
*.settings
|
||||
*/gen/
|
||||
# For IDEA
|
||||
.idea/
|
||||
VS/
|
||||
Xcode/
|
||||
temp/
|
||||
report/
|
||||
.kdev4/
|
||||
*.kdev4
|
||||
*.kate-swp
|
||||
|
||||
/lin-build
|
||||
/win-build
|
||||
/CMakeFiles
|
||||
*.stamp
|
||||
*.depend
|
||||
*.vcxproj
|
||||
*.sln
|
||||
/CMakeCache.txt
|
||||
.vimprj/
|
||||
build_IA32/
|
||||
.dir-locals.el
|
||||
GTAGS
|
||||
GPATH
|
||||
GRTAGS
|
||||
GSYMS
|
||||
compile_commands.json
|
||||
service/dot-net-service/Output
|
||||
**/sublime_build
|
||||
/.project
|
||||
.vscode/
|
||||
/vsx32
|
||||
/service/dot-net-service/.klocwork/DotNetService
|
||||
cmake-build-*/
|
||||
/lin64
|
||||
|
||||
.gdb_history
|
||||
.local_vimrc
|
||||
.ycm_extra_conf.py
|
||||
tags
|
||||
|
||||
|
||||
# from Model Optimizer repo
|
||||
.idea
|
||||
.project
|
||||
.cproject
|
||||
.pydevproject
|
||||
.settings
|
||||
/bin/
|
||||
/gen/
|
||||
__pycache__
|
||||
*.swp
|
||||
/config.xml
|
||||
|
||||
# Python-specific
|
||||
*.env3
|
||||
.env3
|
||||
*.pyc
|
||||
|
||||
# Tests-specific
|
||||
*.coverage
|
||||
*htmlcov
|
||||
*pylint_report.txt
|
||||
*pylint_report_comments.txt
|
||||
.coverage
|
||||
htmlcov
|
||||
pylint_report.txt
|
||||
pylint_report_comments.txt
|
||||
|
||||
# Documentation-generated
|
||||
docs/build
|
||||
docs/source/_static
|
||||
docs/source/_templates
|
||||
docs/source/generated/
|
||||
|
||||
# Artifacts
|
||||
/tools/mo/*.bin
|
||||
/tools/mo/*.xml
|
||||
/tools/mo/*.json
|
||||
/tools/mo/*.so
|
||||
/tools/mo/*.txt
|
||||
/tools/mo/*.pb
|
||||
/tools/mo/*.pbtxt
|
||||
/tools/mo/!CMakeLists.txt
|
||||
/tools/mo/*.mapping
|
||||
/tools/mo/*.dat
|
||||
/tools/mo/*.svg
|
||||
/*.bin
|
||||
/*.xml
|
||||
/*.json
|
||||
/*.so
|
||||
/*.txt
|
||||
/*.mapping
|
||||
/*.dat
|
||||
/*.svg
|
||||
|
||||
71
.gitmodules
vendored
71
.gitmodules
vendored
@@ -1,69 +1,8 @@
|
||||
[submodule "src/plugins/intel_cpu/thirdparty/mkl-dnn"]
|
||||
path = src/plugins/intel_cpu/thirdparty/mkl-dnn
|
||||
url = https://github.com/openvinotoolkit/oneDNN.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/xbyak"]
|
||||
path = thirdparty/xbyak
|
||||
url = https://github.com/herumi/xbyak.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/zlib/zlib"]
|
||||
path = thirdparty/zlib/zlib
|
||||
url = https://github.com/madler/zlib.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/pugixml"]
|
||||
path = thirdparty/pugixml
|
||||
url = https://github.com/zeux/pugixml.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/ade"]
|
||||
path = thirdparty/ade
|
||||
[submodule "inference-engine/thirdparty/ade"]
|
||||
path = inference-engine/thirdparty/ade
|
||||
url = https://github.com/opencv/ade.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/gflags/gflags"]
|
||||
path = thirdparty/gflags/gflags
|
||||
url = https://github.com/gflags/gflags.git
|
||||
[submodule "inference-engine/thirdparty/ngraph"]
|
||||
path = inference-engine/thirdparty/ngraph
|
||||
url = https://github.com/NervanaSystems/ngraph.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/gtest/gtest"]
|
||||
path = thirdparty/gtest/gtest
|
||||
url = https://github.com/openvinotoolkit/googletest.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/ocl/icd_loader"]
|
||||
path = thirdparty/ocl/icd_loader
|
||||
url = https://github.com/KhronosGroup/OpenCL-ICD-Loader.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/ocl/cl_headers"]
|
||||
path = thirdparty/ocl/cl_headers
|
||||
url = https://github.com/KhronosGroup/OpenCL-Headers.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/ocl/clhpp_headers"]
|
||||
path = thirdparty/ocl/clhpp_headers
|
||||
url = https://github.com/KhronosGroup/OpenCL-CLHPP.git
|
||||
ignore = dirty
|
||||
[submodule "thirdparty/onnx"]
|
||||
path = thirdparty/onnx/onnx
|
||||
url = https://github.com/onnx/onnx.git
|
||||
[submodule "thirdparty/protobuf"]
|
||||
path = thirdparty/protobuf/protobuf
|
||||
url = https://github.com/protocolbuffers/protobuf.git
|
||||
[submodule "src/bindings/python/thirdparty/pybind11"]
|
||||
path = src/bindings/python/thirdparty/pybind11
|
||||
url = https://github.com/pybind/pybind11.git
|
||||
[submodule "thirdparty/ittapi/ittapi"]
|
||||
path = thirdparty/ittapi/ittapi
|
||||
url = https://github.com/intel/ittapi.git
|
||||
[submodule "ncc"]
|
||||
path = cmake/developer_package/ncc_naming_style/ncc
|
||||
url = https://github.com/nithinn/ncc.git
|
||||
[submodule "thirdparty/onednn_gpu"]
|
||||
path = src/plugins/intel_gpu/thirdparty/onednn_gpu
|
||||
url = https://github.com/oneapi-src/oneDNN.git
|
||||
[submodule "tools/pot/thirdparty/open_model_zoo"]
|
||||
path = thirdparty/open_model_zoo
|
||||
url = https://github.com/openvinotoolkit/open_model_zoo.git
|
||||
[submodule "thirdparty/json/nlohmann_json"]
|
||||
path = thirdparty/json/nlohmann_json
|
||||
url = https://github.com/nlohmann/json.git
|
||||
shallow = true
|
||||
[submodule "thirdparty/json/nlohmann_json_schema_validator"]
|
||||
path = thirdparty/json/nlohmann_json_schema_validator
|
||||
url = https://github.com/pboettch/json-schema-validator.git
|
||||
shallow = true
|
||||
|
||||
410
.pylintrc
Normal file
410
.pylintrc
Normal file
@@ -0,0 +1,410 @@
|
||||
[MASTER]
|
||||
|
||||
# Specify a configuration file.
|
||||
#rcfile=
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
init-hook='sys.path.append(os.path.abspath(os.path.curdir))'
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# paths.
|
||||
ignore=proto, tests, docs, automation
|
||||
|
||||
# Add files or directories matching the regex patterns to the blacklist. The
|
||||
# regex matches against base names, not paths.
|
||||
ignore-patterns=.env3/*, python3.5, .*_test.py
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# List of plugins (as comma separated values of python modules names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
# Use multiple processes to speed up Pylint.
|
||||
# jobs=4
|
||||
|
||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||
# active Python interpreter and may run arbitrary code.
|
||||
unsafe-load-any-extension=no
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
# run arbitrary code
|
||||
extension-pkg-whitelist=
|
||||
|
||||
# Allow optimization of some AST trees. This will activate a peephole AST
|
||||
# optimizer, which will apply various small optimizations. For instance, it can
|
||||
# be used to obtain the result of joining multiple strings with the addition
|
||||
# operator. Joining a lot of strings can lead to a maximum recursion error in
|
||||
# Pylint and this flag can prevent that. It has one side effect, the resulting
|
||||
# AST will be different than the one from reality. This option is deprecated
|
||||
# and it will be removed in Pylint 2.0.
|
||||
optimize-ast=no
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
|
||||
confidence=
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once). See also the "--disable" option for examples.
|
||||
#enable=
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once).You can also use "--disable=all" to
|
||||
# disable everything first and then reenable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
disable=locally-disabled,too-few-public-methods,no-self-use,too-many-ancestors,
|
||||
missing-docstring,old-style-class,consider-iterating-dictionary,consider-using-enumerate,
|
||||
superfluous-parens,no-else-return,duplicate-code,wrong-import-order,
|
||||
too-many-locals,logging-not-lazy,unnecessary-lambda,super-on-old-class,ungrouped-imports,too-many-format-args,
|
||||
protected-access,too-many-statements,too-many-branches,too-many-return-statements,too-many-public-methods,
|
||||
super-init-not-called,singleton-comparison,pointless-string-statement,broad-except, invalid-name
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||
# (visual studio) and html. You can also give a reporter class, eg
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
output-format=text
|
||||
|
||||
# Put messages in a separate file for each module / package specified on the
|
||||
# command line instead of printing them on stdout. Reports (if any) will be
|
||||
# written in a file name "pylint_global.[txt|html]". This option is deprecated
|
||||
# and it will be removed in Pylint 2.0.
|
||||
files-output=no
|
||||
|
||||
# Tells whether to display a full report or only the messages
|
||||
reports=yes
|
||||
|
||||
# Python expression which should return a note less than 10 (10 is the highest
|
||||
# note). You have access to the variables errors warning, statement which
|
||||
# respectively contain the number of errors / warnings messages and the total
|
||||
# number of statements analyzed. This is used by the global evaluation report
|
||||
# (RP0004).
|
||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details
|
||||
#msg-template=
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format
|
||||
logging-modules=logging
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=8
|
||||
|
||||
# Ignore comments when computing similarities.
|
||||
ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=120
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=no
|
||||
|
||||
# List of optional constructs for which whitespace checking is disabled. `dict-
|
||||
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
|
||||
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
|
||||
# `empty-line` allows space-only lines.
|
||||
no-space-check=trailing-comma,dict-separator
|
||||
|
||||
# Maximum number of lines in a module
|
||||
max-module-lines=1000
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
indent-string=' '
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||
expected-line-ending-format=
|
||||
|
||||
|
||||
[SPELLING]
|
||||
|
||||
# Spelling dictionary name. Available dictionaries: none. To make it working
|
||||
# install python-enchant package.
|
||||
spelling-dict=en_US
|
||||
|
||||
# List of comma separated words that should not be checked.
|
||||
spelling-ignore-words=TF, MO, IR, IE
|
||||
|
||||
# A path to a file that contains private dictionary; one word per line.
|
||||
spelling-private-dict-file=.pylintdict
|
||||
|
||||
# Tells whether to store unknown words to indicated private dictionary in
|
||||
# --spelling-private-dict-file option instead of raising a message.
|
||||
spelling-store-unknown-words=no
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expectedly
|
||||
# not used).
|
||||
dummy-variables-rgx=(_+[a-zA-Z0-9]*?$)|dummy
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid to define new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
# List of strings which can identify a callback function by name. A callback
|
||||
# name must start or end with one of those strings.
|
||||
callbacks=cb_,_cb
|
||||
|
||||
# List of qualified module names which can have objects that can redefine
|
||||
# builtins.
|
||||
redefining-builtins-modules=six.moves,future.builtins
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis. It
|
||||
# supports qualified module names, as well as Unix pattern matching.
|
||||
ignored-modules=flask_sqlalchemy,app.extensions.flask_sqlalchemy
|
||||
|
||||
# List of class names for which member attributes should not be checked (useful
|
||||
# for classes with dynamically set attributes). This supports the use of
|
||||
# qualified names.
|
||||
ignored-classes=optparse.Values,thread._local,_thread._local
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=fget,query,begin,add,merge,delete,commit,rollback
|
||||
|
||||
# List of decorators that produce context managers, such as
|
||||
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||
# produce valid context managers.
|
||||
contextmanager-decorators=contextlib.contextmanager
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME,XXX,TODO
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma
|
||||
good-names=i,j,k,ex,Run,_,log,api,a,c,d,e,ei,f,hp,id,l,l2,ml,mn,n,N,op,p,pb,pb,ph,q,rt,s,s1,s2,si,u,v,wp,x,y
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma
|
||||
bad-names=foo,bar,baz,toto,tutu,tata
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name
|
||||
include-naming-hint=no
|
||||
|
||||
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||
# to this list to register other decorators that produce valid properties.
|
||||
property-classes=abc.abstractproperty
|
||||
|
||||
# Regular expression matching correct class names
|
||||
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Naming hint for class names
|
||||
class-name-hint=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Regular expression matching correct constant names
|
||||
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Naming hint for constant names
|
||||
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Regular expression matching correct argument names
|
||||
argument-rgx=([a-z_][a-z0-9_]{2,40}$)|(fileName)|(pl)|(t)
|
||||
|
||||
# Naming hint for argument names
|
||||
argument-name-hint=[a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
# Regular expression matching correct inline iteration names
|
||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Naming hint for inline iteration names
|
||||
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct method names
|
||||
method-rgx=[a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
# Naming hint for method names
|
||||
method-name-hint=[a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
# Regular expression matching correct function names
|
||||
function-rgx=([a-z_][a-z0-9_]{2,40}$)
|
||||
|
||||
# Naming hint for function names
|
||||
function-name-hint=[a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
# Regular expression matching correct class attribute names
|
||||
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,40}|(__.*__))$
|
||||
|
||||
# Naming hint for class attribute names
|
||||
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,40}|(__.*__))$
|
||||
|
||||
# Regular expression matching correct attribute names
|
||||
attr-rgx=[a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
# Naming hint for attribute names
|
||||
attr-name-hint=[a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
# Regular expression matching correct variable names
|
||||
variable-rgx=[a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
# Naming hint for variable names
|
||||
variable-name-hint=[a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
# Regular expression matching correct module names
|
||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Naming hint for module names
|
||||
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=^_
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=5
|
||||
|
||||
|
||||
[ELIF]
|
||||
|
||||
# Maximum number of nested blocks for function / method body
|
||||
max-nested-blocks=5
|
||||
|
||||
|
||||
[DESIGN]
|
||||
|
||||
# Maximum number of arguments for function / method
|
||||
max-args=5
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore
|
||||
ignored-argument-names=_.*
|
||||
|
||||
# Maximum number of locals for function / method body
|
||||
max-locals=15
|
||||
|
||||
# Maximum number of return / yield for function / method body
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of branch for function / method body
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of statements in function / method body
|
||||
max-statements=50
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=10
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=7
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=2
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
# Maximum number of boolean expressions in a if statement
|
||||
max-bool-expr=5
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma
|
||||
deprecated-modules=optparse
|
||||
|
||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||
# given file (report RP0402 must not be disabled)
|
||||
import-graph=
|
||||
|
||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
ext-import-graph=
|
||||
|
||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
int-import-graph=
|
||||
|
||||
# Force import order to recognize a module as part of the standard
|
||||
# compatibility libraries.
|
||||
known-standard-library=
|
||||
|
||||
# Force import order to recognize a module as part of a third party library.
|
||||
known-third-party=flask_restplus_patched
|
||||
|
||||
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
||||
# 3 compatible code, which means that the block might have code that exists
|
||||
# only in one or another interpreter, leading to false positives when analysed.
|
||||
analyse-fallback-blocks=no
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,__new__,setUp
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=mcs
|
||||
|
||||
# List of member names, which should be excluded from the protected access
|
||||
# warning.
|
||||
exclude-protected=_asdict,_fields,_replace,_source,_make
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "Exception"
|
||||
overgeneral-exceptions=Exception
|
||||
114
CMakeLists.txt
114
CMakeLists.txt
@@ -1,114 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(DEFINED BUILD_SHARED_LIBS AND NOT BUILD_SHARED_LIBS)
|
||||
# 'target_link_libraries' does not work correctly when called from
|
||||
# different directly where 'add_library' is called: CMake generates
|
||||
# incorrect OpenVINOConfig.cmake in this case
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
else()
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
endif()
|
||||
|
||||
project(OpenVINO DESCRIPTION "OpenVINO toolkit")
|
||||
|
||||
set(IE_MAIN_SOURCE_DIR ${OpenVINO_SOURCE_DIR}/inference-engine)
|
||||
|
||||
find_package(IEDevScripts REQUIRED
|
||||
PATHS "${OpenVINO_SOURCE_DIR}/cmake/developer_package"
|
||||
NO_CMAKE_FIND_ROOT_PATH
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
include(CTest)
|
||||
include(cmake/features.cmake)
|
||||
|
||||
# These options are shared with 3rdparty plugins by means of developer package
|
||||
include(cmake/dependencies.cmake)
|
||||
|
||||
if(ENABLE_COVERAGE)
|
||||
include(cmake/coverage.cmake)
|
||||
endif()
|
||||
|
||||
# resolving dependencies for the project
|
||||
message (STATUS "PROJECT ............................... " ${PROJECT_NAME})
|
||||
message (STATUS "CMAKE_VERSION ......................... " ${CMAKE_VERSION})
|
||||
message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
|
||||
message (STATUS "OpenVINO_SOURCE_DIR ................... " ${OpenVINO_SOURCE_DIR})
|
||||
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
|
||||
message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID})
|
||||
message (STATUS "CMAKE_CXX_COMPILER_ID ................. " ${CMAKE_CXX_COMPILER_ID})
|
||||
message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE})
|
||||
message (STATUS "CMAKE_TOOLCHAIN_FILE .................. " ${CMAKE_TOOLCHAIN_FILE})
|
||||
|
||||
# remove file with exported developer targets to force its regeneration
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/ngraph/ngraphTargets.cmake")
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake")
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
|
||||
foreach(component IN LISTS openvino_export_components)
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake")
|
||||
unset(${component} CACHE)
|
||||
endforeach()
|
||||
unset(openvino_export_components CACHE)
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
|
||||
function(openvino_developer_export_targets)
|
||||
cmake_parse_arguments(EXPORT "" "COMPONENT" "TARGETS" ${ARGN})
|
||||
|
||||
if(EXPORT_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "openvino_developer_export_targets has unparsed arguments: ${EXPORT_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
set(${EXPORT_COMPONENT} "${${EXPORT_COMPONENT}};${EXPORT_TARGETS}")
|
||||
|
||||
# to allow exporting of aliased targets with the original names
|
||||
foreach(target_name IN LISTS ${EXPORT_COMPONENT})
|
||||
if(TARGET "${target_name}")
|
||||
get_target_property(original_name ${target_name} ALIASED_TARGET)
|
||||
if(TARGET "${original_name}")
|
||||
message(STATUS "The name ${target_name} is an ALIAS for ${original_name}. "
|
||||
"It will be exported to the InferenceEngineDeveloperPackage with the original name.")
|
||||
list(REMOVE_ITEM ${EXPORT_COMPONENT} ${target_name})
|
||||
list(APPEND ${EXPORT_COMPONENT} ${original_name})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES ${EXPORT_COMPONENT})
|
||||
set(${EXPORT_COMPONENT} "${${EXPORT_COMPONENT}}" CACHE INTERNAL
|
||||
"A list of OpenVINO ${EXPORT_COMPONENT} exported targets" FORCE)
|
||||
|
||||
list(APPEND openvino_export_components ${EXPORT_COMPONENT})
|
||||
list(REMOVE_DUPLICATES openvino_export_components)
|
||||
set(openvino_export_components "${openvino_export_components}" CACHE INTERNAL
|
||||
"A list of OpenVINO exported components" FORCE)
|
||||
endfunction()
|
||||
|
||||
# add target with processed tests model zoo
|
||||
include(cmake/test_model_zoo.cmake)
|
||||
|
||||
add_subdirectory(thirdparty)
|
||||
add_subdirectory(inference-engine/thirdparty)
|
||||
add_subdirectory(inference-engine/src)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(inference-engine)
|
||||
|
||||
# Enable interpreter backend
|
||||
if (ENABLE_TESTS OR ENABLE_TEMPLATE)
|
||||
add_subdirectory(docs/template_plugin/backend)
|
||||
endif()
|
||||
include(cmake/extra_modules.cmake)
|
||||
add_subdirectory(docs)
|
||||
add_subdirectory(tools)
|
||||
add_subdirectory(scripts)
|
||||
add_subdirectory(licensing)
|
||||
|
||||
#
|
||||
# CPack
|
||||
#
|
||||
|
||||
ie_cpack(${IE_CPACK_COMPONENTS_ALL})
|
||||
85
CODEOWNERS
85
CODEOWNERS
@@ -1,85 +0,0 @@
|
||||
# See help here: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
|
||||
|
||||
* @openvinotoolkit/openvino-maintainers
|
||||
|
||||
CODEOWNERS @openvinotoolkit/openvino-admins @openvinotoolkit/openvino-maintainers
|
||||
|
||||
# CI:
|
||||
Jenkinsfile @openvinotoolkit/openvino-admins
|
||||
/.github/ @openvinotoolkit/openvino-admins
|
||||
/.ci/ @openvinotoolkit/openvino-admins
|
||||
|
||||
# OpenVINO Samples:
|
||||
/samples/ @openvinotoolkit/openvino-samples-maintainers
|
||||
|
||||
# OpenVINO Scripts:
|
||||
/scripts/ @openvinotoolkit/openvino-scripts-maintainers
|
||||
|
||||
# QA Tests:
|
||||
/tests/ @openvinotoolkit/openvino-tests-maintainers
|
||||
|
||||
# Tools:
|
||||
/tools/ @openvinotoolkit/openvino-tools-maintainers
|
||||
|
||||
# Model Optimizer:
|
||||
/tools/mo/ @openvinotoolkit/openvino-mo-maintainers
|
||||
|
||||
# POT:
|
||||
/tools/pot/ @openvinotoolkit/openvino-pot-maintainers
|
||||
|
||||
# IE Core:
|
||||
/inference-engine/ @openvinotoolkit/openvino-ie-maintainers
|
||||
/inference-engine/ie_bridges/python @openvinotoolkit/openvino-ie-python-api-maintainers
|
||||
/src/common/transformations/ @GlebKazantaev @ilyachur
|
||||
/src/common/legacy/ @openvinotoolkit/openvino-ngraph-maintainers
|
||||
/src/common/ @openvinotoolkit/openvino-ie-maintainers
|
||||
/src/core/ @openvinotoolkit/openvino-ngraph-maintainers
|
||||
/src/frontends/ @openvinotoolkit/openvino-ngraph-maintainers
|
||||
/src/tests_deprecated/readers/ @openvinotoolkit/openvino-ngraph-maintainers
|
||||
|
||||
# IE CPU:
|
||||
/src/plugins/intel_cpu/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers
|
||||
/src/common/low_precision_transformations/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers
|
||||
/src/plugins/intel_cpu/thirdparty/mkl-dnn/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers
|
||||
|
||||
# IE GPU:
|
||||
/src/inference/include/ie/gpu/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers
|
||||
/src/inference/include/ie/cldnn/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers
|
||||
/src/inference/include/openvino/runtime/intel_gpu/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers
|
||||
/src/plugins/intel_gpu/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers
|
||||
|
||||
# IE VPU:
|
||||
/inference-engine/src/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers
|
||||
/src/inference/include/ie/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers
|
||||
/inference-engine/thirdparty/movidius/ @openvinotoolkit/openvino-ie-vpu-maintainers
|
||||
/src/tests_deprecated/unit/engines/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
|
||||
/src/tests_deprecated/functional/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
|
||||
/src/tests_deprecated/behavior/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
|
||||
/src/tests/functional/plugin/myriad/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
|
||||
/src/tests/unit/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
|
||||
/src/tests/unit/engines/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
|
||||
/inference-engine/scripts/run_tests_myriad_multistick.sh @openvinotoolkit/openvino-ie-vpu-maintainers
|
||||
|
||||
# IE GNA:
|
||||
/src/plugins/intel_gna/ @openvinotoolkit/openvino-ie-gna-maintainers
|
||||
/src/inference/include/ie/gna/ @openvinotoolkit/openvino-ie-gna-maintainers
|
||||
|
||||
# IE MULTI:
|
||||
/src/plugins/auto/ @openvinotoolkit/openvino-ie-multi-maintainers
|
||||
/src/inference/include/ie/multi-device/ @openvinotoolkit/openvino-ie-multi-maintainers
|
||||
|
||||
# IE Tests:
|
||||
/src/tests/ @openvinotoolkit/openvino-ie-tests-maintainers
|
||||
/src/tests_deprecated/ @openvinotoolkit/openvino-ie-tests-maintainers
|
||||
/src/tests/functional/inference_engine/ngraph_reader/ @openvinotoolkit/openvino-ie-tests-maintainers @openvinotoolkit/openvino-ngraph-maintainers
|
||||
/src/tests/functional/inference_engine/transformations/ @openvinotoolkit/openvino-ie-tests-maintainers @openvinotoolkit/openvino-ngraph-maintainers
|
||||
|
||||
# Documentation:
|
||||
/docs/ @openvinotoolkit/openvino-docs-maintainers
|
||||
/docs/template_plugin/ @openvinotoolkit/openvino-ie-template-maintainers
|
||||
*.md @openvinotoolkit/openvino-docs-maintainers
|
||||
|
||||
# Control 3d party dependencies
|
||||
**/*requirements*.* @openvino-configuration-mgmt
|
||||
**/setup.py @openvino-configuration-mgmt
|
||||
/scripts/install_dependencies/ @openvino-configuration-mgmt
|
||||
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@@ -1,19 +0,0 @@
|
||||
#!groovy
|
||||
|
||||
properties([
|
||||
parameters([
|
||||
booleanParam(defaultValue: false,
|
||||
description: 'Cancel the rest of parallel stages if one of them fails and return status immediately',
|
||||
name: 'failFast'),
|
||||
booleanParam(defaultValue: true,
|
||||
description: 'Whether to propagate commit status to GitHub',
|
||||
name: 'propagateStatus'),
|
||||
string(defaultValue: '',
|
||||
description: 'Pipeline shared library version (branch/tag/commit). Determined automatically if empty',
|
||||
name: 'library_version')
|
||||
])
|
||||
])
|
||||
|
||||
loadOpenVinoLibrary {
|
||||
entrypoint(this)
|
||||
}
|
||||
63
README.md
63
README.md
@@ -1,51 +1,42 @@
|
||||
# OpenVINO™ Toolkit
|
||||
[](https://github.com/openvinotoolkit/openvino/releases/tag/2021.4.2)
|
||||
# [OpenVINO™ Toolkit](https://01.org/openvinotoolkit) - Deep Learning Deployment Toolkit repository
|
||||
[](https://github.com/opencv/dldt/releases/tag/2019_R3)
|
||||
[](LICENSE)
|
||||

|
||||

|
||||
[](https://pepy.tech/project/openvino)
|
||||
|
||||
This toolkit allows developers to deploy pre-trained deep learning models
|
||||
through a high-level C++ Inference Engine API integrated with application logic.
|
||||
This toolkit allows developers to deploy pre-trained deep learning models through a high-level C++ Inference Engine API integrated with application logic.
|
||||
|
||||
This open source version includes several components: namely [Model Optimizer], [nGraph] and
|
||||
[Inference Engine], as well as CPU, GPU, MYRIAD, multi device and heterogeneous plugins to accelerate deep learning inferencing on Intel® CPUs and Intel® Processor Graphics.
|
||||
It supports pre-trained models from the [Open Model Zoo], along with 100+ open
|
||||
source and public models in popular formats such as Caffe\*, TensorFlow\*,
|
||||
MXNet\* and ONNX\*.
|
||||
This open source version includes two components, namely Model Optimizer and Inference Engine, as well as CPU, GPU and heterogeneous plugins to accelerate deep learning inferencing on Intel(R) CPUs and Intel(R) Processor Graphics. It supports pre-trained models from the [Open Model Zoo](https://github.com/opencv/open_model_zoo/) along with 100+ open source and public models in popular formats such as Caffe*, Tensorflow*, MXNet* and ONNX*.
|
||||
|
||||
## Repository components:
|
||||
* [Inference Engine]
|
||||
* [nGraph]
|
||||
* [Model Optimizer]
|
||||
* [Inference Engine](https://software.intel.com/en-us/articles/OpenVINO-InferEngine)
|
||||
* [Model Optimizer](https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer)
|
||||
|
||||
## License
|
||||
Deep Learning Deployment Toolkit is licensed under [Apache License Version 2.0](LICENSE).
|
||||
By contributing to the project, you agree to the license and copyright terms therein
|
||||
and release your contribution under these terms.
|
||||
|
||||
## Resources:
|
||||
* Docs: https://docs.openvinotoolkit.org/
|
||||
* Wiki: https://github.com/openvinotoolkit/openvino/wiki
|
||||
* Issue tracking: https://github.com/openvinotoolkit/openvino/issues
|
||||
* Storage: https://storage.openvinotoolkit.org/
|
||||
* Additional OpenVINO™ modules: https://github.com/openvinotoolkit/openvino_contrib
|
||||
* [Intel® Distribution of OpenVINO™ toolkit Product Page](https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit.html)
|
||||
* [Intel® Distribution of OpenVINO™ toolkit Release Notes](https://software.intel.com/en-us/articles/OpenVINO-RelNotes)
|
||||
## Documentation
|
||||
* [OpenVINO™ Release Notes](https://software.intel.com/en-us/articles/OpenVINO-RelNotes)
|
||||
* [Inference Engine build instructions](inference-engine/README.md)
|
||||
* [Get Started with Deep Learning Deployment Toolkit on Linux*](get-started-linux.md)
|
||||
* [Introduction to Deep Learning Deployment Toolkit](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Introduction.html)
|
||||
* [Inference Engine Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Deep_Learning_Inference_Engine_DevGuide.html)
|
||||
* [Model Optimizer Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html)
|
||||
|
||||
|
||||
## How to Contribute
|
||||
We welcome community contributions to the Deep Learning Deployment Toolkit repository. If you have an idea how to improve the product, please share it with us doing the following steps:
|
||||
* Make sure you can build the product and run all tests and samples with your patch
|
||||
* In case of a larger feature, provide a relevant unit tests and sample
|
||||
* Submit a pull request at https://github.com/opencv/dldt/pulls
|
||||
|
||||
We will review your contribution and, if any additional fixes or modifications are necessary, may give some feedback to guide you. When accepted, your pull request will be merged into GitHub* repositories.
|
||||
|
||||
Deep Learning Deployment Toolkit is licensed under Apache License, Version 2.0. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
|
||||
|
||||
## Support
|
||||
Please report questions, issues and suggestions using:
|
||||
|
||||
* The [`openvino`](https://stackoverflow.com/questions/tagged/openvino) tag on StackOverflow\*
|
||||
* [GitHub* Issues](https://github.com/openvinotoolkit/openvino/issues)
|
||||
* [\#openvino](https://stackoverflow.com/search?q=%23openvino) tag on StackOverflow*
|
||||
* [GitHub* Issues](https://github.com/opencv/dldt/issues)
|
||||
* [Forum](https://software.intel.com/en-us/forums/computer-vision)
|
||||
|
||||
---
|
||||
\* Other names and brands may be claimed as the property of others.
|
||||
|
||||
[Open Model Zoo]:https://github.com/openvinotoolkit/open_model_zoo
|
||||
[Inference Engine]:https://software.intel.com/en-us/articles/OpenVINO-InferEngine
|
||||
[Model Optimizer]:https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer
|
||||
[nGraph]:https://docs.openvinotoolkit.org/latest/openvino_docs_nGraph_DG_DevGuide.html
|
||||
[tag on StackOverflow]:https://stackoverflow.com/search?q=%23openvino
|
||||
|
||||
\* Other names and brands may be claimed as the property of others.
|
||||
12
SECURITY.md
12
SECURITY.md
@@ -1,12 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Report a Vulnerability
|
||||
|
||||
Please report security issues or vulnerabilities to the [Intel® Security Center].
|
||||
|
||||
For more information on how Intel® works to resolve security issues, see
|
||||
[Vulnerability Handling Guidelines].
|
||||
|
||||
[Intel® Security Center]:https://www.intel.com/security
|
||||
|
||||
[Vulnerability Handling Guidelines]:https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html
|
||||
@@ -1,73 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR armv7l)
|
||||
|
||||
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
|
||||
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
macro(__cmake_find_root_save_and_reset)
|
||||
foreach(v
|
||||
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
|
||||
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
|
||||
)
|
||||
set(__save_${v} ${${v}})
|
||||
set(${v} NEVER)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(__cmake_find_root_restore)
|
||||
foreach(v
|
||||
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
|
||||
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
|
||||
)
|
||||
set(${v} ${__save_${v}})
|
||||
unset(__save_${v})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
# macro to find programs on the host OS
|
||||
macro(find_host_program)
|
||||
__cmake_find_root_save_and_reset()
|
||||
if(CMAKE_HOST_WIN32)
|
||||
SET(WIN32 1)
|
||||
SET(UNIX)
|
||||
elseif(CMAKE_HOST_APPLE)
|
||||
SET(APPLE 1)
|
||||
SET(UNIX)
|
||||
endif()
|
||||
find_program(${ARGN})
|
||||
SET(WIN32)
|
||||
SET(APPLE)
|
||||
SET(UNIX 1)
|
||||
__cmake_find_root_restore()
|
||||
endmacro()
|
||||
|
||||
# macro to find packages on the host OS
|
||||
macro(find_host_package)
|
||||
__cmake_find_root_save_and_reset()
|
||||
if(CMAKE_HOST_WIN32)
|
||||
SET(WIN32 1)
|
||||
SET(UNIX)
|
||||
elseif(CMAKE_HOST_APPLE)
|
||||
SET(APPLE 1)
|
||||
SET(UNIX)
|
||||
endif()
|
||||
find_package(${ARGN})
|
||||
SET(WIN32)
|
||||
SET(APPLE)
|
||||
SET(UNIX 1)
|
||||
__cmake_find_root_restore()
|
||||
endmacro()
|
||||
@@ -1,73 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
|
||||
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
macro(__cmake_find_root_save_and_reset)
|
||||
foreach(v
|
||||
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
|
||||
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
|
||||
)
|
||||
set(__save_${v} ${${v}})
|
||||
set(${v} NEVER)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(__cmake_find_root_restore)
|
||||
foreach(v
|
||||
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
|
||||
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
|
||||
)
|
||||
set(${v} ${__save_${v}})
|
||||
unset(__save_${v})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
# macro to find programs on the host OS
|
||||
macro(find_host_program)
|
||||
__cmake_find_root_save_and_reset()
|
||||
if(CMAKE_HOST_WIN32)
|
||||
SET(WIN32 1)
|
||||
SET(UNIX)
|
||||
elseif(CMAKE_HOST_APPLE)
|
||||
SET(APPLE 1)
|
||||
SET(UNIX)
|
||||
endif()
|
||||
find_program(${ARGN})
|
||||
SET(WIN32)
|
||||
SET(APPLE)
|
||||
SET(UNIX 1)
|
||||
__cmake_find_root_restore()
|
||||
endmacro()
|
||||
|
||||
# macro to find packages on the host OS
|
||||
macro(find_host_package)
|
||||
__cmake_find_root_save_and_reset()
|
||||
if(CMAKE_HOST_WIN32)
|
||||
SET(WIN32 1)
|
||||
SET(UNIX)
|
||||
elseif(CMAKE_HOST_APPLE)
|
||||
SET(APPLE 1)
|
||||
SET(UNIX)
|
||||
endif()
|
||||
find_package(${ARGN})
|
||||
SET(WIN32)
|
||||
SET(APPLE)
|
||||
SET(UNIX 1)
|
||||
__cmake_find_root_restore()
|
||||
endmacro()
|
||||
@@ -1,93 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(OV_COVERAGE_BASE_DIRECTORY "${OpenVINO_SOURCE_DIR}")
|
||||
|
||||
ie_coverage_clean(REPOSITORY "openvino"
|
||||
DIRECTORY "${OV_COVERAGE_GCDA_DATA_DIRECTORY}")
|
||||
ie_coverage_capture(INFO_FILE "openvino"
|
||||
BASE_DIRECTORY "${OV_COVERAGE_BASE_DIRECTORY}"
|
||||
DIRECTORY "${OV_COVERAGE_GCDA_DATA_DIRECTORY}")
|
||||
|
||||
# Generate reports
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "inference"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/inference/*")
|
||||
|
||||
ie_coverage_genhtml(INFO_FILE "inference"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "legacy"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/common/legacy/*")
|
||||
ie_coverage_genhtml(INFO_FILE "legacy"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "ov_hetero_plugin"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/plugins/hetero/*")
|
||||
ie_coverage_genhtml(INFO_FILE "ov_hetero_plugin"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "ov_auto_plugin"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/plugins/auto/*")
|
||||
ie_coverage_genhtml(INFO_FILE "ov_auto_plugin"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "preprocessing"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}src/common/preprocessing/*")
|
||||
ie_coverage_genhtml(INFO_FILE "preprocessing"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "transformations"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/common/transformations/*")
|
||||
ie_coverage_genhtml(INFO_FILE "transformations"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "snippets"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/common/snippets/*")
|
||||
ie_coverage_genhtml(INFO_FILE "snippets"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "low_precision_transformations"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/common/low_precision_transformations/*")
|
||||
ie_coverage_genhtml(INFO_FILE "low_precision_transformations"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "template_plugin"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/docs/template_plugin/*")
|
||||
ie_coverage_genhtml(INFO_FILE "template_plugin"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
if(ENABLE_INTEL_CPU)
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "intel_cpu_plugin"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/plugins/intel_cpu/*")
|
||||
ie_coverage_genhtml(INFO_FILE "intel_cpu_plugin"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
if (ENABLE_INTEL_GPU)
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "intel_gpu_plugin"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/plugins/intel_gpu/*")
|
||||
ie_coverage_genhtml(INFO_FILE "intel_gpu_plugin"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
if(ENABLE_INTEL_GNA)
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "ov_intel_gna_plugin"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/plugins/intel_gna/*")
|
||||
ie_coverage_genhtml(INFO_FILE "ov_intel_gna_plugin"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "core"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/core/*")
|
||||
ie_coverage_genhtml(INFO_FILE "core"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
|
||||
if(ENABLE_OV_ONNX_FRONTEND)
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "onnx"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/frontends/onnx/*"
|
||||
"${OV_COVERAGE_BASE_DIRECTORY}/src/frontends/onnx/*")
|
||||
ie_coverage_genhtml(INFO_FILE "onnx"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
endif()
|
||||
@@ -1,297 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
|
||||
# TODO: fix it
|
||||
set_temp_directory(TEMP "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
if(ENABLE_SAME_BRANCH_FOR_MODELS)
|
||||
branchName(MODELS_BRANCH)
|
||||
else()
|
||||
set(MODELS_BRANCH "master")
|
||||
endif()
|
||||
|
||||
if(ENABLE_DATA)
|
||||
add_models_repo(${ENABLE_DATA} "data:https://github.com/openvinotoolkit/testdata.git")
|
||||
set(MODELS_PATH "${TEMP}/models/src/data")
|
||||
set(DATA_PATH "${MODELS_PATH}")
|
||||
endif()
|
||||
|
||||
message(STATUS "MODELS_PATH=" ${MODELS_PATH})
|
||||
|
||||
fetch_models_and_validation_set()
|
||||
|
||||
if(COMMAND get_linux_name)
|
||||
get_linux_name(LINUX_OS_NAME)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING AND CMAKE_HOST_SYSTEM_NAME MATCHES Linux AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
|
||||
set(protoc_version "3.9.2")
|
||||
|
||||
RESOLVE_DEPENDENCY(SYSTEM_PROTOC_ROOT
|
||||
ARCHIVE_LIN "protoc-${protoc_version}-linux-x86_64.tar.gz"
|
||||
TARGET_PATH "${TEMP}/protoc-${protoc_version}-linux-x86_64"
|
||||
SHA256 "1d6da1d97d0cbfcd333558afe24533eb3cb48dc1e0ab5e971aa1e50ede8bcf45"
|
||||
)
|
||||
debug_message(STATUS "host protoc-${protoc_version} root path = " ${SYSTEM_PROTOC_ROOT})
|
||||
|
||||
reset_deps_cache(SYSTEM_PROTOC)
|
||||
|
||||
find_host_program(
|
||||
SYSTEM_PROTOC
|
||||
NAMES protoc
|
||||
PATHS "${SYSTEM_PROTOC_ROOT}/bin"
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT SYSTEM_PROTOC)
|
||||
message(FATAL_ERROR "[ONNX IMPORTER] Missing host protoc binary")
|
||||
endif()
|
||||
|
||||
update_deps_cache(SYSTEM_PROTOC "${SYSTEM_PROTOC}" "Path to host protoc for ONNX Importer")
|
||||
endif()
|
||||
|
||||
if(ENABLE_MYRIAD)
|
||||
include(${IE_MAIN_SOURCE_DIR}/cmake/vpu_dependencies.cmake)
|
||||
endif()
|
||||
|
||||
## Intel OMP package
|
||||
if(THREADING STREQUAL "OMP")
|
||||
reset_deps_cache(OMP)
|
||||
if(WIN32 AND X86_64)
|
||||
RESOLVE_DEPENDENCY(OMP
|
||||
ARCHIVE_WIN "iomp.zip"
|
||||
TARGET_PATH "${TEMP}/omp"
|
||||
ENVIRONMENT "OMP"
|
||||
VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*"
|
||||
SHA256 "62c68646747fb10f19b53217cb04a1e10ff93606f992e6b35eb8c31187c68fbf")
|
||||
elseif(LINUX AND X86_64)
|
||||
RESOLVE_DEPENDENCY(OMP
|
||||
ARCHIVE_LIN "iomp.tgz"
|
||||
TARGET_PATH "${TEMP}/omp"
|
||||
ENVIRONMENT "OMP"
|
||||
VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*"
|
||||
SHA256 "7832b16d82513ee880d97c27c7626f9525ebd678decf6a8fe6c38550f73227d9")
|
||||
elseif(APPLE AND X86_64)
|
||||
RESOLVE_DEPENDENCY(OMP
|
||||
ARCHIVE_MAC "iomp_20190130_mac.tgz"
|
||||
TARGET_PATH "${TEMP}/omp"
|
||||
ENVIRONMENT "OMP"
|
||||
VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*"
|
||||
SHA256 "591ea4a7e08bbe0062648916f42bded71d24c27f00af30a8f31a29b5878ea0cc")
|
||||
else()
|
||||
message(FATAL_ERROR "Intel OMP is not available on current platform")
|
||||
endif()
|
||||
update_deps_cache(OMP "${OMP}" "Path to OMP root folder")
|
||||
debug_message(STATUS "intel_omp=" ${OMP})
|
||||
|
||||
ie_cpack_add_component(omp REQUIRED)
|
||||
file(GLOB_RECURSE source_list "${OMP}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
|
||||
install(FILES ${source_list}
|
||||
DESTINATION "runtime/3rdparty/omp/lib"
|
||||
COMPONENT omp)
|
||||
endif()
|
||||
|
||||
## TBB package
|
||||
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
|
||||
reset_deps_cache(TBBROOT TBB_DIR)
|
||||
|
||||
if(DEFINED ENV{THIRDPARTY_SERVER_PATH})
|
||||
set(IE_PATH_TO_DEPS "$ENV{THIRDPARTY_SERVER_PATH}")
|
||||
elseif(DEFINED THIRDPARTY_SERVER_PATH)
|
||||
set(IE_PATH_TO_DEPS "${THIRDPARTY_SERVER_PATH}")
|
||||
endif()
|
||||
|
||||
if(WIN32 AND X86_64)
|
||||
# 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")
|
||||
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"
|
||||
TARGET_PATH "${TEMP}/tbb"
|
||||
ENVIRONMENT "TBBROOT"
|
||||
SHA256 "f42d084224cc2d643314bd483ad180b081774608844000f132859fca3e9bf0ce")
|
||||
elseif(LINUX AND X86_64)
|
||||
RESOLVE_DEPENDENCY(TBB
|
||||
ARCHIVE_LIN "tbb2020_20200415_lin_strip.tgz"
|
||||
TARGET_PATH "${TEMP}/tbb"
|
||||
ENVIRONMENT "TBBROOT"
|
||||
SHA256 "95b2f3b0b70c7376a0c7de351a355c2c514b42c4966e77e3e34271a599501008")
|
||||
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"
|
||||
TARGET_PATH "${TEMP}/tbb_yocto"
|
||||
ENVIRONMENT "TBBROOT"
|
||||
SHA256 "321261ff2eda6d4568a473cb883262bce77a93dac599f7bd65d2918bdee4d75b")
|
||||
elseif(APPLE AND X86_64)
|
||||
RESOLVE_DEPENDENCY(TBB
|
||||
ARCHIVE_MAC "tbb2020_20200404_mac.tgz"
|
||||
TARGET_PATH "${TEMP}/tbb"
|
||||
ENVIRONMENT "TBBROOT"
|
||||
SHA256 "ad9cf52e657660058aa6c6844914bc0fc66241fec89a392d8b79a7ff69c3c7f6")
|
||||
else()
|
||||
message(FATAL_ERROR "TBB is not available on current platform")
|
||||
endif()
|
||||
|
||||
update_deps_cache(TBBROOT "${TBB}" "Path to TBB root folder")
|
||||
if(EXISTS "${TBBROOT}/lib/cmake/TBB/TBBConfig.cmake")
|
||||
# oneTBB case
|
||||
update_deps_cache(TBB_DIR "${TBB}/lib/cmake/TBB" "Path to TBB cmake folder")
|
||||
else()
|
||||
update_deps_cache(TBB_DIR "${TBB}/cmake" "Path to TBB cmake folder")
|
||||
endif()
|
||||
|
||||
update_deps_cache(TBBBIND_2_5_DIR "${TBBBIND_2_5}/cmake" "Path to TBBBIND_2_5 cmake folder")
|
||||
debug_message(STATUS "tbb=" ${TBB})
|
||||
|
||||
if(DEFINED IE_PATH_TO_DEPS)
|
||||
unset(IE_PATH_TO_DEPS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
## OpenCV
|
||||
if(ENABLE_OPENCV)
|
||||
reset_deps_cache(OpenCV_DIR)
|
||||
|
||||
set(OPENCV_VERSION "4.5.2")
|
||||
set(OPENCV_BUILD "076")
|
||||
set(OPENCV_BUILD_YOCTO "772")
|
||||
|
||||
if(AARCH64)
|
||||
if(DEFINED ENV{THIRDPARTY_SERVER_PATH})
|
||||
set(IE_PATH_TO_DEPS "$ENV{THIRDPARTY_SERVER_PATH}")
|
||||
elseif(DEFINED THIRDPARTY_SERVER_PATH)
|
||||
set(IE_PATH_TO_DEPS "${THIRDPARTY_SERVER_PATH}")
|
||||
else()
|
||||
message(WARNING "OpenCV is not found!")
|
||||
endif()
|
||||
|
||||
if(DEFINED IE_PATH_TO_DEPS)
|
||||
set(OPENCV_SUFFIX "yocto_kmb")
|
||||
set(OPENCV_BUILD "${OPENCV_BUILD_YOCTO}")
|
||||
|
||||
RESOLVE_DEPENDENCY(OPENCV
|
||||
ARCHIVE_LIN "opencv/opencv_${OPENCV_VERSION}-${OPENCV_BUILD}_${OPENCV_SUFFIX}.txz"
|
||||
TARGET_PATH "${TEMP}/opencv_${OPENCV_VERSION}_${OPENCV_SUFFIX}/opencv"
|
||||
ENVIRONMENT "OpenCV_DIR"
|
||||
VERSION_REGEX ".*_([0-9]+.[0-9]+.[0-9]+).*"
|
||||
SHA256 "23c250796ad5fc9db810e1680ccdb32c45dc0e50cace5e0f02b30faf652fe343")
|
||||
|
||||
unset(IE_PATH_TO_DEPS)
|
||||
endif()
|
||||
else()
|
||||
if(WIN32 AND X86_64)
|
||||
RESOLVE_DEPENDENCY(OPENCV
|
||||
ARCHIVE_WIN "opencv/opencv_${OPENCV_VERSION}-${OPENCV_BUILD}.txz"
|
||||
TARGET_PATH "${TEMP}/opencv_${OPENCV_VERSION}/opencv"
|
||||
ENVIRONMENT "OpenCV_DIR"
|
||||
VERSION_REGEX ".*_([0-9]+.[0-9]+.[0-9]+).*"
|
||||
SHA256 "a14f872e6b63b6ac12c7ff47fa49e578d14c14433b57f5d85ab5dd48a079938c")
|
||||
elseif(APPLE AND X86_64)
|
||||
RESOLVE_DEPENDENCY(OPENCV
|
||||
ARCHIVE_MAC "opencv/opencv_${OPENCV_VERSION}-${OPENCV_BUILD}_osx.txz"
|
||||
TARGET_PATH "${TEMP}/opencv_${OPENCV_VERSION}_osx/opencv"
|
||||
ENVIRONMENT "OpenCV_DIR"
|
||||
VERSION_REGEX ".*_([0-9]+.[0-9]+.[0-9]+).*"
|
||||
SHA256 "3e162f96e86cba8836618134831d9cf76df0438778b3e27e261dedad9254c514")
|
||||
elseif(LINUX)
|
||||
if(AARCH64)
|
||||
set(OPENCV_SUFFIX "yocto_kmb")
|
||||
set(OPENCV_BUILD "${OPENCV_BUILD_YOCTO}")
|
||||
elseif(ARM)
|
||||
set(OPENCV_SUFFIX "debian9arm")
|
||||
set(OPENCV_HASH "4274f8c40b17215f4049096b524e4a330519f3e76813c5a3639b69c48633d34e")
|
||||
elseif((LINUX_OS_NAME STREQUAL "CentOS 7" OR
|
||||
CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") AND X86_64)
|
||||
set(OPENCV_SUFFIX "centos7")
|
||||
set(OPENCV_HASH "5fa76985c84fe7c64531682ef0b272510c51ac0d0565622514edf1c88b33404a")
|
||||
elseif(LINUX_OS_NAME MATCHES "CentOS 8" AND X86_64)
|
||||
set(OPENCV_SUFFIX "centos8")
|
||||
set(OPENCV_HASH "db087dfd412eedb8161636ec083ada85ff278109948d1d62a06b0f52e1f04202")
|
||||
elseif(LINUX_OS_NAME STREQUAL "Ubuntu 16.04" AND X86_64)
|
||||
set(OPENCV_SUFFIX "ubuntu16")
|
||||
set(OPENCV_HASH "cd46831b4d8d1c0891d8d22ff5b2670d0a465a8a8285243059659a50ceeae2c3")
|
||||
elseif(LINUX_OS_NAME STREQUAL "Ubuntu 18.04" AND X86_64)
|
||||
set(OPENCV_SUFFIX "ubuntu18")
|
||||
set(OPENCV_HASH "db087dfd412eedb8161636ec083ada85ff278109948d1d62a06b0f52e1f04202")
|
||||
elseif((LINUX_OS_NAME STREQUAL "Ubuntu 20.04" OR LINUX_OS_NAME STREQUAL "LinuxMint 20.1") AND X86_64)
|
||||
set(OPENCV_SUFFIX "ubuntu20")
|
||||
set(OPENCV_HASH "2fe7bbc40e1186eb8d099822038cae2821abf617ac7a16fadf98f377c723e268")
|
||||
elseif(NOT DEFINED OpenCV_DIR AND NOT DEFINED ENV{OpenCV_DIR})
|
||||
message(FATAL_ERROR "OpenCV is not available on current platform (${LINUX_OS_NAME})")
|
||||
endif()
|
||||
RESOLVE_DEPENDENCY(OPENCV
|
||||
ARCHIVE_LIN "opencv/opencv_${OPENCV_VERSION}-${OPENCV_BUILD}_${OPENCV_SUFFIX}.txz"
|
||||
TARGET_PATH "${TEMP}/opencv_${OPENCV_VERSION}_${OPENCV_SUFFIX}/opencv"
|
||||
ENVIRONMENT "OpenCV_DIR"
|
||||
VERSION_REGEX ".*_([0-9]+.[0-9]+.[0-9]+).*"
|
||||
SHA256 ${OPENCV_HASH})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
set(ocv_cmake_path "${OPENCV}/sdk/native/jni/")
|
||||
else()
|
||||
set(ocv_cmake_path "${OPENCV}/cmake")
|
||||
endif()
|
||||
|
||||
update_deps_cache(OpenCV_DIR "${ocv_cmake_path}" "Path to OpenCV package folder")
|
||||
debug_message(STATUS "opencv=" ${OPENCV})
|
||||
else()
|
||||
reset_deps_cache(OpenCV_DIR)
|
||||
endif()
|
||||
|
||||
include(${OpenVINO_SOURCE_DIR}/src/cmake/ie_parallel.cmake)
|
||||
|
||||
if(ENABLE_INTEL_GNA)
|
||||
reset_deps_cache(
|
||||
GNA
|
||||
GNA_PLATFORM_DIR
|
||||
GNA_KERNEL_LIB_NAME
|
||||
GNA_LIBS_LIST
|
||||
GNA_LIB_DIR
|
||||
libGNA_INCLUDE_DIRS
|
||||
libGNA_LIBRARIES_BASE_PATH)
|
||||
set(GNA_VERSION "03.00.00.1455")
|
||||
set(GNA_HASH "8ac1af18eb32777b00193f4f8c252ee4f8bd64a9069138b4a5aaeebd82ead464")
|
||||
|
||||
set(FILES_TO_EXTRACT_LIST gna_${GNA_VERSION}/include)
|
||||
if(WIN32)
|
||||
LIST(APPEND FILES_TO_EXTRACT_LIST gna_${GNA_VERSION}/win64)
|
||||
else()
|
||||
LIST(APPEND FILES_TO_EXTRACT_LIST gna_${GNA_VERSION}/linux)
|
||||
endif()
|
||||
|
||||
RESOLVE_DEPENDENCY(GNA
|
||||
ARCHIVE_UNIFIED "GNA/GNA_${GNA_VERSION}.zip"
|
||||
TARGET_PATH "${TEMP}/gna_${GNA_VERSION}"
|
||||
VERSION_REGEX ".*_([0-9]+.[0-9]+.[0-9]+.[0-9]+).*"
|
||||
FILES_TO_EXTRACT FILES_TO_EXTRACT_LIST
|
||||
SHA256 ${GNA_HASH})
|
||||
update_deps_cache(GNA "${GNA}" "Path to GNA root folder")
|
||||
debug_message(STATUS "gna=" ${GNA})
|
||||
endif()
|
||||
@@ -1,312 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
if(NOT DEFINED IEDevScripts_DIR)
|
||||
message(FATAL_ERROR "IEDevScripts_DIR is not defined")
|
||||
endif()
|
||||
|
||||
set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH "${IEDevScripts_DIR}")
|
||||
|
||||
function(set_ci_build_number)
|
||||
set(repo_root "${CMAKE_SOURCE_DIR}")
|
||||
include(version)
|
||||
foreach(var CI_BUILD_NUMBER IE_VERSION IE_VERSION_BUILD
|
||||
IE_VERSION_MAJOR IE_VERSION_MINOR IE_VERSION_PATCH)
|
||||
if(NOT DEFINED ${var})
|
||||
message(FATAL_ERROR "${var} version component is not defined")
|
||||
endif()
|
||||
set(${var} "${${var}}" PARENT_SCOPE)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
set_ci_build_number()
|
||||
|
||||
include(features)
|
||||
include(message)
|
||||
|
||||
#
|
||||
# Detect target
|
||||
#
|
||||
|
||||
include(target_flags)
|
||||
|
||||
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH_FOLDER)
|
||||
if(X86_64)
|
||||
set(ARCH_FOLDER intel64)
|
||||
elseif(X86)
|
||||
set(ARCH_FOLDER ia32)
|
||||
elseif(MSVC AND ARM)
|
||||
set(ARCH_FOLDER arm)
|
||||
elseif(MSVC AND AARCH64)
|
||||
set(ARCH_FOLDER arm64)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Prepare temporary folder
|
||||
#
|
||||
|
||||
function(set_temp_directory temp_variable source_tree_dir)
|
||||
if(DEFINED OV_TEMP)
|
||||
message(STATUS "OV_TEMP cmake variable is set : ${OV_TEMP}")
|
||||
file(TO_CMAKE_PATH ${OV_TEMP} temp)
|
||||
elseif (DEFINED ENV{DL_SDK_TEMP} AND NOT $ENV{DL_SDK_TEMP} STREQUAL "")
|
||||
message(STATUS "DL_SDK_TEMP environment is set : $ENV{DL_SDK_TEMP}")
|
||||
file(TO_CMAKE_PATH $ENV{DL_SDK_TEMP} temp)
|
||||
else ()
|
||||
set(temp ${source_tree_dir}/temp)
|
||||
endif()
|
||||
|
||||
set("${temp_variable}" "${temp}" CACHE PATH "Path to temp directory")
|
||||
if(ALTERNATIVE_PATH)
|
||||
set(ALTERNATIVE_PATH "${ALTERNATIVE_PATH}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# For cross-compilation
|
||||
#
|
||||
|
||||
# Search packages for the host system instead of packages for the target system
|
||||
# in case of cross compilation these macros should be defined by the toolchain file
|
||||
if(NOT COMMAND find_host_package)
|
||||
macro(find_host_package)
|
||||
find_package(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
if(NOT COMMAND find_host_program)
|
||||
macro(find_host_program)
|
||||
find_program(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Common scripts
|
||||
#
|
||||
|
||||
include(packaging)
|
||||
include(coverage/coverage)
|
||||
include(shellcheck/shellcheck)
|
||||
|
||||
# printing debug messages
|
||||
include(debug)
|
||||
|
||||
if(OS_FOLDER)
|
||||
message ("**** OS FOLDER IS: [${OS_FOLDER}]")
|
||||
if(OS_FOLDER STREQUAL "ON")
|
||||
message ("**** USING OS FOLDER: [${CMAKE_SYSTEM_NAME}]")
|
||||
set(BIN_FOLDER "bin/${CMAKE_SYSTEM_NAME}/${ARCH_FOLDER}")
|
||||
else()
|
||||
set(BIN_FOLDER "bin/${OS_FOLDER}/${ARCH_FOLDER}")
|
||||
endif()
|
||||
else()
|
||||
set(BIN_FOLDER "bin/${ARCH_FOLDER}")
|
||||
endif()
|
||||
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type")
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release;Debug;RelWithDebInfo;MinSizeRel")
|
||||
if(CMAKE_GENERATOR MATCHES "^Ninja Multi-Config$")
|
||||
set(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "CMake default build type")
|
||||
endif()
|
||||
|
||||
if(USE_BUILD_TYPE_SUBFOLDER)
|
||||
set(BIN_FOLDER "${BIN_FOLDER}/${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
# allow to override default OUTPUT_ROOT root
|
||||
if(NOT DEFINED OUTPUT_ROOT)
|
||||
if(NOT DEFINED OpenVINO_SOURCE_DIR)
|
||||
message(FATAL_ERROR "OpenVINO_SOURCE_DIR is not defined")
|
||||
endif()
|
||||
set(OUTPUT_ROOT ${OpenVINO_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Enable postfixes for Debug/Release builds
|
||||
set(IE_DEBUG_POSTFIX_WIN "d")
|
||||
set(IE_RELEASE_POSTFIX_WIN "")
|
||||
set(IE_DEBUG_POSTFIX_LIN "")
|
||||
set(IE_RELEASE_POSTFIX_LIN "")
|
||||
set(IE_DEBUG_POSTFIX_MAC "")
|
||||
set(IE_RELEASE_POSTFIX_MAC "")
|
||||
|
||||
if(WIN32)
|
||||
set(IE_DEBUG_POSTFIX ${IE_DEBUG_POSTFIX_WIN})
|
||||
set(IE_RELEASE_POSTFIX ${IE_RELEASE_POSTFIX_WIN})
|
||||
elseif(APPLE)
|
||||
set(IE_DEBUG_POSTFIX ${IE_DEBUG_POSTFIX_MAC})
|
||||
set(IE_RELEASE_POSTFIX ${IE_RELEASE_POSTFIX_MAC})
|
||||
else()
|
||||
set(IE_DEBUG_POSTFIX ${IE_DEBUG_POSTFIX_LIN})
|
||||
set(IE_RELEASE_POSTFIX ${IE_RELEASE_POSTFIX_LIN})
|
||||
endif()
|
||||
|
||||
set(CMAKE_DEBUG_POSTFIX ${IE_DEBUG_POSTFIX})
|
||||
set(CMAKE_RELEASE_POSTFIX ${IE_RELEASE_POSTFIX})
|
||||
|
||||
# Support CMake multi-configuration for Visual Studio / Ninja or Xcode build
|
||||
if (OV_GENERATOR_MULTI_CONFIG)
|
||||
set(IE_BUILD_POSTFIX $<$<CONFIG:Debug>:${IE_DEBUG_POSTFIX}>$<$<CONFIG:Release>:${IE_RELEASE_POSTFIX}>)
|
||||
else ()
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(IE_BUILD_POSTFIX ${IE_DEBUG_POSTFIX})
|
||||
else()
|
||||
set(IE_BUILD_POSTFIX ${IE_RELEASE_POSTFIX})
|
||||
endif()
|
||||
endif()
|
||||
add_definitions(-DIE_BUILD_POSTFIX=\"${IE_BUILD_POSTFIX}\")
|
||||
|
||||
if(NOT UNIX)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
||||
else()
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/lib)
|
||||
endif()
|
||||
set(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
||||
set(CMAKE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_MACOSX_RPATH ON)
|
||||
# WA for Xcode generator + object libraries issue:
|
||||
# https://gitlab.kitware.com/cmake/cmake/issues/20260
|
||||
# http://cmake.3232098.n2.nabble.com/XCODE-DEPEND-HELPER-make-Deletes-Targets-Before-and-While-They-re-Built-td7598277.html
|
||||
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY ON)
|
||||
endif()
|
||||
|
||||
# Use solution folders
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# Enable CMAKE_<LANG>_COMPILER_ID AppleClang
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0025 NEW)
|
||||
|
||||
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "Don't warn about obsolete cmake versions in 3rdparty")
|
||||
set(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ON CACHE BOOL "Warn about absolute paths in destination")
|
||||
|
||||
# LTO
|
||||
|
||||
if(ENABLE_LTO)
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
|
||||
include(CheckIPOSupported)
|
||||
|
||||
check_ipo_supported(RESULT IPO_SUPPORTED
|
||||
OUTPUT OUTPUT_MESSAGE
|
||||
LANGUAGES C CXX)
|
||||
|
||||
if(NOT IPO_SUPPORTED)
|
||||
set(ENABLE_LTO "OFF" CACHE STRING "Enable Link Time Optmization" FORCE)
|
||||
message(WARNING "IPO / LTO is not supported: ${OUTPUT_MESSAGE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# General flags
|
||||
|
||||
macro(ov_install_static_lib target comp)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${target} EXPORT OpenVINOTargets
|
||||
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ${comp} ${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
include(compile_flags/sdl)
|
||||
include(compile_flags/os_flags)
|
||||
include(compile_flags/sanitizer)
|
||||
include(compile_flags/fuzzing)
|
||||
include(download/dependency_solver)
|
||||
include(cross_compile/cross_compiled_func)
|
||||
include(faster_build)
|
||||
include(whole_archive)
|
||||
include(linux_name)
|
||||
include(models)
|
||||
include(api_validator/api_validator)
|
||||
|
||||
include(vs_version/vs_version)
|
||||
include(plugins/plugins)
|
||||
include(frontends/frontends)
|
||||
include(add_ie_target)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
if(ENABLE_FUZZING)
|
||||
enable_fuzzing()
|
||||
endif()
|
||||
|
||||
# macro to mark target as conditionally compiled
|
||||
|
||||
function(ie_mark_target_as_cc TARGET_NAME)
|
||||
set(cc_library openvino::conditional_compilation)
|
||||
if(TARGET IE::conditional_compilation)
|
||||
set(cc_library IE::conditional_compilation)
|
||||
endif()
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${cc_library})
|
||||
|
||||
if(NOT (SELECTIVE_BUILD STREQUAL "ON"))
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET ${TARGET_NAME})
|
||||
message(FATAL_ERROR "${TARGET_NAME} does not represent target")
|
||||
endif()
|
||||
|
||||
get_target_property(sources ${TARGET_NAME} SOURCES)
|
||||
set_source_files_properties(${sources} PROPERTIES OBJECT_DEPENDS ${GENERATED_HEADER})
|
||||
endfunction()
|
||||
|
||||
function(ov_mark_target_as_cc)
|
||||
ie_mark_target_as_cc(${ARGN})
|
||||
endfunction()
|
||||
|
||||
# check python package
|
||||
|
||||
function(ie_check_pip_package full_name message_type)
|
||||
find_package(PythonInterp 3 REQUIRED)
|
||||
|
||||
get_filename_component(PYTHON_EXEC_DIR ${PYTHON_EXECUTABLE} DIRECTORY)
|
||||
|
||||
# extract version if any
|
||||
if(full_name MATCHES "^([a-z_]+)[~=<>!]*(.*)$")
|
||||
set(name ${CMAKE_MATCH_1})
|
||||
set(req_version ${CMAKE_MATCH_2})
|
||||
else()
|
||||
set(name ${full_name})
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -m pip show ${name}
|
||||
WORKING_DIRECTORY ${PYTHON_EXEC_DIR}
|
||||
RESULT_VARIABLE PIP_EXIT_CODE
|
||||
OUTPUT_VARIABLE output)
|
||||
|
||||
if(NOT PIP_EXIT_CODE EQUAL 0)
|
||||
set(${name}_FOUND OFF PARENT_SCOPE)
|
||||
message(${message_type} "${name} package is not installed. Please use \"${PYTHON_EXECUTABLE} -m pip install ${full_name}\".")
|
||||
else()
|
||||
if(req_version)
|
||||
string(REGEX MATCH "Version: ([0-9]+\.?[0-9]*\.?[0-9]*)\n" installed_version "${output}")
|
||||
if(installed_version)
|
||||
set(installed_version "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
|
||||
if(NOT req_version STREQUAL installed_version)
|
||||
message(${message_type} "${name} package is installed, but may have different version (${installed_version}). "
|
||||
"Please use \"${PYTHON_EXECUTABLE} -m pip install ${full_name}\".")
|
||||
endif()
|
||||
else()
|
||||
set(${name}_FOUND ON PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Code style utils
|
||||
|
||||
include(cpplint/cpplint)
|
||||
include(clang_format/clang_format)
|
||||
include(ncc_naming_style/ncc_naming_style)
|
||||
|
||||
# Restore state
|
||||
set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH})
|
||||
@@ -1,35 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Perform search of TBB package corresponding with specified search order.
|
||||
#
|
||||
# TBBROOT var is set into external package path or has a default value
|
||||
# with IE own version of TBB. Search order is next:
|
||||
# 1) ${TBBROOT}/cmake
|
||||
# 2) ${TBBROOT} with IE own version of TBBConfig.cmake (actual for TBB < 2017.7)
|
||||
#
|
||||
|
||||
# Path to IE own version of TBBConfig.cmake old TBB version without cmake config.
|
||||
if(APPLE)
|
||||
set(IE_OWN_TBB_CONFIG tbb/mac)
|
||||
elseif(UNIX)
|
||||
set(IE_OWN_TBB_CONFIG tbb/lnx)
|
||||
elseif(WIN)
|
||||
set(IE_OWN_TBB_CONFIG tbb/win)
|
||||
else()
|
||||
unset(IE_OWN_TBB_CONFIG)
|
||||
endif()
|
||||
|
||||
find_package(TBB
|
||||
CONFIG
|
||||
PATHS ${TBBROOT}/cmake
|
||||
${TBBROOT}/lib/cmake/TBB # oneTBB case
|
||||
${IEDevScripts_DIR}/${IE_OWN_TBB_CONFIG}
|
||||
NO_CMAKE_FIND_ROOT_PATH
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_package_handle_standard_args(TBB CONFIG_MODE)
|
||||
@@ -1,173 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
#[[
|
||||
function to create CMake target and setup its options in a declarative style.
|
||||
Example:
|
||||
addIeTarget(
|
||||
NAME core_lib
|
||||
ADD_CPPLINT
|
||||
DEVELOPER_PACKAGE <component>
|
||||
TYPE <SHARED / STATIC / EXECUTABLE>
|
||||
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
ADDITIONAL_SOURCE_DIRS
|
||||
/some/additional/sources
|
||||
EXCLUDED_SOURCE_PATHS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unnecessary_sources/
|
||||
INCLUDES
|
||||
${SDL_INCLUDES}
|
||||
/some/specific/path
|
||||
LINK_LIBRARIES
|
||||
link_dependencies
|
||||
DEPENDENCIES
|
||||
dependencies
|
||||
ie::important_plugin
|
||||
OBJECT_FILES
|
||||
object libraries
|
||||
)
|
||||
#]]
|
||||
function(addIeTarget)
|
||||
set(options
|
||||
ADD_CPPLINT # Enables code style checks for the target
|
||||
ADD_CLANG_FORMAT # Enables code style checks for the target
|
||||
)
|
||||
set(oneValueRequiredArgs
|
||||
TYPE # type of target, SHARED|STATIC|EXECUTABLE. SHARED and STATIC correspond to add_library, EXECUTABLE to add_executable
|
||||
NAME # name of target
|
||||
ROOT # root directory to be used for recursive search of source files
|
||||
)
|
||||
set(oneValueOptionalArgs
|
||||
DEVELOPER_PACKAGE # Enables exporting of the target through the developer package
|
||||
)
|
||||
set(multiValueArgs
|
||||
INCLUDES # Extra include directories
|
||||
LINK_LIBRARIES # Link libraries (in form of target name or file name)
|
||||
DEPENDENCIES # compile order dependencies (no link implied)
|
||||
DEFINES # extra preprocessor definitions
|
||||
ADDITIONAL_SOURCE_DIRS # list of directories which will be used to recursive search of source files in addition to ROOT
|
||||
OBJECT_FILES # list of object files to be additionally built into the target
|
||||
EXCLUDED_SOURCE_PATHS # list of paths excluded from the global recursive search of source files
|
||||
LINK_LIBRARIES_WHOLE_ARCHIVE # list of static libraries to link, each object file should be used and not discarded
|
||||
LINK_FLAGS # list of extra commands to linker
|
||||
)
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueRequiredArgs};${oneValueOptionalArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
# sanity checks
|
||||
foreach(argName ${oneValueRequiredArgs})
|
||||
if (NOT ARG_${argName})
|
||||
message(SEND_ERROR "Argument '${argName}' is required.")
|
||||
endif()
|
||||
endforeach()
|
||||
if (ARG_UNPARSED_ARGUMENTS)
|
||||
message(SEND_ERROR "Unexpected parameters have passed to function: ${ARG_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
# adding files to target
|
||||
set(includeSearch)
|
||||
set(sourceSearch)
|
||||
foreach(directory ${ARG_ROOT} ${ARG_ADDITIONAL_SOURCE_DIRS})
|
||||
list(APPEND includeSearch ${directory}/*.h ${directory}/*.hpp)
|
||||
list(APPEND sourceSearch ${directory}/*.cpp)
|
||||
endforeach()
|
||||
|
||||
file(GLOB_RECURSE includes ${includeSearch})
|
||||
file(GLOB_RECURSE sources ${sourceSearch})
|
||||
|
||||
# remove unnecessary directories
|
||||
foreach(excludedDir ${ARG_EXCLUDED_SOURCE_PATHS})
|
||||
list(FILTER includes EXCLUDE REGEX "${excludedDir}*")
|
||||
list(FILTER sources EXCLUDE REGEX "${excludedDir}*")
|
||||
endforeach()
|
||||
|
||||
source_group("include" FILES ${includes})
|
||||
source_group("src" FILES ${sources})
|
||||
|
||||
set(all_sources)
|
||||
list(APPEND all_sources ${sources} ${includes} ${ARG_OBJECT_FILES})
|
||||
|
||||
# defining a target
|
||||
if (ARG_TYPE STREQUAL EXECUTABLE)
|
||||
add_executable(${ARG_NAME} ${all_sources})
|
||||
elseif(ARG_TYPE STREQUAL STATIC OR ARG_TYPE STREQUAL SHARED)
|
||||
add_library(${ARG_NAME} ${ARG_TYPE} ${all_sources})
|
||||
else()
|
||||
message(SEND_ERROR "Invalid target type ${ARG_TYPE} specified for target name ${ARG_NAME}")
|
||||
endif()
|
||||
|
||||
ieTargetLinkWholeArchive(${ARG_NAME} ${ARG_LINK_LIBRARIES_WHOLE_ARCHIVE})
|
||||
|
||||
if (ARG_DEFINES)
|
||||
target_compile_definitions(${ARG_NAME} PRIVATE ${ARG_DEFINES})
|
||||
endif()
|
||||
if (ARG_INCLUDES)
|
||||
target_include_directories(${ARG_NAME} PRIVATE ${ARG_INCLUDES})
|
||||
endif()
|
||||
if (ARG_LINK_LIBRARIES)
|
||||
target_link_libraries(${ARG_NAME} PRIVATE ${ARG_LINK_LIBRARIES})
|
||||
endif()
|
||||
if (ARG_DEPENDENCIES)
|
||||
add_dependencies(${ARG_NAME} ${ARG_DEPENDENCIES})
|
||||
endif()
|
||||
if (ARG_LINK_FLAGS)
|
||||
get_target_property(oldLinkFlags ${ARG_NAME} LINK_FLAGS)
|
||||
string(REPLACE ";" " " ARG_LINK_FLAGS "${ARG_LINK_FLAGS}")
|
||||
set_target_properties(${ARG_NAME} PROPERTIES LINK_FLAGS "${oldLinkFlags} ${ARG_LINK_FLAGS}")
|
||||
endif()
|
||||
if (ARG_ADD_CPPLINT)
|
||||
# code style
|
||||
add_cpplint_target(${ARG_NAME}_cpplint FOR_TARGETS ${ARG_NAME})
|
||||
endif()
|
||||
if (ARG_ADD_CLANG_FORMAT)
|
||||
# code style
|
||||
add_clang_format_target(${ARG_NAME}_clang FOR_TARGETS ${ARG_NAME})
|
||||
endif()
|
||||
if (ARG_DEVELOPER_PACKAGE)
|
||||
# developer package
|
||||
openvino_developer_export_targets(COMPONENT ${ARG_DEVELOPER_PACKAGE}
|
||||
TARGETS ${ARG_NAME})
|
||||
endif()
|
||||
if(WIN32)
|
||||
# Provide default compile pdb name equal to target name
|
||||
set_target_properties(${ARG_NAME} PROPERTIES COMPILE_PDB_NAME ${ARG_NAME})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ov_add_target)
|
||||
addIeTarget(${ARGV})
|
||||
endfunction()
|
||||
|
||||
#[[
|
||||
Wrapper function over addIeTarget, that also adds a test with the same name.
|
||||
You could use
|
||||
addIeTargetTest( ... LABELS labelOne labelTwo )
|
||||
also to provide labels for that test.
|
||||
Important: you MUST pass LABELS as last argument, otherwise it will consume any parameters that come after.
|
||||
#]]
|
||||
function(addIeTargetTest)
|
||||
set(options
|
||||
)
|
||||
set(oneValueRequiredArgs
|
||||
NAME
|
||||
)
|
||||
set(oneValueOptionalArgs
|
||||
)
|
||||
set(multiValueArgs
|
||||
LABELS
|
||||
)
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueRequiredArgs};${oneValueOptionalArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
addIeTarget(TYPE EXECUTABLE NAME ${ARG_NAME} ${ARG_UNPARSED_ARGUMENTS})
|
||||
|
||||
add_test(NAME ${ARG_NAME} COMMAND ${ARG_NAME})
|
||||
set_property(TEST ${ARG_NAME} PROPERTY LABELS ${ARG_LABELS})
|
||||
|
||||
install(TARGETS ${ARG_NAME}
|
||||
RUNTIME DESTINATION tests
|
||||
COMPONENT tests
|
||||
EXCLUDE_FROM_ALL)
|
||||
endfunction()
|
||||
|
||||
function(ov_add_test_target)
|
||||
addIeTargetTest(${ARGV})
|
||||
endfunction()
|
||||
@@ -1,153 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(WIN32)
|
||||
set(PROGRAMFILES_ENV "ProgramFiles(X86)")
|
||||
file(TO_CMAKE_PATH $ENV{${PROGRAMFILES_ENV}} PROGRAMFILES)
|
||||
set(UWP_SDK_PATH "${PROGRAMFILES}/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64")
|
||||
|
||||
message(STATUS "Trying to find apivalidator in: ${UWP_SDK_PATH}")
|
||||
find_host_program(UWP_API_VALIDATOR
|
||||
NAMES apivalidator
|
||||
PATHS "${UWP_SDK_PATH}"
|
||||
DOC "ApiValidator for UWP compliance")
|
||||
|
||||
if(UWP_API_VALIDATOR)
|
||||
message(STATUS "Found apivalidator: ${UWP_API_VALIDATOR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
function(_ie_add_api_validator_post_build_step_recursive)
|
||||
cmake_parse_arguments(API_VALIDATOR "" "TARGET" "" ${ARGN})
|
||||
|
||||
list(APPEND API_VALIDATOR_TARGETS ${API_VALIDATOR_TARGET})
|
||||
set(API_VALIDATOR_TARGETS ${API_VALIDATOR_TARGETS} PARENT_SCOPE)
|
||||
|
||||
get_target_property(IS_IMPORTED ${API_VALIDATOR_TARGET} IMPORTED)
|
||||
if(IS_IMPORTED)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(LIBRARY_TYPE ${API_VALIDATOR_TARGET} TYPE)
|
||||
if(LIBRARY_TYPE STREQUAL "EXECUTABLE" OR LIBRARY_TYPE STREQUAL "SHARED_LIBRARY")
|
||||
get_target_property(LINKED_LIBRARIES ${API_VALIDATOR_TARGET} LINK_LIBRARIES)
|
||||
if(LINKED_LIBRARIES)
|
||||
foreach(ITEM IN LISTS LINKED_LIBRARIES)
|
||||
if(NOT TARGET ${ITEM})
|
||||
continue()
|
||||
endif()
|
||||
get_target_property(LIBRARY_TYPE_DEPENDENCY ${ITEM} TYPE)
|
||||
if(LIBRARY_TYPE_DEPENDENCY STREQUAL "SHARED_LIBRARY")
|
||||
_ie_add_api_validator_post_build_step_recursive(TARGET ${ITEM})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(API_VALIDATOR_TARGETS ${API_VALIDATOR_TARGETS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
set(VALIDATED_LIBRARIES "" CACHE INTERNAL "")
|
||||
|
||||
function(_ie_add_api_validator_post_build_step)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
# since _ie_add_api_validator_post_build_step
|
||||
# is currently run only on shared libraries, we have nothing to test
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(UWP_API_VALIDATOR_APIS "${PROGRAMFILES}/Windows Kits/10/build/universalDDIs/x64/UniversalDDIs.xml")
|
||||
set(UWP_API_VALIDATOR_EXCLUSION "${UWP_SDK_PATH}/BinaryExclusionlist.xml")
|
||||
|
||||
if((NOT UWP_API_VALIDATOR) OR (WINDOWS_STORE OR WINDOWS_PHONE))
|
||||
return()
|
||||
endif()
|
||||
|
||||
cmake_parse_arguments(API_VALIDATOR "" "TARGET" "" ${ARGN})
|
||||
|
||||
if(NOT API_VALIDATOR_TARGET)
|
||||
message(FATAL_ERROR "RunApiValidator requires TARGET to validate!")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET ${API_VALIDATOR_TARGET})
|
||||
message(FATAL_ERROR "${API_VALIDATOR_TARGET} is not a TARGET in the project tree.")
|
||||
endif()
|
||||
|
||||
# collect targets
|
||||
|
||||
_ie_add_api_validator_post_build_step_recursive(TARGET ${API_VALIDATOR_TARGET})
|
||||
|
||||
# remove targets which were tested before
|
||||
foreach(target IN LISTS API_VALIDATOR_TARGETS)
|
||||
list(FIND VALIDATED_LIBRARIES ${target} index)
|
||||
if (NOT index EQUAL -1)
|
||||
list(APPEND VALIDATED_TARGETS ${target})
|
||||
endif()
|
||||
if(TARGET "${target}")
|
||||
get_target_property(orig_target ${target} ALIASED_TARGET)
|
||||
list(FIND VALIDATED_LIBRARIES ${orig_target} index)
|
||||
if (NOT index EQUAL -1)
|
||||
list(APPEND VALIDATED_TARGETS ${target})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(item IN LISTS VALIDATED_TARGETS)
|
||||
list(REMOVE_ITEM API_VALIDATOR_TARGETS ${item})
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES API_VALIDATOR_TARGETS)
|
||||
|
||||
if(NOT API_VALIDATOR_TARGETS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# apply check
|
||||
|
||||
macro(api_validator_get_target_name)
|
||||
get_target_property(IS_IMPORTED ${target} IMPORTED)
|
||||
get_target_property(orig_target ${target} ALIASED_TARGET)
|
||||
if(IS_IMPORTED)
|
||||
get_target_property(target_location ${target} LOCATION)
|
||||
get_filename_component(target_name "${target_location}" NAME_WE)
|
||||
elseif(TARGET "${orig_target}")
|
||||
set(target_name ${orig_target})
|
||||
else()
|
||||
set(target_name ${target})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
foreach(target IN LISTS API_VALIDATOR_TARGETS)
|
||||
api_validator_get_target_name()
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21 AND OV_GENERATOR_MULTI_CONFIG)
|
||||
set(output_file "${CMAKE_BINARY_DIR}/api_validator/$<CONFIG>/${target_name}.txt")
|
||||
else()
|
||||
set(output_file "${CMAKE_BINARY_DIR}/api_validator/${target_name}.txt")
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET ${API_VALIDATOR_TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} --config $<CONFIG>
|
||||
-D UWP_API_VALIDATOR=${UWP_API_VALIDATOR}
|
||||
-D UWP_API_VALIDATOR_TARGET=$<TARGET_FILE:${target}>
|
||||
-D UWP_API_VALIDATOR_APIS=${UWP_API_VALIDATOR_APIS}
|
||||
-D UWP_API_VALIDATOR_EXCLUSION=${UWP_API_VALIDATOR_EXCLUSION}
|
||||
-D UWP_API_VALIDATOR_OUTPUT=${output_file}
|
||||
-D CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
-P "${IEDevScripts_DIR}/api_validator/api_validator_run.cmake"
|
||||
BYPRODUCTS ${output_file}
|
||||
COMMENT "[apiValidator] Check ${target_name} for OneCore compliance"
|
||||
VERBATIM)
|
||||
endforeach()
|
||||
|
||||
# update list of validated libraries
|
||||
|
||||
list(APPEND VALIDATED_LIBRARIES ${API_VALIDATOR_TARGETS})
|
||||
set(VALIDATED_LIBRARIES "${VALIDATED_LIBRARIES}" CACHE INTERNAL "" FORCE)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# ie_add_api_validator_post_build_step(TARGET <name>)
|
||||
#
|
||||
macro(ie_add_api_validator_post_build_step)
|
||||
_ie_add_api_validator_post_build_step(${ARGV})
|
||||
endmacro()
|
||||
@@ -1,73 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
cmake_policy(SET CMP0012 NEW)
|
||||
|
||||
foreach(var UWP_API_VALIDATOR UWP_API_VALIDATOR_TARGET
|
||||
UWP_API_VALIDATOR_APIS UWP_API_VALIDATOR_EXCLUSION
|
||||
UWP_API_VALIDATOR_OUTPUT CMAKE_TOOLCHAIN_FILE)
|
||||
if(NOT DEFINED ${var})
|
||||
message(FATAL_ERROR "Variable ${var} is not defined")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# create command
|
||||
|
||||
if(NOT EXISTS "${UWP_API_VALIDATOR_APIS}")
|
||||
message(FATAL_ERROR "${UWP_API_VALIDATOR_APIS} does not exist")
|
||||
endif()
|
||||
|
||||
set(command "${UWP_API_VALIDATOR}"
|
||||
-SupportedApiXmlFiles:${UWP_API_VALIDATOR_APIS}
|
||||
-DriverPackagePath:${UWP_API_VALIDATOR_TARGET})
|
||||
if(EXISTS "${UWP_API_VALIDATOR_EXCLUSION}")
|
||||
list(APPEND command
|
||||
-BinaryExclusionListXmlFile:${UWP_API_VALIDATOR_EXCLUSION}
|
||||
-StrictCompliance:TRUE)
|
||||
set(UWP_HAS_BINARY_EXCLUSION ON)
|
||||
endif()
|
||||
|
||||
# execute
|
||||
|
||||
execute_process(COMMAND ${command}
|
||||
OUTPUT_VARIABLE output_message
|
||||
ERROR_VARIABLE error_message
|
||||
RESULT_VARIABLE exit_code
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
file(WRITE "${UWP_API_VALIDATOR_OUTPUT}" "${output_message}\n\n\n${error_message}")
|
||||
|
||||
# post-process output
|
||||
|
||||
get_filename_component(name "${UWP_API_VALIDATOR_TARGET}" NAME)
|
||||
|
||||
if(NOT UWP_HAS_BINARY_EXCLUSION)
|
||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "onecoreuap.toolchain.cmake$")
|
||||
# empty since we compile with static MSVC runtime
|
||||
else()
|
||||
set(exclusion_dlls "msvcp140.dll" "vcruntime140.dll")
|
||||
endif()
|
||||
|
||||
# remove exclusions from error_message
|
||||
|
||||
foreach(dll IN LISTS exclusion_dlls)
|
||||
string(REGEX REPLACE
|
||||
"ApiValidation: Error: ${name} has unsupported API call to \"${dll}![^\"]+\"\n"
|
||||
"" error_message "${error_message}")
|
||||
endforeach()
|
||||
|
||||
# throw error if error_message still contains any errors
|
||||
|
||||
if(error_message)
|
||||
message(FATAL_ERROR "${error_message}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# write output
|
||||
|
||||
if(UWP_HAS_BINARY_EXCLUSION AND NOT exit_code EQUAL 0)
|
||||
message(FATAL_ERROR "${error_message}")
|
||||
endif()
|
||||
|
||||
message("ApiValidator: ${name} has passed the OneCore compliance")
|
||||
@@ -1,128 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(ENABLE_CLANG_FORMAT)
|
||||
set(CLANG_FORMAT_FILENAME clang-format-9 clang-format)
|
||||
find_host_program(CLANG_FORMAT NAMES ${CLANG_FORMAT_FILENAME} PATHS ENV PATH)
|
||||
if(CLANG_FORMAT)
|
||||
execute_process(COMMAND ${CLANG_FORMAT} ${CMAKE_CURRENT_SOURCE_DIR} ARGS --version OUTPUT_VARIABLE CLANG_VERSION)
|
||||
if(NOT CLANG_VERSION OR CLANG_VERSION STREQUAL "")
|
||||
message(WARNING "Supported clang-format version is 9!")
|
||||
set(ENABLE_CLANG_FORMAT OFF)
|
||||
else()
|
||||
string(REGEX REPLACE "[^0-9]+([0-9]+)\\..*" "\\1" CLANG_FORMAT_MAJOR_VERSION ${CLANG_VERSION})
|
||||
if(NOT ${CLANG_FORMAT_MAJOR_VERSION} EQUAL "9")
|
||||
message(WARNING "Supported clang-format version is 9!")
|
||||
set(ENABLE_CLANG_FORMAT OFF)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Supported clang-format version is not found!")
|
||||
set(ENABLE_CLANG_FORMAT OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_CLANG_FORMAT AND NOT TARGET clang_format_check_all)
|
||||
add_custom_target(clang_format_check_all)
|
||||
add_custom_target(clang_format_fix_all)
|
||||
set_target_properties(clang_format_check_all clang_format_fix_all
|
||||
PROPERTIES FOLDER clang_format)
|
||||
set(CLANG_FORMAT_ALL_OUTPUT_FILES "" CACHE INTERNAL "All clang-format output files")
|
||||
endif()
|
||||
|
||||
function(add_clang_format_target TARGET_NAME)
|
||||
if(NOT ENABLE_CLANG_FORMAT)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(options ALL)
|
||||
set(oneValueArgs "")
|
||||
set(multiValueArgs "FOR_TARGETS" "FOR_SOURCES" "EXCLUDE_PATTERNS")
|
||||
cmake_parse_arguments(CLANG_FORMAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(target IN LISTS CLANG_FORMAT_FOR_TARGETS)
|
||||
get_target_property(target_sources "${target}" SOURCES)
|
||||
list(APPEND CLANG_FORMAT_FOR_SOURCES ${target_sources})
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES CLANG_FORMAT_FOR_SOURCES)
|
||||
|
||||
set(all_output_files "")
|
||||
foreach(source_file IN LISTS CLANG_FORMAT_FOR_SOURCES)
|
||||
set(exclude FALSE)
|
||||
foreach(pattern IN LISTS CLANG_FORMAT_EXCLUDE_PATTERNS)
|
||||
if(source_file MATCHES "${pattern}")
|
||||
set(exclude ON)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(exclude)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# ignore object libraries
|
||||
if(NOT EXISTS "${source_file}")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
file(RELATIVE_PATH source_file_relative "${CMAKE_CURRENT_SOURCE_DIR}" "${source_file}")
|
||||
set(output_file "${CMAKE_CURRENT_BINARY_DIR}/clang_format/${source_file_relative}.clang")
|
||||
string(REPLACE ".." "__" output_file "${output_file}")
|
||||
get_filename_component(output_dir "${output_file}" DIRECTORY)
|
||||
file(MAKE_DIRECTORY "${output_dir}")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
"${output_file}"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
-D "CLANG_FORMAT=${CLANG_FORMAT}"
|
||||
-D "INPUT_FILE=${source_file}"
|
||||
-D "OUTPUT_FILE=${output_file}"
|
||||
-P "${IEDevScripts_DIR}/clang_format/clang_format_check.cmake"
|
||||
DEPENDS
|
||||
"${source_file}"
|
||||
"${IEDevScripts_DIR}/clang_format/clang_format_check.cmake"
|
||||
COMMENT
|
||||
"[clang-format] ${source_file}"
|
||||
VERBATIM)
|
||||
|
||||
list(APPEND all_output_files "${output_file}")
|
||||
endforeach()
|
||||
|
||||
set(CLANG_FORMAT_ALL_OUTPUT_FILES
|
||||
${CLANG_FORMAT_ALL_OUTPUT_FILES} ${all_output_files}
|
||||
CACHE INTERNAL
|
||||
"All clang-format output files")
|
||||
|
||||
add_custom_target(${TARGET_NAME}
|
||||
DEPENDS ${all_output_files}
|
||||
COMMENT "[clang-format] ${TARGET_NAME}")
|
||||
|
||||
add_custom_target(${TARGET_NAME}_fix
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
-D "CLANG_FORMAT=${CLANG_FORMAT}"
|
||||
-D "INPUT_FILES=${CLANG_FORMAT_FOR_SOURCES}"
|
||||
-D "EXCLUDE_PATTERNS=${CLANG_FORMAT_EXCLUDE_PATTERNS}"
|
||||
-P "${IEDevScripts_DIR}/clang_format/clang_format_fix.cmake"
|
||||
DEPENDS
|
||||
"${CLANG_FORMAT_FOR_SOURCES}"
|
||||
"${IEDevScripts_DIR}/clang_format/clang_format_fix.cmake"
|
||||
COMMENT
|
||||
"[clang-format] ${TARGET_NAME}_fix"
|
||||
VERBATIM)
|
||||
|
||||
set_target_properties(${TARGET_NAME} ${TARGET_NAME}_fix
|
||||
PROPERTIES FOLDER clang_format)
|
||||
|
||||
# if(CLANG_FORMAT_FOR_TARGETS)
|
||||
# foreach(target IN LISTS CLANG_FORMAT_FOR_TARGETS)
|
||||
# add_dependencies(${target} ${TARGET_NAME})
|
||||
# endforeach()
|
||||
# endif()
|
||||
|
||||
add_dependencies(clang_format_check_all ${TARGET_NAME})
|
||||
add_dependencies(clang_format_fix_all ${TARGET_NAME}_fix)
|
||||
endfunction()
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
file(REMOVE "${OUTPUT_FILE}")
|
||||
|
||||
execute_process(COMMAND ${CLANG_FORMAT} -style=file -output-replacements-xml ${INPUT_FILE}
|
||||
OUTPUT_VARIABLE STYLE_CHECK_RESULT
|
||||
)
|
||||
|
||||
file(WRITE "${OUTPUT_FILE}" "${STYLE_CHECK_RESULT}")
|
||||
|
||||
if(NOT SKIP_RETURN_CODE)
|
||||
if("${STYLE_CHECK_RESULT}" MATCHES ".*<replacement .*")
|
||||
message(FATAL_ERROR "[clang-format] Code style check failed for: ${INPUT_FILE}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,24 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
function(style_apply_file INPUT_FILE)
|
||||
execute_process(COMMAND ${CLANG_FORMAT} -style=file -i ${INPUT_FILE}
|
||||
OUTPUT_VARIABLE STYLE_CHECK_RESULT)
|
||||
endfunction()
|
||||
|
||||
foreach(source_file IN LISTS INPUT_FILES)
|
||||
set(exclude FALSE)
|
||||
foreach(pattern IN LISTS EXCLUDE_PATTERNS)
|
||||
if(source_file MATCHES "${pattern}")
|
||||
set(exclude ON)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(exclude)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
style_apply_file(${source_file})
|
||||
endforeach()
|
||||
@@ -1,25 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
macro(enable_fuzzing)
|
||||
# Enable (libFuzzer)[https://llvm.org/docs/LibFuzzer.html] if supported.
|
||||
set(FUZZING_COMPILER_FLAGS "-fsanitize=fuzzer-no-link -fprofile-instr-generate -fcoverage-mapping")
|
||||
set(FUZZING_LINKER_FLAGS "-fsanitize-coverage=trace-pc-guard -fprofile-instr-generate")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FUZZING_COMPILER_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FUZZING_COMPILER_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FUZZING_LINKER_FLAGS}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FUZZING_LINKER_FLAGS}")
|
||||
|
||||
unset(FUZZING_COMPILER_FLAGS)
|
||||
unset(FUZZING_LINKER_FLAGS)
|
||||
endmacro()
|
||||
|
||||
function(add_fuzzer FUZZER_EXE_NAME FUZZER_SOURCES)
|
||||
add_executable(${FUZZER_EXE_NAME} ${FUZZER_SOURCES})
|
||||
target_link_libraries(${FUZZER_EXE_NAME} PRIVATE fuzz-testhelper)
|
||||
if(ENABLE_FUZZING)
|
||||
set_target_properties(${FUZZER_EXE_NAME} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer")
|
||||
endif()
|
||||
endfunction(add_fuzzer)
|
||||
@@ -1,375 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
include(ProcessorCount)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
#
|
||||
# Disables deprecated warnings generation
|
||||
# Defines ie_c_cxx_deprecated varaible which contains C / C++ compiler flags
|
||||
#
|
||||
macro(disable_deprecated_warnings)
|
||||
if(WIN32)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(ie_c_cxx_deprecated "/Qdiag-disable:1478,1786")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(ie_c_cxx_deprecated "/wd4996")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(ie_c_cxx_deprecated "-diag-disable=1478,1786")
|
||||
else()
|
||||
set(ie_c_cxx_deprecated "-Wno-deprecated-declarations")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ie_c_cxx_deprecated)
|
||||
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${ie_c_cxx_deprecated}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${ie_c_cxx_deprecated}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ie_c_cxx_deprecated}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ie_c_cxx_deprecated}")
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# Don't threat deprecated warnings as errors
|
||||
# Defines ie_c_cxx_deprecated_no_errors varaible which contains C / C++ compiler flags
|
||||
#
|
||||
macro(ie_deprecated_no_errors)
|
||||
if(WIN32)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(ie_c_cxx_deprecated_no_errors "/Qdiag-warning:1478,1786")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# show 4996 only for /w4
|
||||
set(ie_c_cxx_deprecated_no_errors "/wd4996")
|
||||
# WA for VPUX plugin
|
||||
set(ie_c_cxx_deprecated_no_errors "${ie_c_cxx_deprecated_no_errors} /wd4146 /wd4703")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(ie_c_cxx_deprecated_no_errors "-diag-warning=1478,1786")
|
||||
else()
|
||||
set(ie_c_cxx_deprecated_no_errors "-Wno-error=deprecated-declarations")
|
||||
endif()
|
||||
|
||||
if(NOT ie_c_cxx_deprecated_no_errors)
|
||||
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${ie_c_cxx_deprecated_no_errors}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${ie_c_cxx_deprecated_no_errors}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ie_c_cxx_deprecated_no_errors}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ie_c_cxx_deprecated_no_errors}")
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# Provides SSE4.2 compilation flags depending on an OS and a compiler
|
||||
#
|
||||
function(ie_sse42_optimization_flags flags)
|
||||
if(WIN32)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# No such option for MSVC 2019
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(${flags} /QxSSE4.2 PARENT_SCOPE)
|
||||
else()
|
||||
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(${flags} -xSSE4.2 PARENT_SCOPE)
|
||||
else()
|
||||
set(${flags} -msse4.2 PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Provides AVX2 compilation flags depending on an OS and a compiler
|
||||
#
|
||||
function(ie_avx2_optimization_flags flags)
|
||||
if(WIN32)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(${flags} /QxCORE-AVX2 PARENT_SCOPE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(${flags} /arch:AVX2 PARENT_SCOPE)
|
||||
else()
|
||||
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(${flags} -xCORE-AVX2 PARENT_SCOPE)
|
||||
else()
|
||||
set(${flags} -mavx2 -mfma PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Provides common AVX512 compilation flags for AVX512F instruction set support
|
||||
# depending on an OS and a compiler
|
||||
#
|
||||
function(ie_avx512_optimization_flags flags)
|
||||
if(WIN32)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(${flags} /QxCOMMON-AVX512 PARENT_SCOPE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(${flags} /arch:AVX512 PARENT_SCOPE)
|
||||
else()
|
||||
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(${flags} -xCOMMON-AVX512 PARENT_SCOPE)
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(${flags} -mavx512f -mfma PARENT_SCOPE)
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$")
|
||||
set(${flags} -mavx512f -mfma PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ie_arm_neon_optimization_flags flags)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# nothing
|
||||
elseif(ANDROID)
|
||||
if(ANDROID_ABI STREQUAL "arm64-v8a")
|
||||
set(${flags} -mfpu=neon PARENT_SCOPE)
|
||||
elseif(ANDROID_ABI STREQUAL "armeabi-v7a-hard with NEON")
|
||||
set(${flags} -march=armv7-a -mfloat-abi=hard -mhard-float -D_NDK_MATH_NO_SOFTFP=1 -mfpu=neon PARENT_SCOPE)
|
||||
elseif((ANDROID_ABI STREQUAL "armeabi-v7a with NEON") OR
|
||||
(ANDROID_ABI STREQUAL "armeabi-v7a" AND
|
||||
DEFINED CMAKE_ANDROID_ARM_NEON AND CMAKE_ANDROID_ARM_NEON))
|
||||
set(${flags} -march=armv7-a -mfloat-abi=softfp -mfpu=neon PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
if(AARCH64)
|
||||
set(${flags} -O2 -ftree-vectorize PARENT_SCOPE)
|
||||
elseif(ARM)
|
||||
set(${flags} -mfpu=neon PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Disables all warnings for 3rd party targets
|
||||
#
|
||||
function(ov_disable_all_warnings)
|
||||
foreach(target IN LISTS ARGN)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(${target} PRIVATE /WX-)
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
|
||||
target_compile_options(${target} PRIVATE -w)
|
||||
elseif(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
# 193: zero used for undefined preprocessing identifier "XXX"
|
||||
# 1011: missing return statement at end of non-void function "XXX"
|
||||
# 2415: variable "xxx" of static storage duration was declared but never referenced
|
||||
target_compile_options(${target} PRIVATE -diag-disable=warn,193,1011,2415)
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Enables Link Time Optimization compilation
|
||||
#
|
||||
macro(ie_enable_lto)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# Adds compiler flags to C / C++ sources
|
||||
#
|
||||
macro(ie_add_compiler_flags)
|
||||
foreach(flag ${ARGN})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
function(ov_add_compiler_flags)
|
||||
ie_add_compiler_flags(${ARGN})
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Forced includes certain header file to all target source files
|
||||
#
|
||||
function(ov_force_include target scope header_file)
|
||||
if(MSVC)
|
||||
target_compile_options(${target} ${scope} /FI"${header_file}")
|
||||
else()
|
||||
target_compile_options(${target} ${scope} -include "${header_file}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Compilation and linker flags
|
||||
#
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# to allows to override CMAKE_CXX_STANDARD from command line
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
||||
if(ENABLE_COVERAGE)
|
||||
ie_add_compiler_flags(--coverage)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
ie_add_compiler_flags(-fsigned-char)
|
||||
endif()
|
||||
|
||||
# Honor visibility properties for all target types
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
||||
|
||||
function(ie_python_minimal_api target)
|
||||
# pybind11 uses a lot of API which is not a part of minimal python API subset
|
||||
# Ref 1: https://docs.python.org/3.11/c-api/stable.html
|
||||
# Ref 2: https://github.com/pybind/pybind11/issues/1755
|
||||
# target_compile_definitions(${target} PRIVATE Py_LIMITED_API=0x03090000)
|
||||
# if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# target_compile_options(${target} PRIVATE "-Wno-unused-variable")
|
||||
# endif()
|
||||
endfunction()
|
||||
|
||||
if(WIN32)
|
||||
ie_add_compiler_flags(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
|
||||
ie_add_compiler_flags(/EHsc) # no asynchronous structured exception handling
|
||||
ie_add_compiler_flags(/Gy) # remove unreferenced functions: function level linking
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
|
||||
if (TREAT_WARNING_AS_ERROR)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
ie_add_compiler_flags(/WX)
|
||||
ie_add_compiler_flags(/Qdiag-warning:47,1740,1786)
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# ie_add_compiler_flags(/WX) # Too many warnings
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Compiler specific flags
|
||||
|
||||
ie_add_compiler_flags(/bigobj)
|
||||
ie_add_compiler_flags(/MP)
|
||||
|
||||
# Disable noisy warnings
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# C4251 needs to have dll-interface to be used by clients of class
|
||||
ie_add_compiler_flags(/wd4251)
|
||||
# C4275 non dll-interface class used as base for dll-interface class
|
||||
ie_add_compiler_flags(/wd4275)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
# 161: unrecognized pragma
|
||||
# 177: variable was declared but never referenced
|
||||
# 556: not matched type of assigned function pointer
|
||||
# 1744: field of class type without a DLL interface used in a class with a DLL interface
|
||||
# 1879: unimplemented pragma ignored
|
||||
# 2586: decorated name length exceeded, name was truncated
|
||||
# 2651: attribute does not apply to any entity
|
||||
# 3180: unrecognized OpenMP pragma
|
||||
# 11075: To get full report use -Qopt-report:4 -Qopt-report-phase ipo
|
||||
# 15335: was not vectorized: vectorization possible but seems inefficient. Use vector always directive or /Qvec-threshold0 to override
|
||||
ie_add_compiler_flags(/Qdiag-disable:161,177,556,1744,1879,2586,2651,3180,11075,15335)
|
||||
endif()
|
||||
|
||||
# Debug information flags, by default CMake adds /Zi option
|
||||
# but provides no way to specify CMAKE_COMPILE_PDB_NAME on root level
|
||||
# In order to avoid issues with ninja we are replacing default flag instead of having two of them
|
||||
# and observing warning D9025 about flag override
|
||||
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
else()
|
||||
# TODO: enable for C sources as well
|
||||
# ie_add_compiler_flags(-Werror)
|
||||
if(TREAT_WARNING_AS_ERROR)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
endif()
|
||||
|
||||
ie_add_compiler_flags(-ffunction-sections -fdata-sections)
|
||||
ie_add_compiler_flags(-fdiagnostics-show-option)
|
||||
ie_add_compiler_flags(-Wundef)
|
||||
ie_add_compiler_flags(-Wreturn-type)
|
||||
ie_add_compiler_flags(-Wunused-variable)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
ie_add_compiler_flags(-Wswitch)
|
||||
elseif(UNIX)
|
||||
ie_add_compiler_flags(-Wuninitialized -Winit-self)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
ie_add_compiler_flags(-Winconsistent-missing-override
|
||||
-Wstring-plus-int)
|
||||
else()
|
||||
ie_add_compiler_flags(-Wmaybe-uninitialized)
|
||||
check_cxx_compiler_flag("-Wsuggest-override" SUGGEST_OVERRIDE_SUPPORTED)
|
||||
if(SUGGEST_OVERRIDE_SUPPORTED)
|
||||
set(CMAKE_CXX_FLAGS "-Wsuggest-override ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Disable noisy warnings
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
# 177: function "XXX" was declared but never referenced
|
||||
ie_add_compiler_flags(-diag-disable=remark,177,2196)
|
||||
endif()
|
||||
|
||||
# Linker flags
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
elseif(LINUX)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
if(NOT ENABLE_FUZZING)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--exclude-libs,ALL")
|
||||
endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Links provided libraries and include their INTERFACE_INCLUDE_DIRECTORIES as SYSTEM
|
||||
function(link_system_libraries TARGET_NAME)
|
||||
set(MODE PRIVATE)
|
||||
|
||||
foreach(arg IN LISTS ARGN)
|
||||
if(arg MATCHES "(PRIVATE|PUBLIC|INTERFACE)")
|
||||
set(MODE ${arg})
|
||||
else()
|
||||
if(TARGET "${arg}")
|
||||
target_include_directories(${TARGET_NAME}
|
||||
SYSTEM ${MODE}
|
||||
$<TARGET_PROPERTY:${arg},INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:${arg},INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${MODE} ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
@@ -1,76 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
if (ENABLE_SANITIZER)
|
||||
if (WIN32)
|
||||
check_cxx_compiler_flag("/fsanitize=address" SANITIZE_ADDRESS_SUPPORTED)
|
||||
if (SANITIZE_ADDRESS_SUPPORTED)
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} /fsanitize=address")
|
||||
else()
|
||||
message(FATAL_ERROR "Address sanitizer is not supported by current compiler.\n"
|
||||
"Please, check requirements:\n"
|
||||
"https://github.com/openvinotoolkit/openvino/wiki/AddressSanitizer-and-LeakSanitizer")
|
||||
endif()
|
||||
else()
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=address")
|
||||
check_cxx_compiler_flag("-fsanitize-recover=address" SANITIZE_RECOVER_ADDRESS_SUPPORTED)
|
||||
if (SANITIZE_RECOVER_ADDRESS_SUPPORTED)
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize-recover=address")
|
||||
endif()
|
||||
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=address")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_UB_SANITIZER)
|
||||
if (WIN32)
|
||||
message(FATAL_ERROR "UndefinedBehavior sanitizer is not supported in Windows")
|
||||
endif()
|
||||
# TODO: Remove -fno-sanitize=null as thirdparty/ocl/clhpp_headers UBSAN compatibility resolved:
|
||||
# https://github.com/KhronosGroup/OpenCL-CLHPP/issues/17
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=undefined -fno-sanitize=null")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# TODO: Remove -Wno-maybe-uninitialized after CVS-61143 fix
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -Wno-maybe-uninitialized")
|
||||
endif()
|
||||
check_cxx_compiler_flag("-fsanitize-recover=undefined" SANITIZE_RECOVER_UNDEFINED_SUPPORTED)
|
||||
if (SANITIZE_RECOVER_UNDEFINED_SUPPORTED)
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize-recover=undefined")
|
||||
endif()
|
||||
|
||||
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=undefined")
|
||||
endif()
|
||||
|
||||
if (ENABLE_THREAD_SANITIZER)
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=thread")
|
||||
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=thread")
|
||||
endif()
|
||||
|
||||
# common sanitizer options
|
||||
if (DEFINED SANITIZER_COMPILER_FLAGS)
|
||||
# ensure symbols are present
|
||||
if (NOT WIN32)
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -g -fno-omit-frame-pointer")
|
||||
if(NOT OV_COMPILER_IS_CLANG)
|
||||
# GPU plugin tests compilation is slow with -fvar-tracking-assignments on GCC.
|
||||
# Clang has no var-tracking-assignments.
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fno-var-tracking-assignments")
|
||||
endif()
|
||||
# prevent unloading libraries at runtime, so sanitizer can resolve their symbols
|
||||
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -Wl,-z,nodelete")
|
||||
|
||||
if(OV_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
|
||||
endif()
|
||||
else()
|
||||
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} /Oy-")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_COMPILER_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_COMPILER_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SANITIZER_LINKER_FLAGS}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${SANITIZER_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_LINKER_FLAGS}")
|
||||
endif()
|
||||
@@ -1,48 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(UNIX)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wformat -Wformat-security")
|
||||
if (NOT ENABLE_SANITIZER)
|
||||
# ASan does not support fortification https://github.com/google/sanitizers/issues/247
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
|
||||
endif()
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pie")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
|
||||
else()
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong")
|
||||
endif()
|
||||
if (NOT ENABLE_SANITIZER)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -s")
|
||||
endif()
|
||||
elseif(OV_COMPILER_IS_CLANG)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if (NOT ENABLE_SANITIZER)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wl,--strip-all")
|
||||
endif()
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong")
|
||||
set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /sdl")
|
||||
endif()
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /guard:cf")
|
||||
if(ENABLE_INTEGRITYCHECK)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /INTEGRITYCHECK")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${IE_C_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${IE_C_CXX_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
|
||||
@@ -1,213 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(OV_COVERAGE_GCDA_DATA_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
|
||||
if(NOT TARGET ie_coverage_clean)
|
||||
add_custom_target(ie_coverage_clean)
|
||||
set_target_properties(ie_coverage_clean PROPERTIES FOLDER coverage)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET ie_coverage_init)
|
||||
add_custom_target(ie_coverage_init)
|
||||
set_target_properties(ie_coverage_init PROPERTIES FOLDER coverage)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET ie_coverage)
|
||||
add_custom_target(ie_coverage)
|
||||
set_target_properties(ie_coverage PROPERTIES FOLDER coverage)
|
||||
endif()
|
||||
|
||||
set(IE_COVERAGE_REPORTS "${CMAKE_BINARY_DIR}/coverage")
|
||||
set(IE_COVERAGE_SCRIPT_DIR "${IEDevScripts_DIR}/coverage")
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
#
|
||||
# ie_coverage_clean(REPOSITORY <repo> DIRECTORY <dir>)
|
||||
#
|
||||
function(ie_coverage_clean)
|
||||
cmake_parse_arguments(IE_COVERAGE "" "REPOSITORY;DIRECTORY" "" ${ARGN})
|
||||
|
||||
add_custom_target(ie_coverage_zerocounters_${IE_COVERAGE_REPOSITORY}
|
||||
COMMAND lcov --zerocounters --quiet
|
||||
--directory "${IE_COVERAGE_DIRECTORY}"
|
||||
COMMENT "Add zero counters for coverage for ${IE_COVERAGE_REPOSITORY}"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_target(ie_coverage_clean_${IE_COVERAGE_REPOSITORY}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D "IE_COVERAGE_REPORTS=${IE_COVERAGE_REPORTS}"
|
||||
-D "IE_COVERAGE_DIRECTORY=${IE_COVERAGE_DIRECTORY}"
|
||||
-D "CMAKE_BINARY_DIRECTORY=${CMAKE_BINARY_DIR}"
|
||||
-D "CMAKE_SOURCE_DIRECTORY=${CMAKE_SOURCE_DIR}"
|
||||
-P "${IE_COVERAGE_SCRIPT_DIR}/coverage_clean.cmake"
|
||||
COMMENT "Clean previously created HTML report files for ${IE_COVERAGE_REPOSITORY}"
|
||||
DEPENDS "${IE_COVERAGE_SCRIPT_DIR}/coverage_clean.cmake"
|
||||
VERBATIM)
|
||||
|
||||
set_target_properties(ie_coverage_zerocounters_${IE_COVERAGE_REPOSITORY}
|
||||
ie_coverage_clean_${IE_COVERAGE_REPOSITORY}
|
||||
PROPERTIES FOLDER coverage)
|
||||
|
||||
add_dependencies(ie_coverage_clean ie_coverage_zerocounters_${IE_COVERAGE_REPOSITORY}
|
||||
ie_coverage_clean_${IE_COVERAGE_REPOSITORY})
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# ie_coverage_capture(INFO_FILE <info_file>
|
||||
# BASE_DIRECTORY <base dir>
|
||||
# DIRECTORY <gcda dir>)
|
||||
#
|
||||
function(ie_coverage_capture)
|
||||
cmake_parse_arguments(IE_COVERAGE "" "INFO_FILE;BASE_DIRECTORY;DIRECTORY" "" ${ARGN})
|
||||
|
||||
set(output_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_INFO_FILE}.info")
|
||||
set(output_base_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_INFO_FILE}_base.info")
|
||||
set(output_tests_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_INFO_FILE}_tests.info")
|
||||
|
||||
add_custom_command(OUTPUT ${output_base_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${IE_COVERAGE_REPORTS}"
|
||||
COMMAND lcov --no-external --capture --initial --quiet
|
||||
--directory "${IE_COVERAGE_DIRECTORY}"
|
||||
--base-directory "${IE_COVERAGE_BASE_DIRECTORY}"
|
||||
--output-file ${output_base_file}
|
||||
COMMENT "Capture initial coverage data ${IE_COVERAGE_INFO_FILE}"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_command(OUTPUT ${output_tests_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${IE_COVERAGE_REPORTS}"
|
||||
COMMAND lcov --no-external --capture --quiet
|
||||
--directory "${IE_COVERAGE_DIRECTORY}"
|
||||
--base-directory "${IE_COVERAGE_BASE_DIRECTORY}"
|
||||
--output-file ${output_tests_file}
|
||||
COMMENT "Capture test coverage data ${IE_COVERAGE_INFO_FILE}"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_command(OUTPUT ${output_file}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D "IE_COVERAGE_OUTPUT_FILE=${output_file}"
|
||||
-D "IE_COVERAGE_INPUT_FILES=${output_base_file};${output_tests_file}"
|
||||
-P "${IE_COVERAGE_SCRIPT_DIR}/coverage_merge.cmake"
|
||||
COMMENT "Generate total coverage data ${IE_COVERAGE_INFO_FILE}"
|
||||
DEPENDS ${output_base_file} ${output_tests_file}
|
||||
VERBATIM)
|
||||
|
||||
add_custom_target(ie_coverage_${IE_COVERAGE_INFO_FILE}_info
|
||||
DEPENDS ${output_file})
|
||||
set_target_properties(ie_coverage_${IE_COVERAGE_INFO_FILE}_info
|
||||
PROPERTIES FOLDER coverage)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# ie_coverage_extract(INPUT <info_file> OUTPUT <output_file> PATTERNS <patterns ...>)
|
||||
#
|
||||
function(ie_coverage_extract)
|
||||
cmake_parse_arguments(IE_COVERAGE "" "INPUT;OUTPUT" "PATTERNS" ${ARGN})
|
||||
|
||||
set(input_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_INPUT}.info")
|
||||
set(output_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_OUTPUT}.info")
|
||||
|
||||
set(commands lcov --quiet)
|
||||
foreach(pattern IN LISTS IE_COVERAGE_PATTERNS)
|
||||
list(APPEND commands --extract ${input_file} ${pattern})
|
||||
endforeach()
|
||||
list(APPEND commands --output-file ${output_file})
|
||||
|
||||
add_custom_command(OUTPUT ${output_file}
|
||||
COMMAND ${commands}
|
||||
COMMENT "Generate coverage data ${IE_COVERAGE_OUTPUT}"
|
||||
DEPENDS ${input_file}
|
||||
VERBATIM)
|
||||
add_custom_target(ie_coverage_${IE_COVERAGE_OUTPUT}_info
|
||||
DEPENDS ${output_file})
|
||||
set_target_properties(ie_coverage_${IE_COVERAGE_OUTPUT}_info
|
||||
PROPERTIES FOLDER coverage)
|
||||
|
||||
add_dependencies(ie_coverage_${IE_COVERAGE_OUTPUT}_info ie_coverage_${IE_COVERAGE_INPUT}_info)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# ie_coverage_remove(INPUT <info_file> OUTPUT <output_file> PATTERNS <patterns ...>)
|
||||
#
|
||||
function(ie_coverage_remove)
|
||||
cmake_parse_arguments(IE_COVERAGE "" "INPUT;OUTPUT" "PATTERNS" ${ARGN})
|
||||
|
||||
set(input_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_INPUT}.info")
|
||||
set(output_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_OUTPUT}.info")
|
||||
|
||||
set(commands lcov --quiet)
|
||||
foreach(pattern IN LISTS IE_COVERAGE_PATTERNS)
|
||||
list(APPEND commands --remove ${input_file} ${pattern})
|
||||
endforeach()
|
||||
list(APPEND commands --output-file ${output_file})
|
||||
|
||||
add_custom_command(OUTPUT ${output_file}
|
||||
COMMAND ${commands}
|
||||
COMMENT "Generate coverage data ${IE_COVERAGE_OUTPUT}"
|
||||
DEPENDS ${input_file}
|
||||
VERBATIM)
|
||||
add_custom_target(ie_coverage_${IE_COVERAGE_OUTPUT}_info
|
||||
DEPENDS ${output_file})
|
||||
set_target_properties(ie_coverage_${IE_COVERAGE_OUTPUT}_info
|
||||
PROPERTIES FOLDER coverage)
|
||||
|
||||
add_dependencies(ie_coverage_${IE_COVERAGE_OUTPUT}_info ie_coverage_${IE_COVERAGE_INPUT}_info)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# ie_coverage_merge(OUTPUT <output file> INPUTS <input files ...>)
|
||||
#
|
||||
function(ie_coverage_merge)
|
||||
cmake_parse_arguments(IE_COVERAGE "" "OUTPUT" "INPUTS" ${ARGN})
|
||||
|
||||
set(output_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_OUTPUT}.info")
|
||||
foreach(input_info_file IN LISTS IE_COVERAGE_INPUTS)
|
||||
set(input_file ${IE_COVERAGE_REPORTS}/${input_info_file}.info)
|
||||
list(APPEND dependencies ie_coverage_${input_info_file}_info)
|
||||
list(APPEND input_files ${input_file})
|
||||
endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${output_file}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D "IE_COVERAGE_OUTPUT_FILE=${output_file}"
|
||||
-D "IE_COVERAGE_INPUT_FILES=${input_files}"
|
||||
-P "${IE_COVERAGE_SCRIPT_DIR}/coverage_merge.cmake"
|
||||
COMMENT "Generate coverage data ${IE_COVERAGE_OUTPUT}"
|
||||
DEPENDS ${input_files}
|
||||
VERBATIM)
|
||||
add_custom_target(ie_coverage_${IE_COVERAGE_OUTPUT}_info
|
||||
DEPENDS ${output_file})
|
||||
set_target_properties(ie_coverage_${IE_COVERAGE_OUTPUT}_info
|
||||
PROPERTIES FOLDER coverage)
|
||||
|
||||
add_dependencies(ie_coverage_${IE_COVERAGE_OUTPUT}_info ${dependencies})
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# ie_coverage_genhtml(INFO_FILE <info_file> PREFIX <prefix>)
|
||||
#
|
||||
function(ie_coverage_genhtml)
|
||||
cmake_parse_arguments(IE_COVERAGE "" "INFO_FILE;PREFIX" "" ${ARGN})
|
||||
|
||||
set(input_file "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_INFO_FILE}.info")
|
||||
set(output_directory "${IE_COVERAGE_REPORTS}/${IE_COVERAGE_INFO_FILE}")
|
||||
|
||||
add_custom_command(OUTPUT "${output_directory}/index.html"
|
||||
COMMAND genhtml ${input_file} --title "${IE_COVERAGE_INFO_FILE}" --legend
|
||||
--no-branch-coverage --demangle-cpp
|
||||
--output-directory "${output_directory}"
|
||||
--num-spaces 4 --quiet
|
||||
--prefix "${IE_COVERAGE_PREFIX}"
|
||||
DEPENDS ${input_file}
|
||||
COMMENT "Generate HTML report for ${IE_COVERAGE_INFO_FILE}"
|
||||
VERBATIM)
|
||||
add_custom_target(ie_coverage_${IE_COVERAGE_INFO_FILE}_genhtml
|
||||
DEPENDS "${output_directory}/index.html")
|
||||
set_target_properties(ie_coverage_${IE_COVERAGE_INFO_FILE}_genhtml
|
||||
PROPERTIES FOLDER coverage)
|
||||
|
||||
add_dependencies(ie_coverage_${IE_COVERAGE_INFO_FILE}_genhtml ie_coverage_${IE_COVERAGE_INFO_FILE}_info)
|
||||
add_dependencies(ie_coverage ie_coverage_${IE_COVERAGE_INFO_FILE}_genhtml)
|
||||
endfunction()
|
||||
@@ -1,30 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(NOT DEFINED IE_COVERAGE_REPORTS)
|
||||
message(FATAL_ERROR "IE_COVERAGE_REPORTS variable is not defined")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${IE_COVERAGE_REPORTS}")
|
||||
|
||||
if(NOT DEFINED IE_COVERAGE_DIRECTORY)
|
||||
message(FATAL_ERROR "IE_COVERAGE_DIRECTORY variable is not defined")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# remove .gcno files which are kept from the previous build
|
||||
|
||||
file(GLOB_RECURSE gcno_files "${IE_COVERAGE_DIRECTORY}/*.gcno")
|
||||
foreach(file IN LISTS gcno_files)
|
||||
string(REPLACE ".gcno" "" temp_file "${file}")
|
||||
string(REGEX REPLACE "CMakeFiles/.+dir/" "" temp_file "${temp_file}")
|
||||
string(REPLACE "${CMAKE_BINARY_DIRECTORY}" "${CMAKE_SOURCE_DIRECTORY}" source_file "${temp_file}")
|
||||
|
||||
if(NOT EXISTS "${source_file}")
|
||||
file(REMOVE "${file}")
|
||||
string(REPLACE "${CMAKE_BINARY_DIRECTORY}/" "" file "${file}")
|
||||
message("Removing ${file}")
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -1,22 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(NOT DEFINED IE_COVERAGE_OUTPUT_FILE)
|
||||
message(FATAL_ERROR "IE_COVERAGE_OUTPUT_FILE is not defined")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED IE_COVERAGE_INPUT_FILES)
|
||||
message(FATAL_ERROR "IE_COVERAGE_INPUT_FILES is not defined")
|
||||
endif()
|
||||
|
||||
set(command lcov --quiet)
|
||||
foreach(input_info_file IN LISTS IE_COVERAGE_INPUT_FILES)
|
||||
file(SIZE ${input_info_file} size)
|
||||
if(NOT size EQUAL 0)
|
||||
list(APPEND command --add-tracefile "${input_info_file}")
|
||||
endif()
|
||||
endforeach()
|
||||
list(APPEND command --output-file ${IE_COVERAGE_OUTPUT_FILE})
|
||||
|
||||
execute_process(COMMAND ${command})
|
||||
@@ -1,107 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(ENABLE_CPPLINT)
|
||||
find_package(PythonInterp 3 QUIET)
|
||||
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
message(WARNING "Python3 interpreter was not found (required for cpplint check)")
|
||||
set(ENABLE_CPPLINT OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_CPPLINT AND NOT TARGET cpplint_all)
|
||||
add_custom_target(cpplint_all ALL)
|
||||
set_target_properties(cpplint_all PROPERTIES FOLDER cpplint)
|
||||
set(CPPLINT_ALL_OUTPUT_FILES "" CACHE INTERNAL "All cpplint output files")
|
||||
endif()
|
||||
|
||||
function(add_cpplint_target TARGET_NAME)
|
||||
if(NOT ENABLE_CPPLINT)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(options "")
|
||||
set(oneValueArgs "")
|
||||
set(multiValueArgs FOR_TARGETS FOR_SOURCES EXCLUDE_PATTERNS CUSTOM_FILTERS)
|
||||
cmake_parse_arguments(CPPLINT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(target IN LISTS CPPLINT_FOR_TARGETS)
|
||||
get_target_property(target_sources "${target}" SOURCES)
|
||||
list(APPEND CPPLINT_FOR_SOURCES ${target_sources})
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES CPPLINT_FOR_SOURCES)
|
||||
|
||||
set(custom_filter "")
|
||||
foreach(filter IN LISTS CPPLINT_CUSTOM_FILTERS)
|
||||
string(CONCAT custom_filter "${custom_filter}" "," "${filter}")
|
||||
endforeach()
|
||||
|
||||
set(all_output_files "")
|
||||
foreach(source_file IN LISTS CPPLINT_FOR_SOURCES)
|
||||
set(exclude FALSE)
|
||||
foreach(pattern IN LISTS CPPLINT_EXCLUDE_PATTERNS)
|
||||
if(source_file MATCHES "${pattern}")
|
||||
set(exclude ON)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(exclude)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# ignore object libraries
|
||||
if(NOT EXISTS "${source_file}")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
file(RELATIVE_PATH source_file_relative "${CMAKE_CURRENT_SOURCE_DIR}" "${source_file}")
|
||||
set(output_file "${CMAKE_CURRENT_BINARY_DIR}/cpplint/${source_file_relative}.cpplint")
|
||||
string(REPLACE ".." "__" output_file "${output_file}")
|
||||
get_filename_component(output_dir "${output_file}" DIRECTORY)
|
||||
file(MAKE_DIRECTORY "${output_dir}")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
"${output_file}"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
-D "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}"
|
||||
-D "CPPLINT_SCRIPT=${IEDevScripts_DIR}/cpplint/cpplint.py"
|
||||
-D "INPUT_FILE=${source_file}"
|
||||
-D "OUTPUT_FILE=${output_file}"
|
||||
-D "WORKING_DIRECTORY=${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
-D "SKIP_RETURN_CODE=${ENABLE_CPPLINT_REPORT}"
|
||||
-D "CUSTOM_FILTER=${custom_filter}"
|
||||
-P "${IEDevScripts_DIR}/cpplint/cpplint_run.cmake"
|
||||
DEPENDS
|
||||
"${source_file}"
|
||||
"${IEDevScripts_DIR}/cpplint/cpplint.py"
|
||||
"${IEDevScripts_DIR}/cpplint/cpplint_run.cmake"
|
||||
COMMENT
|
||||
"[cpplint] ${source_file}"
|
||||
VERBATIM)
|
||||
|
||||
list(APPEND all_output_files "${output_file}")
|
||||
endforeach()
|
||||
|
||||
set(CPPLINT_ALL_OUTPUT_FILES
|
||||
${CPPLINT_ALL_OUTPUT_FILES} ${all_output_files}
|
||||
CACHE INTERNAL
|
||||
"All cpplint output files")
|
||||
|
||||
add_custom_target(${TARGET_NAME} ALL
|
||||
DEPENDS ${all_output_files}
|
||||
COMMENT "[cpplint] ${TARGET_NAME}")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER cpplint)
|
||||
|
||||
if(CPPLINT_FOR_TARGETS)
|
||||
foreach(target IN LISTS CPPLINT_FOR_TARGETS)
|
||||
add_dependencies(${target} ${TARGET_NAME})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
add_dependencies(cpplint_all ${TARGET_NAME})
|
||||
endfunction()
|
||||
6624
cmake/developer_package/cpplint/cpplint.py
vendored
6624
cmake/developer_package/cpplint/cpplint.py
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
file(REMOVE "${OUTPUT_FILE}")
|
||||
|
||||
set(DEFAULT_FILTER "
|
||||
-build/header_guard,\
|
||||
-build/include,\
|
||||
-build/include_order,\
|
||||
-build/include_subdir,\
|
||||
-build/include_what_you_use,\
|
||||
-build/namespaces,\
|
||||
-build/c++11,\
|
||||
-whitespace/indent,\
|
||||
-whitespace/comments,\
|
||||
-whitespace/ending_newline,\
|
||||
-runtime/references,\
|
||||
-runtime/int,\
|
||||
-runtime/explicit,\
|
||||
-readability/todo,\
|
||||
-readability/fn_size,\
|
||||
")
|
||||
set(FILTER "${DEFAULT_FILTER}${CUSTOM_FILTER}")
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${PYTHON_EXECUTABLE}"
|
||||
"${CPPLINT_SCRIPT}"
|
||||
"--linelength=160"
|
||||
"--counting=detailed"
|
||||
"--quiet"
|
||||
"--filter=${FILTER}"
|
||||
"${INPUT_FILE}"
|
||||
WORKING_DIRECTORY "${WORKING_DIRECTORY}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE output)
|
||||
|
||||
# Store cpplint output to file (replace problematic symbols)
|
||||
string(REPLACE "\"" ""\;" formatted_output "${output}")
|
||||
string(REPLACE "<" "<\;" formatted_output "${formatted_output}")
|
||||
string(REPLACE ">" ">\;" formatted_output "${formatted_output}")
|
||||
string(REPLACE "'" "&apos\;" formatted_output "${formatted_output}")
|
||||
string(REPLACE "&" "&\;" formatted_output "${formatted_output}")
|
||||
file(WRITE "${OUTPUT_FILE}" "${formatted_output}")
|
||||
|
||||
if(NOT SKIP_RETURN_CODE)
|
||||
# Pass through the cpplint return code
|
||||
if(NOT result EQUAL "0")
|
||||
# Display the cpplint output to console (to parse it form IDE)
|
||||
message("${output}")
|
||||
message(FATAL_ERROR "[cpplint] Code style check failed for : ${INPUT_FILE}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,104 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# =================================================================
|
||||
#
|
||||
# Generates cpp file with dispatcher for cross compiled function
|
||||
# Parameters:
|
||||
# XARCH_API_HEADER -- path to header with function declaration
|
||||
# XARCH_FUNC_NAME -- name of function to dispatch
|
||||
# XARCH_NAMESPACES -- full namespace used to keep ODR
|
||||
# XARCH_DISP_FILE -- dispatcher file name to generate
|
||||
# XARCH_SET -- set of ARCH supported by dispatcher. semicolon-delimited
|
||||
#
|
||||
# =================================================================
|
||||
|
||||
set(_CPU_CHECK_ANY "true")
|
||||
set(_CPU_CHECK_SSE42 "with_cpu_x86_sse42()")
|
||||
set(_CPU_CHECK_AVX "with_cpu_x86_avx()")
|
||||
set(_CPU_CHECK_AVX2 "with_cpu_x86_avx2()")
|
||||
set(_CPU_CHECK_AVX512F "with_cpu_x86_avx512f()")
|
||||
|
||||
function(_generate_dispatcher)
|
||||
_find_signature_in_file(${XARCH_API_HEADER} ${XARCH_FUNC_NAME} SIGNATURE)
|
||||
_generate_call_line_from_signature("${SIGNATURE}" CALL_LINE)
|
||||
|
||||
string(REPLACE "::" ";" XARCH_NAMESPACES "${XARCH_NAMESPACES}")
|
||||
|
||||
list(GET XARCH_NAMESPACES -1 XARCH_CURRENT_NAMESPACE)
|
||||
set(PARENT_NAMESPACES ${XARCH_NAMESPACES})
|
||||
list(REMOVE_AT PARENT_NAMESPACES -1)
|
||||
|
||||
set(DISP_CONTENT
|
||||
"
|
||||
//
|
||||
// Auto generated file by CMake macros cross_compiled_file()
|
||||
// !! do not modify it !!!
|
||||
//
|
||||
#include \"${XARCH_API_HEADER}\"
|
||||
#include \"ie_system_conf.h\"
|
||||
|
||||
")
|
||||
|
||||
foreach(_namespace ${PARENT_NAMESPACES})
|
||||
string(APPEND DISP_CONTENT
|
||||
"namespace ${_namespace} {\n")
|
||||
endforeach()
|
||||
|
||||
foreach(_arch ${XARCH_SET})
|
||||
string(APPEND DISP_CONTENT
|
||||
"namespace ${_arch} {\n ${SIGNATURE}\; \n}\n")
|
||||
endforeach()
|
||||
|
||||
string(APPEND DISP_CONTENT
|
||||
"namespace ${XARCH_CURRENT_NAMESPACE} {\n\n${SIGNATURE} {\n")
|
||||
|
||||
foreach(_arch ${XARCH_SET})
|
||||
string(APPEND DISP_CONTENT
|
||||
" if (${_CPU_CHECK_${_arch}}) {\n return ${_arch}::${CALL_LINE}\;\n }\n")
|
||||
endforeach()
|
||||
|
||||
string(APPEND DISP_CONTENT "}\n\n}\n")
|
||||
|
||||
foreach(_namespace ${PARENT_NAMESPACES})
|
||||
string(APPEND DISP_CONTENT "} // namespace ${_namespace}\n")
|
||||
endforeach()
|
||||
|
||||
file(WRITE ${XARCH_DISP_FILE} ${DISP_CONTENT})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(_find_signature_in_file FILE FUNCTION RESULT_NAME)
|
||||
file(READ "${FILE}" CONTENT)
|
||||
set(valid_chars "<>:_*& a-zA-Z0-9\n") ## valid chars for type/var specification (including new line /n)
|
||||
string(REGEX MATCH "[${valid_chars}]*${FUNCTION}[ ]*[(][=,${valid_chars}]*[)]" SIGNATURE ${CONTENT})
|
||||
string(STRIP "${SIGNATURE}" SIGNATURE)
|
||||
set (${RESULT_NAME} "${SIGNATURE}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_generate_call_line_from_signature SIGNATURE RESULT_NAME)
|
||||
## extract func name
|
||||
set(_name ${SIGNATURE})
|
||||
string(REGEX REPLACE "[ ]*[(].*[)]" "" _name "${_name}") # remove arguments
|
||||
string(REGEX MATCH "[a-zA-Z0-9_]*[ ]*$" _name "${_name}") # extract func name
|
||||
|
||||
set(nt_chars "[:_*& a-zA-Z0-9\n]*") ## any sequence of chars to describe object type (no template)
|
||||
|
||||
## extract arg names
|
||||
set(_args ${SIGNATURE})
|
||||
string(REGEX MATCH "[(].*[)]" _args "${_args}") # extract args with types, all inside brackets
|
||||
string(REGEX REPLACE "<${nt_chars},${nt_chars}>" "" _args "${_args}") # remove template brackets with ','
|
||||
string(REPLACE "(" "" _args ${_args})
|
||||
string(REPLACE ")" "" _args ${_args})
|
||||
string(REPLACE "," ";" _args ${_args}) # now it's list
|
||||
foreach(_arg_elem ${_args})
|
||||
string(REGEX MATCH "[a-zA-Z0-9_]*[ ]*$" _arg_elem "${_arg_elem}")
|
||||
list(APPEND _arg_names ${_arg_elem})
|
||||
endforeach()
|
||||
string(REPLACE ";" ", " _arg_names "${_arg_names}") # back to comma separated string
|
||||
|
||||
set (${RESULT_NAME} "${_name}(${_arg_names})" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_generate_dispatcher()
|
||||
@@ -1,16 +0,0 @@
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# =================================================================
|
||||
#
|
||||
# This file is used to add dependency on option value. If the args
|
||||
# was changes the configure file will be updated. And the dependent
|
||||
# add_custom_command will rerun.
|
||||
#
|
||||
# Otherwise the changing of CMake options will not have affect on
|
||||
# generated file.
|
||||
#
|
||||
# =================================================================
|
||||
|
||||
@_GEN_ARGS_LIST@
|
||||
@@ -1,206 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
## list of available instruction sets
|
||||
set(_ARCH_LIST ANY SSE42 AVX AVX2 AVX512F)
|
||||
|
||||
set(_ACCEPTED_ARCHS_ANY "^(ANY)$")
|
||||
set(_ACCEPTED_ARCHS_SSE42 "^(ANY|SSE42)$")
|
||||
set(_ACCEPTED_ARCHS_AVX "^(ANY|SSE42|AVX)$")
|
||||
set(_ACCEPTED_ARCHS_AVX2 "^(ANY|SSE42|AVX|AVX2)$")
|
||||
set(_ACCEPTED_ARCHS_AVX512F "^(ANY|SSE42|AVX|AVX2|AVX512F)$")
|
||||
|
||||
## Arch specific definitions
|
||||
set(_DEFINE_ANY "")
|
||||
set(_DEFINE_SSE42 "HAVE_SSE42" ${_DEFINE_ANY})
|
||||
set(_DEFINE_AVX "HAVE_AVX" ${_DEFINE_SSE42})
|
||||
set(_DEFINE_AVX2 "HAVE_AVX2" ${_DEFINE_AVX})
|
||||
set(_DEFINE_AVX512F "HAVE_AVX512F" ${_DEFINE_AVX2})
|
||||
|
||||
## Arch specific compile options
|
||||
ie_avx512_optimization_flags(_FLAGS_AVX512F)
|
||||
ie_avx2_optimization_flags (_FLAGS_AVX2)
|
||||
ie_sse42_optimization_flags (_FLAGS_SSE42)
|
||||
set(_FLAGS_AVX "") ## TBD is not defined for IE project yet
|
||||
set(_FLAGS_ANY "") ##
|
||||
|
||||
## way to duplicate file via cmake tool set
|
||||
if (UNIX)
|
||||
## Clone sources via sym link because it allow to modify original file in IDE along with debug
|
||||
set(TO_DUPLICATE create_symlink)
|
||||
else()
|
||||
## Windows and others - just copy
|
||||
set(TO_DUPLICATE copy)
|
||||
endif()
|
||||
|
||||
set(DISPATCHER_GEN_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/cross_compiled_disp_gen.cmake)
|
||||
set(DISPATCHER_GEN_OPTIONS_HOLDER ${CMAKE_CURRENT_LIST_DIR}/cross_compiled_disp_gen_options.in)
|
||||
|
||||
|
||||
#######################################
|
||||
#
|
||||
# Allow to enable multiple cross compilation of source file inside one module
|
||||
# with keeping requirements on minimal instruction set. The CPU check performed
|
||||
# in runtime via common utils declared in "ie_system_conf.h".
|
||||
#
|
||||
# Usage example:
|
||||
# cross_compiled_file(<target>
|
||||
# ARCH
|
||||
# ANY <source_file>
|
||||
# SSE SSE42 <source_file>
|
||||
# AVX AVX2 <source_file>
|
||||
# AVX512F <source_file>
|
||||
# API <header_file>
|
||||
# NAMESPACE <namespace> # like "IE::Ext::CPU::XARCH"
|
||||
# NAME <function_name> # like "my_fun"
|
||||
# )
|
||||
#
|
||||
function(cross_compiled_file TARGET)
|
||||
set(oneValueArgs API ## Header with declaration of cross compiled function
|
||||
NAMESPACE ## The namespace where cross compiled function was declared
|
||||
NAME) ## String with function signature to make cross compiled
|
||||
set(multiValueArgs ARCH) ## List of architecture described in _ARCH_LIST
|
||||
cmake_parse_arguments(X "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
## verification
|
||||
if(X_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unknown argument: " ${X_UNPARSED_ARGUMENTS})
|
||||
endif()
|
||||
if((NOT TARGET) OR (NOT X_NAME) OR (NOT X_NAMESPACE) OR (NOT X_API) OR (NOT X_ARCH))
|
||||
message(FATAL_ERROR "Missed arguments")
|
||||
endif()
|
||||
|
||||
_currently_requested_top_arch(TOP_ARCH)
|
||||
set(_CURRENT_ARCH_FILTER "${_ACCEPTED_ARCHS_${TOP_ARCH}}")
|
||||
|
||||
## format: ARCH1 ARCH2 <src1> ARCH3 <src2> ...
|
||||
foreach(_it ${X_ARCH})
|
||||
if (_it IN_LIST _ARCH_LIST)
|
||||
## that is arch ID
|
||||
set(_arch ${_it})
|
||||
if(_arch MATCHES ${_CURRENT_ARCH_FILTER})
|
||||
list(APPEND _CUR_ARCH_SET ${_arch})
|
||||
list(APPEND _FULL_ARCH_SET ${_arch})
|
||||
endif()
|
||||
else()
|
||||
## that is source file name
|
||||
set(_src_name ${_it})
|
||||
_remove_source_from_target(${TARGET} ${_src_name})
|
||||
_clone_source_to_target(${TARGET} ${_src_name} "${_CUR_ARCH_SET}")
|
||||
set(_CUR_ARCH_SET "")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
_add_dispatcher_to_target(${TARGET} ${X_API} ${X_NAME} "${X_NAMESPACE}" "${_FULL_ARCH_SET}")
|
||||
endfunction()
|
||||
|
||||
|
||||
##########################################
|
||||
#
|
||||
# Add source multiple time per each element in ARCH_SET.
|
||||
# Also provide corresponding arch specific flags and defines.
|
||||
#
|
||||
function(_clone_source_to_target TARGET SOURCE ARCH_SET)
|
||||
foreach(_arch ${ARCH_SET})
|
||||
set(_arch_dir cross-compiled/${_arch})
|
||||
|
||||
get_filename_component(ARCH_NAME ${SOURCE} NAME)
|
||||
get_filename_component(ARCH_INCLUDE_DIR ${SOURCE} DIRECTORY)
|
||||
set(ARCH_SOURCE "${_arch_dir}/${ARCH_NAME}")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${ARCH_SOURCE}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${_arch_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E ${TO_DUPLICATE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${ARCH_SOURCE}
|
||||
DEPENDS ${SOURCE}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
set_property(SOURCE ${ARCH_SOURCE} APPEND_STRING PROPERTY COMPILE_OPTIONS
|
||||
"${_FLAGS_${_arch}}")
|
||||
|
||||
set_property(SOURCE ${ARCH_SOURCE} APPEND PROPERTY COMPILE_DEFINITIONS
|
||||
${_DEFINE_${_arch}}
|
||||
"XARCH=${_arch}" ## to replace XARCH with direct ARCH name
|
||||
)
|
||||
|
||||
## To make `#include "some.hpp"` valid
|
||||
set_property(SOURCE ${ARCH_SOURCE} APPEND PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${ARCH_INCLUDE_DIR}")
|
||||
|
||||
list(APPEND _ARCH_SOURCES ${ARCH_SOURCE})
|
||||
endforeach()
|
||||
|
||||
target_sources(${TARGET} PRIVATE ${_ARCH_SOURCES})
|
||||
endfunction()
|
||||
|
||||
|
||||
##########################################
|
||||
#
|
||||
# Generate dispatcher for provided function
|
||||
# for archs in ARCH_SET.
|
||||
#
|
||||
function(_add_dispatcher_to_target TARGET HEADER FUNC_NAME NAMESPACE ARCH_SET)
|
||||
get_filename_component(DISPATCHER_NAME ${HEADER} NAME_WE)
|
||||
get_filename_component(DISPATCHER_INCLUDE_DIR ${HEADER} DIRECTORY)
|
||||
set(DISPATCHER_SOURCE "cross-compiled/${DISPATCHER_NAME}_disp.cpp")
|
||||
set(DISPATCHER_OPT_HOLDER "cross-compiled/${DISPATCHER_NAME}_holder.txt")
|
||||
|
||||
configure_file(${DISPATCHER_GEN_OPTIONS_HOLDER} ${DISPATCHER_OPT_HOLDER})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${DISPATCHER_SOURCE}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D "XARCH_FUNC_NAME=${X_NAME}"
|
||||
-D "XARCH_NAMESPACES=${NAMESPACE}"
|
||||
-D "XARCH_API_HEADER=${CMAKE_CURRENT_SOURCE_DIR}/${HEADER}"
|
||||
-D "XARCH_DISP_FILE=${CMAKE_CURRENT_BINARY_DIR}/${DISPATCHER_SOURCE}"
|
||||
-D "XARCH_SET=${ARCH_SET}"
|
||||
-P ${DISPATCHER_GEN_SCRIPT}
|
||||
DEPENDS ${HEADER}
|
||||
${DISPATCHER_GEN_SCRIPT}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DISPATCHER_OPT_HOLDER} ## Just to make run dependency on args value
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
set_property(SOURCE ${DISPATCHER_SOURCE} APPEND PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${DISPATCHER_INCLUDE_DIR}")
|
||||
|
||||
target_sources(${TARGET} PRIVATE ${DISPATCHER_SOURCE})
|
||||
endfunction()
|
||||
|
||||
#######################################
|
||||
#
|
||||
# Return currently requested ARCH id
|
||||
#
|
||||
function(_currently_requested_top_arch VAR)
|
||||
if(ENABLE_AVX512F)
|
||||
set(RES AVX512F)
|
||||
elseif(ENABLE_AVX2)
|
||||
set(RES AVX2)
|
||||
elseif(ENABLE_SSE42)
|
||||
set(RES SSE42)
|
||||
else()
|
||||
set(RES ANY)
|
||||
endif()
|
||||
set (${VAR} "${RES}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#####################################
|
||||
#
|
||||
# Utils to handle with cmake target
|
||||
#
|
||||
function(_remove_source_from_target TARGET SOURCE_FILE)
|
||||
get_target_property(ORIGINAL_SOURCES ${TARGET} SOURCES)
|
||||
|
||||
## To match by file name only. The path is any.
|
||||
list(FILTER ORIGINAL_SOURCES EXCLUDE REGEX ".*${SOURCE_FILE}$")
|
||||
|
||||
set_target_properties(${TARGET}
|
||||
PROPERTIES
|
||||
SOURCES "${ORIGINAL_SOURCES}")
|
||||
endfunction()
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
function (debug_message)
|
||||
if (VERBOSE_BUILD)
|
||||
message(${ARGV})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(clean_message type)
|
||||
string (REPLACE ";" "" output_string "${ARGN}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${output_string}")
|
||||
if(${ARGV0} STREQUAL "FATAL_ERROR")
|
||||
message (FATAL_ERROR)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,188 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
include (download/download)
|
||||
|
||||
function (resolve_archive_dependency VAR COMPONENT ARCHIVE ARCHIVE_UNIFIED ARCHIVE_WIN ARCHIVE_LIN ARCHIVE_MAC ARCHIVE_ANDROID TARGET_PATH FOLDER ENVIRONMENT SHA256 FILES_TO_EXTRACT)
|
||||
if (ENVIRONMENT AND (DEFINED ${ENVIRONMENT} OR DEFINED ENV{${ENVIRONMENT}}))
|
||||
set(HAS_ENV "TRUE")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED HAS_ENV)
|
||||
if (ARCHIVE)
|
||||
#TODO: check whether this is platform specific binary with same name per or it is in common folder
|
||||
DownloadAndExtract(${COMPONENT} ${ARCHIVE} ${TARGET_PATH} result_path ${FOLDER} ${SHA256} ${FILES_TO_EXTRACT})
|
||||
else()
|
||||
DownloadAndExtractPlatformSpecific(${COMPONENT} ${ARCHIVE_UNIFIED} ${ARCHIVE_WIN} ${ARCHIVE_LIN} ${ARCHIVE_MAC} ${ARCHIVE_ANDROID} ${TARGET_PATH} result_path ${FOLDER} ${SHA256} ${FILES_TO_EXTRACT})
|
||||
endif()
|
||||
|
||||
set (${VAR} ${result_path} PARENT_SCOPE)
|
||||
else()
|
||||
if (DEFINED ${ENVIRONMENT})
|
||||
set (${VAR} ${${ENVIRONMENT}} PARENT_SCOPE)
|
||||
else ()
|
||||
set (${VAR} $ENV{${ENVIRONMENT}} PARENT_SCOPE)
|
||||
endif ()
|
||||
endif()
|
||||
endfunction(resolve_archive_dependency)
|
||||
|
||||
function(extract_version_from_filename filename regex version)
|
||||
string(REGEX MATCH ${regex} match ${filename})
|
||||
|
||||
if (CMAKE_MATCH_1)
|
||||
set(${version} ${CMAKE_MATCH_1} PARENT_SCOPE)
|
||||
else()
|
||||
set(${version} ${filename} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(extract_version_from_filename)
|
||||
|
||||
function(read_version archive regex version_var)
|
||||
extract_version_from_filename(${archive} ${regex} version)
|
||||
set(${version_var} "${version}" CACHE INTERNAL "" FORCE)
|
||||
debug_message(STATUS "${version_var} = " ${version})
|
||||
endfunction(read_version)
|
||||
|
||||
function (RESOLVE_DEPENDENCY NAME_OF_CMAKE_VAR)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
set(SUPPORTED_ARGS FOLDER ARCHIVE ARCHIVE_UNIFIED ARCHIVE_WIN ARCHIVE_LIN ARCHIVE_MAC ARCHIVE_ANDROID TARGET_PATH ENVIRONMENT VERSION_REGEX SHA256 FILES_TO_EXTRACT)
|
||||
|
||||
#unnecessary vars
|
||||
foreach(arg ${ARGV})
|
||||
#message("one_arg=" ${one_arg})
|
||||
#message("arg=" ${arg})
|
||||
#parse no arg vars
|
||||
if (";${SUPPORTED_ARGS};" MATCHES ";${arg};")
|
||||
if(DEFINED one_arg)
|
||||
set(${one_arg} TRUE)
|
||||
endif()
|
||||
set (one_arg ${arg})
|
||||
elseif(DEFINED one_arg)
|
||||
set(${one_arg} ${arg})
|
||||
unset(one_arg)
|
||||
else()
|
||||
message(FATAL_ERROR "invalid argument passed to resolve dependency: " ${arg})
|
||||
endif()
|
||||
endforeach(arg)
|
||||
|
||||
#if last token was bool
|
||||
if(DEFINED one_arg)
|
||||
set(${one_arg} TRUE)
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT DEFINED ARCHIVE)
|
||||
SET(ARCHIVE "OFF")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ARCHIVE_UNIFIED)
|
||||
SET(ARCHIVE_UNIFIED "OFF")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ARCHIVE_WIN)
|
||||
SET(ARCHIVE_WIN "OFF")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ARCHIVE_LIN)
|
||||
SET(ARCHIVE_LIN "OFF")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ARCHIVE_MAC)
|
||||
SET(ARCHIVE_MAC "OFF")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ARCHIVE_ANDROID)
|
||||
SET(ARCHIVE_ANDROID "OFF")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ENVIRONMENT)
|
||||
set (ENVIRONMENT "OFF")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED FOLDER)
|
||||
set (FOLDER FALSE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED SHA256)
|
||||
message(FATAL_ERROR "SHA is not specified for: " ${NAME_OF_CMAKE_VAR})
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED FILES_TO_EXTRACT)
|
||||
set (FILES_TO_EXTRACT FALSE)
|
||||
endif()
|
||||
|
||||
#for each dependency type have to do separate things
|
||||
if (ARCHIVE_WIN OR ARCHIVE_LIN OR ARCHIVE_MAC OR ARCHIVE_ANDROID OR ARCHIVE OR ARCHIVE_UNIFIED)
|
||||
if (NOT DEFINED TARGET_PATH)
|
||||
message(FATAL_ERROR "TARGET_PATH should be defined for every dependency")
|
||||
endif()
|
||||
|
||||
resolve_archive_dependency(RESULT ${NAME_OF_CMAKE_VAR} ${ARCHIVE} ${ARCHIVE_UNIFIED} ${ARCHIVE_WIN} ${ARCHIVE_LIN} ${ARCHIVE_MAC} ${ARCHIVE_ANDROID} ${TARGET_PATH} ${FOLDER} ${ENVIRONMENT} ${SHA256} ${FILES_TO_EXTRACT})
|
||||
set(${NAME_OF_CMAKE_VAR} ${RESULT} PARENT_SCOPE)
|
||||
if (VERSION_REGEX)
|
||||
GetNameAndUrlToDownload(archive RELATIVE_URL ${ARCHIVE_UNIFIED} ${ARCHIVE_WIN} ${ARCHIVE_LIN} ${ARCHIVE_MAC} ${ARCHIVE_ANDROID})
|
||||
if (archive)
|
||||
read_version(${archive} ${VERSION_REGEX} "${NAME_OF_CMAKE_VAR}_VERSION")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Dependency of unknowntype, SHOULD set one of ARCHIVE_WIN, ARCHIVE, ARCHIVE_LIN, ARCHIVE_MAC, ARCHIVE_ANDROID")
|
||||
endif()
|
||||
|
||||
endfunction(RESOLVE_DEPENDENCY)
|
||||
|
||||
function (resolve_model_dependency network archive network_model_path)
|
||||
RESOLVE_DEPENDENCY(${network_model_path}
|
||||
ARCHIVE "models_archives/${archive}"
|
||||
TARGET_PATH "${MODELS_PATH}/${network}")
|
||||
string (REPLACE ${MODELS_PATH} "" relative_path ${${network_model_path}})
|
||||
set(${network_model_path} ".${relative_path}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(reset_deps_cache)
|
||||
#
|
||||
# Reset the dependencies cache if it was set by dependency solver
|
||||
#
|
||||
set(need_reset FALSE)
|
||||
|
||||
foreach(var_name IN LISTS ARGN)
|
||||
if(DEFINED ${var_name})
|
||||
if(${var_name} MATCHES ${TEMP})
|
||||
set(need_reset TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(var_name IN LISTS ARGN)
|
||||
if(DEFINED ENV{${var_name}})
|
||||
if($ENV{${var_name}} MATCHES ${TEMP})
|
||||
set(need_reset TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(need_reset)
|
||||
foreach(var_name IN LISTS ARGN)
|
||||
unset(${var_name} CACHE)
|
||||
endforeach()
|
||||
foreach(var_name IN LISTS ARGN)
|
||||
unset(ENV{${var_name}})
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(update_deps_cache VAR_NAME INTERNAL_VALUE DOC_MSG)
|
||||
#
|
||||
# Update the variable value if it wasn't provided by the user
|
||||
#
|
||||
|
||||
if(NOT DEFINED ${VAR_NAME} AND NOT DEFINED ENV{${VAR_NAME}})
|
||||
# User didn't provide its own value, use INTERNAL_VALUE
|
||||
set(${VAR_NAME} ${INTERNAL_VALUE} CACHE PATH ${DOC_MSG})
|
||||
else()
|
||||
# The variable was provided by the user, don't use INTERNAL_VALUE
|
||||
if(NOT DEFINED ${VAR_NAME} AND DEFINED ENV{${VAR_NAME}})
|
||||
# User provided the variable via environment, convert it to the CACHE variable
|
||||
set(${VAR_NAME} $ENV{${VAR_NAME}} CACHE PATH ${DOC_MSG})
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,25 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
function (Download from to fatal result output sha256)
|
||||
|
||||
if((NOT EXISTS "${to}"))
|
||||
message(STATUS "Downloading from ${from} to ${to} ...")
|
||||
file(DOWNLOAD ${from} ${to}
|
||||
TIMEOUT 3600
|
||||
LOG log
|
||||
STATUS status
|
||||
SHOW_PROGRESS
|
||||
EXPECTED_HASH SHA256=${sha256})
|
||||
|
||||
set (${output} ${status} PARENT_SCOPE)
|
||||
else()
|
||||
set (${output} 0 PARENT_SCOPE)
|
||||
endif()
|
||||
set(${result} "ON" PARENT_SCOPE)
|
||||
|
||||
endfunction(Download)
|
||||
|
||||
include(download/download_and_apply)
|
||||
include(download/download_and_extract)
|
||||
@@ -1,72 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
find_package(Wget QUIET)
|
||||
|
||||
function (DownloadAndCheck from to fatal result sha256)
|
||||
set(status_res "ON")
|
||||
set(output 1)
|
||||
|
||||
get_filename_component(download_dir ${to} DIRECTORY)
|
||||
if (NOT EXISTS ${download_dir})
|
||||
file(MAKE_DIRECTORY ${download_dir})
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${to}")
|
||||
if (${from} MATCHES "(http:)|(https:)|(ftp:)")
|
||||
message(STATUS "Downloading from ${from} to ${to} ...")
|
||||
find_program(aria2c "aria2c")
|
||||
if (${aria2c} STREQUAL "aria2c-NOTFOUND")
|
||||
if (NOT WGET_FOUND)
|
||||
Download(${from} ${to} ${fatal} ${result} output ${sha256})
|
||||
list(GET output 0 status_code)
|
||||
else()
|
||||
foreach(index RANGE 5)
|
||||
message(STATUS "${WGET_EXECUTABLE} --no-cache --no-check-certificate
|
||||
--retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries=5 ${from}")
|
||||
execute_process(COMMAND ${WGET_EXECUTABLE} "--no-cache" "--no-check-certificate"
|
||||
"--retry-connrefused" "--waitretry=1" "--read-timeout=20" "--timeout=15" "--tries=5"
|
||||
"${from}" "-O" "${to}"
|
||||
TIMEOUT 2000
|
||||
RESULT_VARIABLE status_code)
|
||||
file(SHA256 ${to} CHECKSUM)
|
||||
if (${CHECKSUM} STREQUAL ${sha256})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT ${CHECKSUM} STREQUAL ${sha256})
|
||||
message(FATAL_ERROR "Hash mismatch:\n"
|
||||
"expected: ${sha256}\n"
|
||||
"got: ${CHECKSUM}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "${aria2c} ,*.*.*.* -d ${download_dir} ${from}")
|
||||
execute_process(COMMAND "${aria2c}" "-s10" "-x10" "--dir=${download_dir}" "${from}"
|
||||
TIMEOUT 2000
|
||||
RESULT_VARIABLE status_code)
|
||||
endif()
|
||||
|
||||
if(NOT status_code EQUAL 0)
|
||||
if (fatal)
|
||||
message(FATAL_ERROR "fatal error: downloading '${from}' failed
|
||||
status_code: ${status_code}
|
||||
status_string: ${status_string}
|
||||
log: ${log}")
|
||||
else()
|
||||
set(status_res "ARCHIVE_DOWNLOAD_FAIL")
|
||||
message("error: downloading '${from}' failed
|
||||
status_code: ${status_code}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Copying from local folder ${from} to ${to} ... ")
|
||||
file(COPY ${from} DESTINATION ${download_dir})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(REMOVE ${to}.md5)
|
||||
set(${result} "${status_res}" PARENT_SCOPE)
|
||||
|
||||
endfunction(DownloadAndCheck)
|
||||
@@ -1,222 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
include(download/extract)
|
||||
include(download/download_and_check)
|
||||
|
||||
function (GetNameAndUrlToDownload name url archive_name_unified archive_name_win archive_name_lin archive_name_mac archive_name_android)
|
||||
if (archive_name_unified)
|
||||
set (${url} "thirdparty/unified/${archive_name_unified}" PARENT_SCOPE)
|
||||
set (${name} ${archive_name_unified} PARENT_SCOPE)
|
||||
else()
|
||||
if(archive_name_lin)
|
||||
set (PLATFORM_FOLDER linux)
|
||||
set (archive_name ${archive_name_lin})
|
||||
elseif(archive_name_mac)
|
||||
set (PLATFORM_FOLDER mac)
|
||||
set (archive_name ${archive_name_mac})
|
||||
elseif(archive_name_android)
|
||||
set (PLATFORM_FOLDER android)
|
||||
set (archive_name ${archive_name_android})
|
||||
elseif(archive_name_win)
|
||||
set (PLATFORM_FOLDER windows)
|
||||
set (archive_name ${archive_name_win})
|
||||
else()
|
||||
return()
|
||||
endif()
|
||||
|
||||
set (${name} ${archive_name} PARENT_SCOPE)
|
||||
set (${url} "thirdparty/${PLATFORM_FOLDER}/${archive_name}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(GetNameAndUrlToDownload)
|
||||
|
||||
#download from paltform specific folder from share server
|
||||
function (DownloadAndExtractPlatformSpecific
|
||||
component
|
||||
archive_name_unified
|
||||
archive_name_win
|
||||
archive_name_lin
|
||||
archive_name_mac
|
||||
archive_name_android
|
||||
unpacked_path
|
||||
result_path
|
||||
folder
|
||||
sha256
|
||||
files_to_extract)
|
||||
|
||||
GetNameAndUrlToDownload(archive_name RELATIVE_URL ${archive_name_unified} ${archive_name_win} ${archive_name_lin} ${archive_name_mac} ${archive_name_android} )
|
||||
if (NOT archive_name OR NOT RELATIVE_URL)
|
||||
return()
|
||||
endif()
|
||||
CheckOrDownloadAndExtract(${component} ${RELATIVE_URL} ${archive_name} ${unpacked_path} result_path2 ${folder} TRUE FALSE TRUE ${sha256} ${files_to_extract})
|
||||
set (${result_path} ${result_path2} PARENT_SCOPE)
|
||||
|
||||
endfunction(DownloadAndExtractPlatformSpecific)
|
||||
|
||||
#download from common folder
|
||||
function (DownloadAndExtract component archive_name unpacked_path result_path folder sha256 files_to_extract)
|
||||
set (RELATIVE_URL "${archive_name}")
|
||||
set(fattal TRUE)
|
||||
CheckOrDownloadAndExtract(${component} ${RELATIVE_URL} ${archive_name} ${unpacked_path} result_path2 ${folder} ${fattal} result TRUE ${sha256} ${files_to_extract})
|
||||
|
||||
if (NOT ${result})
|
||||
DownloadAndExtractPlatformSpecific(${component} ${archive_name} ${archive_name} ${archive_name} ${unpacked_path} ${result_path2} ${folder} ${sha256} ${files_to_extract})
|
||||
endif()
|
||||
|
||||
set (${result_path} ${result_path2} PARENT_SCOPE)
|
||||
|
||||
endfunction(DownloadAndExtract)
|
||||
|
||||
|
||||
function (DownloadAndExtractInternal URL archive_path unpacked_path folder fattal resultExt sha256 files_to_extract)
|
||||
set (status "ON")
|
||||
DownloadAndCheck(${URL} ${archive_path} ${fattal} result1 ${sha256})
|
||||
if ("${result1}" STREQUAL "ARCHIVE_DOWNLOAD_FAIL")
|
||||
#check alternative url as well
|
||||
set (status "OFF")
|
||||
file(REMOVE_RECURSE "${archive_path}")
|
||||
endif()
|
||||
|
||||
if ("${result1}" STREQUAL "CHECKSUM_DOWNLOAD_FAIL" OR "${result1}" STREQUAL "HASH_MISMATCH")
|
||||
set(status FALSE)
|
||||
file(REMOVE_RECURSE "${archive_path}")
|
||||
endif()
|
||||
|
||||
if("${status}" STREQUAL "ON")
|
||||
ExtractWithVersion(${URL} ${archive_path} ${unpacked_path} ${folder} result ${files_to_extract})
|
||||
endif()
|
||||
|
||||
set (${resultExt} ${status} PARENT_SCOPE)
|
||||
|
||||
endfunction(DownloadAndExtractInternal)
|
||||
|
||||
function (ExtractWithVersion URL archive_path unpacked_path folder result files_to_extract)
|
||||
|
||||
debug_message("ExtractWithVersion : ${archive_path} : ${unpacked_path} : ${folder} : ${files_to_extract}")
|
||||
extract(${archive_path} ${unpacked_path} ${folder} ${files_to_extract} status)
|
||||
#dont need archive actually after unpacking
|
||||
file(REMOVE_RECURSE "${archive_path}")
|
||||
if (${status})
|
||||
set (version_file ${unpacked_path}/ie_dependency.info)
|
||||
file(WRITE ${version_file} ${URL})
|
||||
else()
|
||||
file(REMOVE_RECURSE "${unpacked_path}")
|
||||
message(FATAL_ERROR "Failed to extract the archive from ${URL}, archive ${archive_path} to folder ${unpacked_path}")
|
||||
endif()
|
||||
set (${result} ${status} PARENT_SCOPE)
|
||||
endfunction (ExtractWithVersion)
|
||||
|
||||
function (DownloadOrExtractInternal URL archive_path unpacked_path folder fattal resultExt sha256 files_to_extract)
|
||||
debug_message("checking wether archive downloaded : ${archive_path}")
|
||||
set (downloadStatus "NOTOK")
|
||||
if (NOT EXISTS ${archive_path})
|
||||
DownloadAndExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} result ${sha256} ${files_to_extract})
|
||||
if (${result})
|
||||
set (downloadStatus "OK")
|
||||
endif()
|
||||
else()
|
||||
|
||||
if (ENABLE_UNSAFE_LOCATIONS)
|
||||
ExtractWithVersion(${URL} ${archive_path} ${unpacked_path} ${folder} result ${files_to_extract})
|
||||
if(NOT ${result})
|
||||
DownloadAndExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} result ${sha256} ${files_to_extract})
|
||||
if (${result})
|
||||
set (downloadStatus "OK")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
debug_message("archive found on FS : ${archive_path}, however we cannot check it's checksum and think that it is invalid")
|
||||
file(REMOVE_RECURSE "${archive_path}")
|
||||
DownloadAndExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} result ${sha256} ${files_to_extract})
|
||||
if (${result})
|
||||
set (downloadStatus "OK")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if (NOT ${downloadStatus} STREQUAL "OK")
|
||||
message(FATAL_ERROR "Failed to download and extract the archive from ${URL}, archive ${archive_path} to folder ${unpacked_path}")
|
||||
endif()
|
||||
|
||||
if (NOT ${result})
|
||||
message(FATAL_ERROR "error: extract of '${archive_path}' failed")
|
||||
endif()
|
||||
|
||||
endfunction(DownloadOrExtractInternal)
|
||||
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/dependencies_64.txt)
|
||||
|
||||
function (CheckOrDownloadAndExtract component RELATIVE_URL archive_name unpacked_path result_path folder fattal resultExt use_alternatives sha256 files_to_extract)
|
||||
set (archive_path ${TEMP}/download/${archive_name})
|
||||
set (status "ON")
|
||||
|
||||
if(DEFINED IE_PATH_TO_DEPS)
|
||||
set(URL "${IE_PATH_TO_DEPS}/${RELATIVE_URL}")
|
||||
elseif(DEFINED ENV{IE_PATH_TO_DEPS})
|
||||
set(URL "$ENV{IE_PATH_TO_DEPS}/${RELATIVE_URL}")
|
||||
else()
|
||||
set(URL "https://download.01.org/opencv/master/openvinotoolkit/${RELATIVE_URL}")
|
||||
endif()
|
||||
|
||||
#no message on recursive calls
|
||||
if (${use_alternatives})
|
||||
set(DEP_INFO "${component}=${URL}")
|
||||
debug_message (STATUS "DEPENDENCY_URL: ${DEP_INFO}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/dependencies_64.txt "${DEP_INFO}\n")
|
||||
endif()
|
||||
|
||||
debug_message ("checking that unpacked directory exist: ${unpacked_path}")
|
||||
|
||||
if (NOT EXISTS ${unpacked_path})
|
||||
DownloadOrExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} status ${sha256} ${files_to_extract})
|
||||
else(NOT EXISTS ${unpacked_path})
|
||||
#path exists, so we would like to check what was unpacked version
|
||||
set (version_file ${unpacked_path}/ie_dependency.info)
|
||||
|
||||
if (NOT EXISTS ${version_file})
|
||||
clean_message(FATAL_ERROR "error: Dependency doesn't contain version file. Please select actions: \n"
|
||||
"if you are not sure about your FS dependency - remove it : \n"
|
||||
"\trm -rf ${unpacked_path}\n"
|
||||
"and rerun cmake.\n"
|
||||
"If your dependency is fine, then execute:\n\techo ${URL} > ${unpacked_path}/ie_dependency.info\n")
|
||||
# file(REMOVE_RECURSE "${unpacked_path}")
|
||||
# DownloadOrExtractInternal(${URL} ${archive_path} ${unpacked_path} ${fattal} status)
|
||||
else()
|
||||
if (EXISTS ${version_file})
|
||||
file(READ "${version_file}" dependency_url)
|
||||
string(REGEX REPLACE "\n" ";" dependency_url "${dependency_url}")
|
||||
#we have decided to stick each dependency to unique url that will be that record in version file
|
||||
debug_message("dependency_info on FS : \"${dependency_url}\"\n"
|
||||
"compare to : \"${URL}\"" )
|
||||
else ()
|
||||
debug_message("no version file available at ${version_file}")
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${version_file} OR NOT ${dependency_url} STREQUAL ${URL})
|
||||
if (${use_alternatives} AND ALTERNATIVE_PATH)
|
||||
#creating alternative_path
|
||||
string(REPLACE ${TEMP} ${ALTERNATIVE_PATH} unpacked_path ${unpacked_path})
|
||||
string(REPLACE ${TEMP} ${ALTERNATIVE_PATH} archive_path ${archive_path})
|
||||
|
||||
debug_message("dependency different: use local path for fetching updated version: ${alternative_path}")
|
||||
CheckOrDownloadAndExtract(${component} ${RELATIVE_URL} ${archive_name} ${unpacked_path} ${result_path} ${folder} ${fattal} ${resultExt} FALSE ${sha256} ${files_to_extract})
|
||||
|
||||
else()
|
||||
debug_message("dependency updated: download it again")
|
||||
file(REMOVE_RECURSE "${unpacked_path}")
|
||||
DownloadOrExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} status ${sha256} ${files_to_extract})
|
||||
endif()
|
||||
endif ()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (${use_alternatives})
|
||||
set (${resultExt} "${status}" PARENT_SCOPE)
|
||||
set (${result_path} ${unpacked_path} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
endfunction(CheckOrDownloadAndExtract)
|
||||
@@ -1,47 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
function (extract archive_path unpacked_path folder files_to_extract result)
|
||||
# Slurped from a generated extract-TARGET.cmake file.
|
||||
get_filename_component(unpacked_dir ${unpacked_path} DIRECTORY)
|
||||
|
||||
file(MAKE_DIRECTORY ${unpacked_path})
|
||||
|
||||
message(STATUS "extracting...
|
||||
src='${archive_path}'
|
||||
dst='${unpacked_path}'")
|
||||
|
||||
if(NOT EXISTS "${archive_path}")
|
||||
message(FATAL_ERROR "error: file to extract does not exist: '${archive_path}'")
|
||||
endif()
|
||||
|
||||
# Extract it:
|
||||
#
|
||||
# in case of archive dont have top level folder lets create it
|
||||
if (${folder})
|
||||
set (unpacked_dir ${unpacked_path})
|
||||
message("unpacked_dir= ${unpacked_dir}")
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE ";" " " list_files_to_extract "${${files_to_extract}}")
|
||||
message(STATUS "extracting... [tar xfz] ${list_files_to_extract}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz ${archive_path} ${${files_to_extract}}
|
||||
WORKING_DIRECTORY ${unpacked_dir}
|
||||
RESULT_VARIABLE rv
|
||||
ERROR_VARIABLE err)
|
||||
|
||||
if (NOT (rv EQUAL 0))
|
||||
message(STATUS "error: extract of '${archive_path}' failed: ${err}")
|
||||
#invalid archive
|
||||
file(REMOVE_RECURSE "${unpacked_path}")
|
||||
file(REMOVE_RECURSE "${archive_path}")
|
||||
set(${result} 0 PARENT_SCOPE)
|
||||
else()
|
||||
if (NOT (err STREQUAL ""))
|
||||
message(STATUS "${err}")
|
||||
endif()
|
||||
set(${result} 1 PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
endfunction (extract)
|
||||
@@ -1,26 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
function(ie_faster_build TARGET_NAME)
|
||||
if(NOT ENABLE_FASTER_BUILD)
|
||||
return()
|
||||
endif()
|
||||
|
||||
cmake_parse_arguments(IE_FASTER_BUILD "UNITY" "" "PCH" ${ARGN})
|
||||
|
||||
if(IE_FASTER_BUILD_UNITY)
|
||||
set_target_properties(${TARGET_NAME}
|
||||
PROPERTIES
|
||||
UNITY_BUILD ON
|
||||
)
|
||||
endif()
|
||||
|
||||
if(IE_FASTER_BUILD_PCH)
|
||||
target_precompile_headers(${TARGET_NAME}
|
||||
${IE_FASTER_BUILD_PCH}
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,84 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
include(options)
|
||||
include(target_flags)
|
||||
|
||||
# FIXME: there are compiler failures with LTO and Cross-Compile toolchains. Disabling for now, but
|
||||
# this must be addressed in a proper way
|
||||
ie_dependent_option (ENABLE_LTO "Enable Link Time Optimization" OFF "LINUX;NOT CMAKE_CROSSCOMPILING; CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9" OFF)
|
||||
|
||||
ie_option (OS_FOLDER "create OS dedicated folder in output" OFF)
|
||||
|
||||
if(OV_GENERATOR_MULTI_CONFIG)
|
||||
ie_option(USE_BUILD_TYPE_SUBFOLDER "Create dedicated sub-folder per build type for output binaries" OFF)
|
||||
else()
|
||||
ie_option(USE_BUILD_TYPE_SUBFOLDER "Create dedicated sub-folder per build type for output binaries" ON)
|
||||
endif()
|
||||
|
||||
# FIXME: ARM cross-compiler generates several "false positive" warnings regarding __builtin_memcpy buffer overflow
|
||||
ie_dependent_option (TREAT_WARNING_AS_ERROR "Treat build warnings as errors" ON "X86 OR X86_64" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_INTEGRITYCHECK "build DLLs with /INTEGRITYCHECK flag" OFF "CMAKE_CXX_COMPILER_ID STREQUAL MSVC" OFF)
|
||||
|
||||
ie_option (ENABLE_SANITIZER "enable checking memory errors via AddressSanitizer" OFF)
|
||||
|
||||
ie_option (ENABLE_UB_SANITIZER "enable UndefinedBahavior sanitizer" OFF)
|
||||
|
||||
ie_option (ENABLE_THREAD_SANITIZER "enable checking data races via ThreadSanitizer" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_COVERAGE "enable code coverage" OFF "CMAKE_CXX_COMPILER_ID STREQUAL GNU" OFF)
|
||||
|
||||
# Defines CPU capabilities
|
||||
|
||||
ie_dependent_option (ENABLE_SSE42 "Enable SSE4.2 optimizations" ON "X86_64 OR X86" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_AVX2 "Enable AVX2 optimizations" ON "X86_64 OR X86" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_AVX512F "Enable AVX512 optimizations" ON "X86_64 OR X86" OFF)
|
||||
|
||||
# Type of build, we add this as an explicit option to default it to ON
|
||||
# FIXME: Ah this moment setting this to OFF will only build ngraph a static library
|
||||
ie_option (BUILD_SHARED_LIBS "Build as a shared library" ON)
|
||||
|
||||
ie_dependent_option (ENABLE_FASTER_BUILD "Enable build features (PCH, UNITY) to speed up build time" OFF "CMAKE_VERSION VERSION_GREATER_EQUAL 3.16" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_CPPLINT "Enable cpplint checks during the build" ON "UNIX;NOT ANDROID" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_CPPLINT_REPORT "Build cpplint report instead of failing the build" OFF "ENABLE_CPPLINT" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ON "UNIX;NOT ANDROID" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_NCC_STYLE "Enable ncc style check" ON "UNIX;NOT ANDROID" OFF)
|
||||
|
||||
ie_option (VERBOSE_BUILD "shows extra information about build" OFF)
|
||||
|
||||
ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "OV_COMPILER_IS_CLANG; NOT WIN32" OFF)
|
||||
|
||||
#
|
||||
# Check features
|
||||
#
|
||||
|
||||
if(ENABLE_AVX512F)
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") AND (MSVC_VERSION VERSION_LESS 1920))
|
||||
# 1920 version of MSVC 2019. In MSVC 2017 AVX512F not work
|
||||
set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6))
|
||||
set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10))
|
||||
# TBD: clarify which AppleClang version supports avx512
|
||||
set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9))
|
||||
set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (VERBOSE_BUILD)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
@@ -1,34 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
foreach(var OV_FRONTENDS_HPP_HEADER_IN OV_FRONTENDS_HPP_HEADER FRONTEND_NAMES)
|
||||
if(NOT DEFINED ${var})
|
||||
message(FATAL_ERROR "${var} is required, but not defined")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# configure variables
|
||||
|
||||
set(OV_FRONTEND_DECLARATIONS "")
|
||||
set(OV_FRONTEND_MAP_DEFINITION " FrontendsStaticRegistry registry = {")
|
||||
|
||||
foreach(frontend IN LISTS FRONTEND_NAMES)
|
||||
# common
|
||||
set(_OV_FRONTEND_DATA_FUNC "GetFrontEndData${frontend}")
|
||||
set(_OV_VERSION_FUNC "GetAPIVersion${frontend}")
|
||||
|
||||
# declarations
|
||||
set(OV_FRONTEND_DECLARATIONS "${OV_FRONTEND_DECLARATIONS}
|
||||
ov::frontend::FrontEndVersion ${_OV_VERSION_FUNC}();
|
||||
void* ${_OV_FRONTEND_DATA_FUNC}();")
|
||||
|
||||
set(OV_FRONTEND_MAP_DEFINITION "${OV_FRONTEND_MAP_DEFINITION}
|
||||
{ Value { ${_OV_FRONTEND_DATA_FUNC}, ${_OV_VERSION_FUNC} } },")
|
||||
endforeach()
|
||||
|
||||
set(OV_FRONTEND_MAP_DEFINITION "${OV_FRONTEND_MAP_DEFINITION}
|
||||
};
|
||||
return registry;")
|
||||
|
||||
configure_file("${OV_FRONTENDS_HPP_HEADER_IN}" "${OV_FRONTENDS_HPP_HEADER}" @ONLY)
|
||||
@@ -1,242 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(FRONTEND_INSTALL_INCLUDE "runtime/include/")
|
||||
set(FRONTEND_NAME_PREFIX "ov_")
|
||||
set(FRONTEND_NAME_SUFFIX "_frontend")
|
||||
|
||||
set(FRONTEND_NAMES "" CACHE INTERNAL "")
|
||||
|
||||
if(NOT TARGET ov_frontends)
|
||||
add_custom_target(ov_frontends)
|
||||
endif()
|
||||
|
||||
#
|
||||
# ov_target_link_frontends(<TARGET_NAME>)
|
||||
#
|
||||
function(ov_target_link_frontends TARGET_NAME)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
foreach(name IN LISTS FRONTEND_NAMES)
|
||||
set(frontend_target_name "${FRONTEND_NAME_PREFIX}${name}${FRONTEND_NAME_SUFFIX}")
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${frontend_target_name})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# ov_generate_frontends_hpp()
|
||||
#
|
||||
function(ov_generate_frontends_hpp)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# add frontends to libraries including ov_frontends.hpp
|
||||
ov_target_link_frontends(ov_runtime)
|
||||
|
||||
set(ov_frontends_hpp "${CMAKE_BINARY_DIR}/src/frontends/common/src/ov_frontends.hpp")
|
||||
set(frontends_hpp_in "${IEDevScripts_DIR}/frontends/ov_frontends.hpp.in")
|
||||
|
||||
add_custom_command(OUTPUT "${ov_frontends_hpp}"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
-D "OV_FRONTENDS_HPP_HEADER_IN=${frontends_hpp_in}"
|
||||
-D "OV_FRONTENDS_HPP_HEADER=${ov_frontends_hpp}"
|
||||
-D "FRONTEND_NAMES=${FRONTEND_NAMES}"
|
||||
-P "${IEDevScripts_DIR}/frontends/create_frontends_hpp.cmake"
|
||||
DEPENDS
|
||||
"${frontends_hpp_in}"
|
||||
"${IEDevScripts_DIR}/frontends/create_frontends_hpp.cmake"
|
||||
COMMENT
|
||||
"Generate ov_frontends.hpp for static build"
|
||||
VERBATIM)
|
||||
|
||||
# for some reason dependency on source files does not work
|
||||
# so, we have to use explicit target and make it dependency for frontend_common
|
||||
add_custom_target(_ov_frontends_hpp DEPENDS ${ov_frontends_hpp})
|
||||
add_dependencies(frontend_common _ov_frontends_hpp)
|
||||
|
||||
# add dependency for object files
|
||||
get_target_property(sources frontend_common_obj SOURCES)
|
||||
foreach(source IN LISTS sources)
|
||||
if("${source}" MATCHES "\\$\\<TARGET_OBJECTS\\:([A-Za-z0-9_]*)\\>")
|
||||
# object library
|
||||
set(obj_library ${CMAKE_MATCH_1})
|
||||
get_target_property(obj_sources ${obj_library} SOURCES)
|
||||
list(APPEND all_sources ${obj_sources})
|
||||
else()
|
||||
# usual source
|
||||
list(APPEND all_sources ${source})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# add dependency on header file generation for all inference_engine source files
|
||||
set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ov_frontends_hpp})
|
||||
endfunction()
|
||||
|
||||
unset(protobuf_lite_installed CACHE)
|
||||
unset(protobuf_installed CACHE)
|
||||
|
||||
#
|
||||
# ov_add_frontend(NAME <IR|ONNX|...>
|
||||
# FILEDESCRIPTION <description>
|
||||
# [LINKABLE_FRONTEND]
|
||||
# [SKIP_INSTALL]
|
||||
# [PROTOBUF_LITE]
|
||||
# [LINK_LIBRARIES <lib1 lib2 ...>])
|
||||
#
|
||||
macro(ov_add_frontend)
|
||||
set(options LINKABLE_FRONTEND PROTOBUF_LITE SKIP_NCC_STYLE SKIP_INSTALL)
|
||||
set(oneValueArgs NAME FILEDESCRIPTION)
|
||||
set(multiValueArgs LINK_LIBRARIES PROTO_FILES)
|
||||
cmake_parse_arguments(OV_FRONTEND "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(prop NAME FILEDESCRIPTION)
|
||||
if(NOT DEFINED OV_FRONTEND_${prop})
|
||||
message(FATAL_ERROR "Frontend ${prop} property is not defined")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(TARGET_NAME "${FRONTEND_NAME_PREFIX}${OV_FRONTEND_NAME}${FRONTEND_NAME_SUFFIX}")
|
||||
|
||||
list(APPEND FRONTEND_NAMES ${OV_FRONTEND_NAME})
|
||||
set(FRONTEND_NAMES "${FRONTEND_NAMES}" CACHE INTERNAL "" FORCE)
|
||||
|
||||
file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
|
||||
file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
|
||||
|
||||
set(${TARGET_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
# Create named folders for the sources within the .vcproj
|
||||
# Empty name lists them directly under the .vcproj
|
||||
|
||||
source_group("src" FILES ${LIBRARY_SRC})
|
||||
source_group("include" FILES ${LIBRARY_HEADERS})
|
||||
source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS})
|
||||
|
||||
# Generate protobuf file on build time for each '.proto' file in src/proto
|
||||
file(GLOB proto_files ${CMAKE_CURRENT_SOURCE_DIR}/src/proto/*.proto)
|
||||
|
||||
foreach(INFILE IN LISTS proto_files)
|
||||
get_filename_component(FILE_DIR ${INFILE} DIRECTORY)
|
||||
get_filename_component(FILE_WE ${INFILE} NAME_WE)
|
||||
set(OUTPUT_PB_SRC ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.cc)
|
||||
set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.h)
|
||||
set(GENERATED_PROTO ${INFILE})
|
||||
add_custom_command(
|
||||
OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}"
|
||||
COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${FILE_DIR} ${FILE_WE}.proto
|
||||
DEPENDS ${PROTOC_EXECUTABLE} ${GENERATED_PROTO}
|
||||
COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${GENERATED_PROTO}"
|
||||
VERBATIM
|
||||
COMMAND_EXPAND_LISTS)
|
||||
list(APPEND PROTO_SRCS "${OUTPUT_PB_SRC}")
|
||||
list(APPEND PROTO_HDRS "${OUTPUT_PB_HEADER}")
|
||||
endforeach()
|
||||
|
||||
# Disable all warnings for generated code
|
||||
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w GENERATED TRUE)
|
||||
|
||||
# Create library
|
||||
add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
|
||||
if(OV_FRONTEND_LINKABLE_FRONTEND)
|
||||
# create beautiful alias
|
||||
add_library(openvino::frontend::${OV_FRONTEND_NAME} ALIAS ${TARGET_NAME})
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
# override default function names
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE
|
||||
"-DGetFrontEndData=GetFrontEndData${OV_FRONTEND_NAME}"
|
||||
"-DGetAPIVersion=GetAPIVersion${OV_FRONTEND_NAME}")
|
||||
endif()
|
||||
|
||||
if(OV_FRONTEND_SKIP_NCC_STYLE)
|
||||
# frontend's CMakeLists.txt must define its own custom 'ov_ncc_naming_style' step
|
||||
else()
|
||||
ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
|
||||
INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
ADDITIONAL_INCLUDE_DIRECTORIES
|
||||
$<TARGET_PROPERTY:frontend_common::static,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${${TARGET_NAME}_INCLUDE_DIR}>
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
ie_add_vs_version_file(NAME ${TARGET_NAME}
|
||||
FILEDESCRIPTION ${OV_FRONTEND_FILEDESCRIPTION})
|
||||
|
||||
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime ${OV_FRONTEND_LINK_LIBRARIES})
|
||||
|
||||
# WA for TF frontends which always requires protobuf (not protobuf-lite)
|
||||
# if TF FE is built in static mode, use protobuf for all other FEs
|
||||
if(FORCE_FRONTENDS_USE_PROTOBUF)
|
||||
set(OV_FRONTEND_PROTOBUF_LITE OFF)
|
||||
endif()
|
||||
|
||||
if(proto_files)
|
||||
if(OV_FRONTEND_PROTOBUF_LITE)
|
||||
if(NOT protobuf_lite_installed)
|
||||
ov_install_static_lib(${Protobuf_LITE_LIBRARIES} core)
|
||||
set(protobuf_lite_installed ON CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES})
|
||||
else()
|
||||
if(NOT protobuf_installed)
|
||||
ov_install_static_lib(${Protobuf_LIBRARIES} core)
|
||||
set(protobuf_installed ON CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# prptobuf generated code emits -Wsuggest-override error
|
||||
if(SUGGEST_OVERRIDE_SUPPORTED)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE -Wno-suggest-override)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}
|
||||
EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
|
||||
add_dependencies(ov_frontends ${TARGET_NAME})
|
||||
|
||||
if(NOT OV_FRONTEND_SKIP_INSTALL)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(OV_FRONTEND_LINKABLE_FRONTEND)
|
||||
set(export_set EXPORT OpenVINOTargets)
|
||||
endif()
|
||||
install(TARGETS ${TARGET_NAME} ${export_set}
|
||||
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core
|
||||
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core
|
||||
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core)
|
||||
else()
|
||||
ov_install_static_lib(${TARGET_NAME} core)
|
||||
endif()
|
||||
|
||||
if(OV_FRONTEND_LINKABLE_FRONTEND)
|
||||
# install -dev part
|
||||
install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/openvino
|
||||
DESTINATION ${FRONTEND_INSTALL_INCLUDE}/
|
||||
COMPONENT core_dev
|
||||
FILES_MATCHING PATTERN "*.hpp")
|
||||
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::${OV_FRONTEND_NAME})
|
||||
export(TARGETS ${TARGET_NAME} NAMESPACE openvino::
|
||||
APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
|
||||
endif()
|
||||
else()
|
||||
# skipped frontend has to be installed in static libraries case
|
||||
ov_install_static_lib(${TARGET_NAME} core)
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -1,27 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "openvino/frontend/frontend.hpp"
|
||||
|
||||
@OV_FRONTEND_DECLARATIONS@
|
||||
|
||||
namespace {
|
||||
|
||||
using GetFrontEndDataFunc = void*();
|
||||
using GetAPIVersionFunc = ov::frontend::FrontEndVersion();
|
||||
|
||||
struct Value {
|
||||
GetFrontEndDataFunc* m_dataFunc;
|
||||
GetAPIVersionFunc* m_versionFunc;
|
||||
};
|
||||
|
||||
using FrontendsStaticRegistry = std::vector<Value>;
|
||||
|
||||
const FrontendsStaticRegistry getStaticFrontendsRegistry() {
|
||||
@OV_FRONTEND_MAP_DEFINITION@
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -1,27 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(UNIX AND ENABLE_ERROR_HIGHLIGHT)
|
||||
function(message)
|
||||
string(ASCII 27 ESC)
|
||||
set(RESET "${ESC}[m")
|
||||
set(RED "${ESC}[31;1m")
|
||||
set(YELLOW "${ESC}[33;1m")
|
||||
|
||||
list(GET ARGV 0 MessageType)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
|
||||
foreach(arg IN LISTS ARGV)
|
||||
set(_msg "${_msg}${arg}")
|
||||
endforeach()
|
||||
|
||||
if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR)
|
||||
_message(${MessageType} "${RED}${_msg}${RESET}")
|
||||
elseif(MessageType STREQUAL WARNING)
|
||||
_message(${MessageType} "${YELLOW}${_msg}${RESET}")
|
||||
else()
|
||||
_message(${MessageType} "${_msg}")
|
||||
endif()
|
||||
endfunction()
|
||||
endif()
|
||||
@@ -1,74 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
|
||||
set(MODELS_LST "")
|
||||
set(MODELS_LST_TO_FETCH "")
|
||||
|
||||
function (add_models_repo add_to_fetcher model_name)
|
||||
list(LENGTH ARGV add_models_args)
|
||||
if (add_models_args EQUAL 3)
|
||||
list(GET ARGV 2 branch_name)
|
||||
else()
|
||||
set(branch_name ${MODELS_BRANCH})
|
||||
endif()
|
||||
if (add_to_fetcher)
|
||||
set(model_name "${model_name}:${branch_name}")
|
||||
list(APPEND MODELS_LST_TO_FETCH ${model_name})
|
||||
endif()
|
||||
|
||||
list(APPEND MODELS_LST ${model_name})
|
||||
|
||||
set(MODELS_LST_TO_FETCH ${MODELS_LST_TO_FETCH} PARENT_SCOPE)
|
||||
set(MODELS_LST ${MODELS_LST} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(add_lfs_repo name prefix url tag)
|
||||
if(TARGET ${name})
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${name}
|
||||
PREFIX ${prefix}
|
||||
GIT_REPOSITORY ${url}
|
||||
GIT_TAG ${tag}
|
||||
GIT_CONFIG "http.sslverify=false"
|
||||
GIT_PROGRESS 1
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} lfs install --local --force
|
||||
WORKING_DIRECTORY ${prefix}/src/${name}
|
||||
OUTPUT_VARIABLE lfs_output
|
||||
RESULT_VARIABLE lfs_var)
|
||||
if(lfs_var)
|
||||
message(FATAL_ERROR [=[
|
||||
Failed to setup Git LFS: ${lfs_output}
|
||||
Git lfs must be installed in order to fetch models
|
||||
Please install it from https://git-lfs.github.com/
|
||||
]=])
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function (fetch_models_and_validation_set)
|
||||
foreach(loop_var ${MODELS_LST_TO_FETCH})
|
||||
string(REPLACE ":" ";" MODEL_CONFIG_LST ${loop_var})
|
||||
|
||||
list(GET MODEL_CONFIG_LST 0 folder_name)
|
||||
list(GET MODEL_CONFIG_LST 1 git_url)
|
||||
list(GET MODEL_CONFIG_LST 2 repo_name)
|
||||
list(GET MODEL_CONFIG_LST 3 branch_name)
|
||||
|
||||
add_lfs_repo(
|
||||
"${folder_name}"
|
||||
"${TEMP}/models"
|
||||
"${git_url}:${repo_name}"
|
||||
"${branch_name}")
|
||||
endforeach(loop_var)
|
||||
endfunction()
|
||||
Submodule cmake/developer_package/ncc_naming_style/ncc deleted from 63e59ed312
@@ -1,150 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(NOT COMMAND ie_check_pip_package)
|
||||
message(FATAL_ERROR "ncc_naming_style.cmake must be included after ie_check_pip_package")
|
||||
endif()
|
||||
|
||||
set(ncc_style_dir "${IEDevScripts_DIR}/ncc_naming_style")
|
||||
set(ncc_style_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/ncc_naming_style")
|
||||
|
||||
# try to find_package(Clang QUIET)
|
||||
# ClangConfig.cmake contains bug that if libclang-XX-dev is not
|
||||
# installed, then find_package fails with errors even in QUIET mode
|
||||
configure_file("${ncc_style_dir}/try_find_clang.cmake"
|
||||
"${ncc_style_bin_dir}/source/CMakeLists.txt" COPYONLY)
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" -S "${ncc_style_bin_dir}/source"
|
||||
-B "${ncc_style_bin_dir}/build"
|
||||
RESULT_VARIABLE clang_find_result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE output)
|
||||
|
||||
if(NOT clang_find_result EQUAL "0")
|
||||
message(WARNING "Please, install libclang-[N]-dev package (required for ncc naming style check)")
|
||||
set(ENABLE_NCC_STYLE OFF)
|
||||
endif()
|
||||
|
||||
# Since we were able to find_package(Clang) in a separate process
|
||||
# let's try to find in current process
|
||||
if(ENABLE_NCC_STYLE)
|
||||
find_host_package(Clang QUIET)
|
||||
if(Clang_FOUND AND TARGET libclang)
|
||||
get_target_property(libclang_location libclang LOCATION)
|
||||
message(STATUS "Found libclang: ${libclang_location}")
|
||||
else()
|
||||
message(WARNING "libclang is not found (required for ncc naming style check)")
|
||||
set(ENABLE_NCC_STYLE OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# find python3
|
||||
|
||||
find_package(PythonInterp 3 QUIET)
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
message(WARNING "Python3 interpreter was not found (required for ncc naming style check)")
|
||||
set(ENABLE_NCC_STYLE OFF)
|
||||
endif()
|
||||
|
||||
# check python requirements_dev.txt
|
||||
|
||||
set(ncc_script_py "${ncc_style_dir}/ncc/ncc.py")
|
||||
|
||||
if(NOT EXISTS ${ncc_script_py})
|
||||
message(WARNING "ncc.py is not downloaded via submodule")
|
||||
set(ENABLE_NCC_STYLE OFF)
|
||||
endif()
|
||||
|
||||
if(ENABLE_NCC_STYLE)
|
||||
set(req_file "${ncc_style_dir}/requirements_dev.txt")
|
||||
file(STRINGS ${req_file} req_lines)
|
||||
|
||||
foreach(req IN LISTS req_lines)
|
||||
ie_check_pip_package(${req} STATUS)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# create high-level target
|
||||
|
||||
if(ENABLE_NCC_STYLE AND NOT TARGET ncc_all)
|
||||
add_custom_target(ncc_all ALL)
|
||||
set_target_properties(ncc_all PROPERTIES FOLDER ncc_naming_style)
|
||||
endif()
|
||||
|
||||
#
|
||||
# ov_ncc_naming_style(FOR_TARGET target_name
|
||||
# INCLUDE_DIRECTORY dir
|
||||
# [ADDITIONAL_INCLUDE_DIRECTORIES dir1 dir2 ..]
|
||||
# [DEFINITIONS def1 def2 ..])
|
||||
#
|
||||
# FOR_TARGET - name of the target
|
||||
# INCLUDE_DIRECTORY - directory to check headers from
|
||||
# ADDITIONAL_INCLUDE_DIRECTORIES - additional include directories used in checked headers
|
||||
# DEFINITIONS - additional definitions passed to preprocessor stage
|
||||
#
|
||||
function(ov_ncc_naming_style)
|
||||
if(NOT ENABLE_NCC_STYLE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
cmake_parse_arguments(NCC_STYLE "FAIL"
|
||||
"FOR_TARGET;INCLUDE_DIRECTORY" "ADDITIONAL_INCLUDE_DIRECTORIES;DEFINITIONS" ${ARGN})
|
||||
|
||||
foreach(var FOR_TARGET INCLUDE_DIRECTORY)
|
||||
if(NOT DEFINED NCC_STYLE_${var})
|
||||
message(FATAL_ERROR "${var} is not defined in ov_ncc_naming_style function")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(GLOB_RECURSE headers
|
||||
RELATIVE "${NCC_STYLE_INCLUDE_DIRECTORY}"
|
||||
"${NCC_STYLE_INCLUDE_DIRECTORY}/*.hpp")
|
||||
|
||||
list(APPEND NCC_STYLE_ADDITIONAL_INCLUDE_DIRECTORIES "${NCC_STYLE_INCLUDE_DIRECTORY}")
|
||||
|
||||
foreach(header IN LISTS headers)
|
||||
set(output_file "${ncc_style_bin_dir}/${header}.ncc_style")
|
||||
set(full_header_path "${NCC_STYLE_INCLUDE_DIRECTORY}/${header}")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${output_file}
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
-D "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}"
|
||||
-D "NCC_PY_SCRIPT=${ncc_script_py}"
|
||||
-D "INPUT_FILE=${full_header_path}"
|
||||
-D "OUTPUT_FILE=${output_file}"
|
||||
-D "DEFINITIONS=${NCC_STYLE_DEFINITIONS}"
|
||||
-D "CLANG_LIB_PATH=${libclang_location}"
|
||||
-D "STYLE_FILE=${ncc_style_dir}/openvino.style"
|
||||
-D "ADDITIONAL_INCLUDE_DIRECTORIES=${NCC_STYLE_ADDITIONAL_INCLUDE_DIRECTORIES}"
|
||||
-D "EXPECTED_FAIL=${NCC_STYLE_FAIL}"
|
||||
-P "${ncc_style_dir}/ncc_run.cmake"
|
||||
DEPENDS
|
||||
"${full_header_path}"
|
||||
"${ncc_style_dir}/openvino.style"
|
||||
"${ncc_script_py}"
|
||||
"${ncc_style_dir}/ncc_run.cmake"
|
||||
COMMENT
|
||||
"[ncc naming style] ${header}"
|
||||
VERBATIM)
|
||||
list(APPEND output_files ${output_file})
|
||||
endforeach()
|
||||
|
||||
set(ncc_target ${NCC_STYLE_FOR_TARGET}_ncc_check)
|
||||
add_custom_target(${ncc_target}
|
||||
DEPENDS ${output_files}
|
||||
COMMENT "[ncc naming style] ${NCC_STYLE_FOR_TARGET}")
|
||||
|
||||
add_dependencies(${NCC_STYLE_FOR_TARGET} ${ncc_target})
|
||||
add_dependencies(ncc_all ${ncc_target})
|
||||
endfunction()
|
||||
|
||||
if(TARGET ncc_all)
|
||||
ov_ncc_naming_style(FOR_TARGET ncc_all
|
||||
INCLUDE_DIRECTORY "${ncc_style_dir}/self_check"
|
||||
FAIL)
|
||||
endif()
|
||||
@@ -1,45 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
foreach(var NCC_PY_SCRIPT PYTHON_EXECUTABLE OUTPUT_FILE DEFINITIONS EXPECTED_FAIL
|
||||
INPUT_FILE ADDITIONAL_INCLUDE_DIRECTORIES STYLE_FILE CLANG_LIB_PATH)
|
||||
if(NOT DEFINED ${var})
|
||||
message(FATAL_ERROR "${var} is not defined for ncc_run.cmake")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(REMOVE "${OUTPUT_FILE}")
|
||||
|
||||
if(DEFINITIONS)
|
||||
set(defs --definition ${DEFINITIONS})
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${PYTHON_EXECUTABLE}"
|
||||
"${NCC_PY_SCRIPT}"
|
||||
--path ${INPUT_FILE}
|
||||
--style ${STYLE_FILE}
|
||||
--clang-lib ${CLANG_LIB_PATH}
|
||||
${defs}
|
||||
--include ${ADDITIONAL_INCLUDE_DIRECTORIES}
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE output)
|
||||
|
||||
file(WRITE "${OUTPUT_FILE}" "${output}")
|
||||
|
||||
if(NOT result EQUAL "0")
|
||||
set(failed ON)
|
||||
endif()
|
||||
|
||||
if(EXPECTED_FAIL AND NOT failed)
|
||||
message(FATAL_ERROR "[ncc self check] Self check is not failed for ${INPUT_FILE}")
|
||||
endif()
|
||||
|
||||
if(failed AND NOT EXPECTED_FAIL)
|
||||
# Display the output to console (to parse it form IDE)
|
||||
message("${output}")
|
||||
message(FATAL_ERROR "[ncc naming style] Naming style check failed for ${INPUT_FILE}")
|
||||
endif()
|
||||
@@ -1,129 +0,0 @@
|
||||
# custom OpenVINO values
|
||||
CppMethod: '^(operator\W+|[a-z_\d]+|signaling_NaN|quiet_NaN)$'
|
||||
ClassName: '^([A-Z][\w]+|b?float16|numeric_limits|ngraph_error|stopwatch|unsupported_op)$'
|
||||
StructName: '^([A-Z][\w]+|element_type_traits|hash|oi_pair)$'
|
||||
FunctionName: '^(operator\W+|[a-z_\d]+)$'
|
||||
Namespace: '^([a-z\d_]+|InferenceEngine)$'
|
||||
NamespaceAlias: '^([a-z\d_]+|InferenceEngine)$'
|
||||
UnionName: '[A-Z][\w]+$'
|
||||
TemplateTemplateParameter: '[A-Z][\w]+'
|
||||
NamespaceReference: '^([a-z\d_]+|InferenceEngine)$'
|
||||
TemplateNonTypeParameter: '^\w*$'
|
||||
ClassTemplate: '^([A-Z][\w]+|element_type_traits)$'
|
||||
TemplateTypeParameter: '^\w*$'
|
||||
ParameterName: '^\w*$'
|
||||
FunctionTemplate: '^(operator.+|[\w]+|Impl<.*>)$'
|
||||
TypeAliasName: '^\w+$'
|
||||
VariableReference: '^\w+$'
|
||||
|
||||
EnumName: '^[A-Z][\w]+$'
|
||||
# excepts element_type
|
||||
EnumConstantName: '^([A-Z\d_]+|undefined|dynamic|boolean|bf16|f16|f32|f64|i4|i8|i16|i32|i64|u1|u4|u8|u16|u32|u64|asymmetric|align_corners|round_prefer_floor|round_prefer_ceil|floor|ceil|simple|nearest|linear|linear_onnx|cubic|area|scales|sizes|half_pixel|tf_half_pixel_for_nn|pytorch_half_pixel|asymetric)$'
|
||||
# TODO: align
|
||||
UsingDeclaration: '^.*$'
|
||||
TypedefName: '^.*$'
|
||||
CxxDynamicCastExpression: '^.*$'
|
||||
|
||||
# not needed values
|
||||
ClassTemplatePartialSpecialization: '^.*$'
|
||||
ConversionFunction: '^.*$'
|
||||
UsingDirective: 'XXXX'
|
||||
ClassAccessSpecifier: '^.*$' # looks like can be fixed
|
||||
TypeReference: '^.*$' # looks like can be fixed
|
||||
CxxBaseSpecifier: '^.*$' # looks like can be fixed
|
||||
TemplateReference: '^.*$'
|
||||
MemberReference: '^.*$'
|
||||
LabelReference: 'XXXX'
|
||||
OverloadedDeclarationReference: '^.*$'
|
||||
InvalidFile: 'XXXX'
|
||||
NoDeclarationFound: 'XXXX'
|
||||
NotImplemented: 'XXXX'
|
||||
InvalidCode: 'XXXX'
|
||||
UnexposedExpression: '^.*$'
|
||||
DeclarationReferenceExpression: '^.*$'
|
||||
MemberReferenceExpression: '^.*$'
|
||||
CallExpression: '^.*$'
|
||||
BlockExpression: 'XXXX'
|
||||
IntegerLiteral: '^.*$'
|
||||
FloatingLiteral: '^.*$'
|
||||
ImaginaryLiteral: 'XXXX'
|
||||
StringLiteral: '^.*$'
|
||||
CharacterLiteral: '^.*$'
|
||||
ParenExpression: '^.*$'
|
||||
UnaryOperator: '^.*$'
|
||||
ArraySubscriptExpression: '^.*$'
|
||||
BinaryOperator: '^.*$'
|
||||
CompoundAssignmentOperator: '^.*$'
|
||||
ConditionalOperator: '^.*$'
|
||||
CstyleCastExpression: '^.*$'
|
||||
CompoundLiteralExpression: 'XXXX'
|
||||
InitListExpression: '^.*$'
|
||||
AddrLabelExpression: 'XXXX'
|
||||
StatementExpression: 'XXXX'
|
||||
GenericSelectionExpression: 'XXXX'
|
||||
GnuNullExpression: 'XXXX'
|
||||
CxxStaticCastExpression: '^.*$'
|
||||
CxxReinterpretCastExpression: '^.*$'
|
||||
CxxConstCastExpression: '^.*$'
|
||||
CxxFunctionalCastExpression: '^.*$'
|
||||
CxxTypeidExpression: '^.*$'
|
||||
CxxBoolLiteralExpression: '^.*$'
|
||||
CxxNullPointerLiteralExpression: '^.*$'
|
||||
CxxThisExpression: '^.*$'
|
||||
CxxThrowExpression: '^.*$'
|
||||
CxxNewExpression: '^.*$'
|
||||
CxxDeleteExpression: 'XXXX'
|
||||
CxxUnaryExpression: '^.*$'
|
||||
PackExpansionExpression: '^.*$'
|
||||
SizeOfPackExpression: '^.*$'
|
||||
LambdaExpression: '^.*$'
|
||||
ObjectBoolLiteralExpression: 'XXXX'
|
||||
ObjectSelfExpression: 'XXXX'
|
||||
UnexposedStatement: 'XXXX'
|
||||
LabelStatement: 'XXXX'
|
||||
CompoundStatement: '^.*$'
|
||||
CaseStatement: '^.*$'
|
||||
DefaultStatement: '^.*$'
|
||||
IfStatement: '^.*$'
|
||||
SwitchStatement: '^.*$'
|
||||
WhileStatement: '^.*$'
|
||||
DoStatement: '^.*$'
|
||||
ForStatement: '^.*$'
|
||||
GotoStatement: 'XXXX'
|
||||
IndirectGotoStatement: 'XXXX'
|
||||
ContinueStatement: '^.*$'
|
||||
BreakStatement: '^.*$'
|
||||
ReturnStatement: '^.*$'
|
||||
AsmStatement: 'XXXX'
|
||||
CxxCatchStatement: '^.*$'
|
||||
CxxTryStatement: '^.*$'
|
||||
CxxForRangeStatement: '^.*$'
|
||||
MsAsmStatement: 'XXXX'
|
||||
NullStatement: 'XXXX'
|
||||
DeclarationStatement: '^.*$'
|
||||
TranslationUnit: 'XXXX'
|
||||
UnexposedAttribute: '^.*$'
|
||||
CxxFinalAttribute: '^.*$'
|
||||
CxxOverrideAttribute: '^.*$'
|
||||
AnnotateAttribute: 'XXXX'
|
||||
AsmLabelAttribute: 'XXXX'
|
||||
PackedAttribute: 'XXXX'
|
||||
PureAttribute: 'XXXX'
|
||||
ConstAttribute: 'XXXX'
|
||||
NoduplicateAttribute: 'XXXX'
|
||||
PreprocessingDirective: 'XXXX'
|
||||
MacroDefinition: 'XXXX'
|
||||
MacroInstantiation: 'XXXX'
|
||||
InclusionDirective: 'XXXX'
|
||||
TypeAliasTeplateDeclaration: '^.*$'
|
||||
VariableName:
|
||||
ScopePrefix:
|
||||
Global: ''
|
||||
Static: ''
|
||||
ClassMember: ''
|
||||
DataTypePrefix:
|
||||
String: ''
|
||||
Integer: ''
|
||||
Bool: ''
|
||||
Pointer: ''
|
||||
Pattern: '^.*$'
|
||||
@@ -1,2 +0,0 @@
|
||||
clang==9.0
|
||||
pyyaml
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
class name {
|
||||
public:
|
||||
name() = default;
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
void Function();
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
class name {
|
||||
public:
|
||||
name() = default;
|
||||
|
||||
void Method();
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(try_find_clang)
|
||||
|
||||
find_package(Clang QUIET)
|
||||
@@ -1,47 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# Usage: ie_option(<option_variable> "description" <initial value or boolean expression> [IF <condition>])
|
||||
|
||||
include (CMakeDependentOption)
|
||||
|
||||
macro (ie_option variable description value)
|
||||
option(${variable} "${description}" ${value})
|
||||
list(APPEND IE_OPTIONS ${variable})
|
||||
endmacro()
|
||||
|
||||
macro (ie_dependent_option variable description def_value condition fallback_value)
|
||||
cmake_dependent_option(${variable} "${description}" ${def_value} "${condition}" ${fallback_value})
|
||||
list(APPEND IE_OPTIONS ${variable})
|
||||
endmacro()
|
||||
|
||||
macro (ie_option_enum variable description value)
|
||||
set(OPTIONS)
|
||||
set(ONE_VALUE_ARGS)
|
||||
set(MULTI_VALUE_ARGS ALLOWED_VALUES)
|
||||
cmake_parse_arguments(IE_OPTION_ENUM "${OPTIONS}" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN})
|
||||
|
||||
if(NOT ${value} IN_LIST IE_OPTION_ENUM_ALLOWED_VALUES)
|
||||
message(FATAL_ERROR "variable must be one of ${IE_OPTION_ENUM_ALLOWED_VALUES}")
|
||||
endif()
|
||||
|
||||
list(APPEND IE_OPTIONS ${variable})
|
||||
|
||||
set(${variable} ${value} CACHE STRING "${description}")
|
||||
set_property(CACHE ${variable} PROPERTY STRINGS ${IE_OPTION_ENUM_ALLOWED_VALUES})
|
||||
endmacro()
|
||||
|
||||
function (print_enabled_features)
|
||||
if(NOT COMMAND set_ci_build_number)
|
||||
message(FATAL_ERROR "CI_BUILD_NUMBER is not set yet")
|
||||
endif()
|
||||
|
||||
message(STATUS "Inference Engine enabled features: ")
|
||||
message(STATUS "")
|
||||
message(STATUS " CI_BUILD_NUMBER: ${CI_BUILD_NUMBER}")
|
||||
foreach(_var ${IE_OPTIONS})
|
||||
message(STATUS " ${_var} = ${${_var}}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
endfunction()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user