Compare commits

..

367 Commits

Author SHA1 Message Date
Alexey Suhov
023e7c2c3f update system requirements (#1321)
* update system requirements

* update release version in readme
2020-07-14 20:25:39 +03:00
Alexey Suhov
34ddb70f7d fix build target name in demos for Windows (#1248) 2020-07-07 18:26:50 +03:00
Andrew Bakalin
21e092122f [VPU] WA for statis shape allocation (#1106) 2020-06-24 16:28:59 +03:00
Roman Kazantsev
92c1333653 Correct removing nodes from graph and add test for ConstToResult transform (#1083)
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-06-24 15:39:08 +03:00
Roman Kazantsev
c26ec8b312 [IE] Preserve output data name after merging and update output data map (#1092)
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-06-24 12:30:25 +03:00
Andrew Bakalin
32054ff180 [VPU] Support for originalLayersNames attribute in exec graph (#1073) 2020-06-23 12:19:15 +03:00
Ilya Churaev
7cff005ada Disable ref implementations (#951)
* Add NGRAPH_EVALUATE_ENABLE flag and disable all reference implementations

* Enable some evaluate methods

* Added dynamic library with reference implementations

* Fixed tests

* Enabled unsqueeze  CF

* Removed nGraph test library

* Disable all nGraph tests to check

* Enable some reference implementations

* Added debug message

* EVALUATE true

* Revert "Disable all nGraph tests to check"

This reverts commit 38bca3ed3dfed029e892fe609ea7e48c5cfadb67.

* Enable some implementations

* Removed some TYPE_CASE reference implementations

* Fixed reshape

* Revert types for Broadcast and Add

* Disabled failing gpu_engine.user_context test

* Disabled failed nGraph tests

* Add u8 for non_zero

* Revert "Added debug message"

This reverts commit 4b9f4894f5ae9963426830ac5e5eb833af8847aa.

* Revert "Enable some reference implementations"

This reverts commit d2001a636df7504e0ad5abe5c98725ef0be07379.

Revert "Enabled unsqueeze  CF"

This reverts commit 814a8e52cb2b673446d24e54ed11af1dd3d80fad.

Revert "Enable some evaluate methods"

This reverts commit 73767b8942d857bf60317f29120c98c528344a04.

* Revert "Add NGRAPH_EVALUATE_ENABLE flag and disable all reference implementations"

This reverts commit cfaa7d7e7bf34b617f53a556d24fea2189372592.
2020-06-23 12:17:40 +03:00
Ivan Tikhonov
06707cc53f Fix for Kaldi models with Memory layers and a batch more than 1 (#1025)
* fix kaldi models with memory (batch > 1)

* apply review comments

* Added test for the case using the SetBatchSize function when ReadValue op is in the network

* Check status code instead of message

* Use new ngraph api
2020-06-23 11:47:18 +03:00
Konrad Dobros
fff93d8f05 [IE CLDNN] Add work-around for 1d input to Gather (#1069) 2020-06-23 11:44:20 +03:00
Gladilov, Gleb
637ddd5dfb [IE][VPU]: Fixes klocwork issues (#1075) 2020-06-23 09:58:12 +03:00
Ivan Tikhonov
fa4c5e8e38 Fix ARM build: explicit type conversion (#1061)
* fix arm build: explicit type conversion

* Use explicit conversion in prior_box_ie.cpp
2020-06-22 23:37:54 +03:00
Maxim Vafin
c9fc6f0531 Fix OneHot transformation for Bert Squad opset 10 (#954)
* Add transformation for squeezing depth input for ONNX OneHot operation because from some TF models it has shape [1] instead of []
2020-06-22 18:58:07 +03:00
Denis Orlov
c9eb6ae62b [GNA] Initialize a local variable (#1066) 2020-06-22 18:49:22 +03:00
Alexander Chaiko
eef56ca80c [IE CLDNN] WA to 1d input for concat (#1040) 2020-06-22 15:25:17 +03:00
Gorokhov Dmitriy
36f1c00e02 [CPU] Fixed issue with unsupported reorder case for groupped convolutions (#893) 2020-06-22 14:06:53 +03:00
Konrad Dobros
5c43765011 [IE CLDNN] Fix activation implementation for fsv16 format (#1038)
For b_fs_yx_fsv16 format in reference kernel features for dispatch are
rounded to multiple of 16. This change adds correct check in kernel to
return work-items that are inside this dispatch padding.
Previously those work-items could corrupt memory expected to be filled
with 0s, and for parametrized activation due to bounds checking with
modulo operator they could have been corrupting actual layer output.

Issue: CVS-27672
2020-06-22 09:17:00 +03:00
Ilya Lavrenov
bbfc9bbc14 Deprecated IGNORE_IR_STATISTIC VPU option (#1028) 2020-06-20 10:38:47 +03:00
Pavel Rodionov
9c607528ef [GNA] Support export model with multiple inputs/outputs and Permute layer (#1024) 2020-06-19 18:06:38 +03:00
Denis Orlov
ae9e0510f0 [GNA] Additional checks (#998) 2020-06-19 13:14:32 +03:00
Edward Shogulin
76af547c17 [LPT] BERT with specific biases support & improvement (#968)
* [LPT] BERT with biases support

* [LPT] Gemm biases and quantization

* [CPU] Fixed FullyConnected + Depthwise node fusing

* [LPT] FullyConnected 3D: symmetric quantization support

* [LPT] FullyConnected 3D: symmetric quantization support fix

* [CPU] Fixed FullyConnected + Depthwise fusing initialization

Co-authored-by: dmitrygo <dmitry.gorokhov@intel.com>
2020-06-19 13:14:20 +03:00
Kamil Magierski
5e97a3123f Fix cases then const blob precision is not FP32/FP16 (#1000)
Co-authored-by: kmagiers <kmagiers@intel.com>
2020-06-19 13:13:19 +03:00
Andrey Dmitriev
532dec140b [GNA] fix permute 0_2_1 (#993) 2020-06-19 10:20:55 +03:00
Vladimir Paramuzov
c41c6294f9 [IE CLDNN] Fix strided slice (#953) 2020-06-19 08:23:25 +03:00
Gorokhov Dmitriy
3bbe88e659 [IE Common][WA] Skipped const folding for Convolution layer (#1002) 2020-06-19 01:25:20 +03:00
Maxim Andronov
2f3d5f68cd [CPU] fix one dims scale shift (#983) 2020-06-18 14:21:07 +03:00
Evgeny Talanin
843f81a1cc [IE TESTS] disable Some myriad tests on Win (#763) (#988)
* [IE TESTS] disable Some myriad tests on Windisable Some myriad tests on Win

* Skip test with todo

Co-authored-by: Irina Efode <irina.efode@intel.com>
2020-06-18 13:57:21 +03:00
Pavel Esir
c596707a09 fixed some typos in MO help (#979) 2020-06-18 11:02:28 +03:00
Konrad Dobros
cf60baf2f0 [IE CLDNN] Fix gather dimensions calculation (#960) 2020-06-18 00:31:17 +03:00
Nikita Kudriavtsev
aeb70036d7 [IE Myriad] Remove Myriad 2 from supported devices in XLink (#978) 2020-06-17 17:47:55 +03:00
Daria Mityagina
dea04dae8c [IE Myriad] - WrapInLoop fix: if data has consumer's input inside subgraph - replace them (#958) 2020-06-17 17:27:17 +03:00
Ilya Churaev
14b44803ba Fixed cpack information, removed some links (#975) 2020-06-17 17:17:10 +03:00
Andrey Dmitriev
06286f2aae [GNA] Added fix multiple output with one go to memory and test (#888)
[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

Added multi output

Update gna_pass_manager.cpp

test

[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

Added multi output

Update gna_pass_manager.cpp

test

tests

[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

Added multi output

Update gna_pass_manager.cpp

test

tests

Added pass

Test

test

tests_2

return old
2020-06-17 11:23:56 +03:00
Ilya Churaev
97e5fc4bae Use creators only for default opsets (#932) 2020-06-16 12:25:06 +03:00
Alexey Tarakanov
47218284b2 Support fp16 networks for releases_2020_4 (#936) 2020-06-16 10:31:57 +03:00
Andrey Dmitriev
6079a35b81 [GNA] Added test for ScaleShift and fixed power layer with non-zero shift (#922)
* [GNA] Added test ScaleShift and fixed power layer with non zero shift

added tests

[GNA] Added test ScaleShift and fixed power layer with non zero shift

* Test Assert

* rebuild
2020-06-16 00:32:28 +03:00
Roman Kazantsev
4f4352f301 Fix preserving names of output layers after TopK NGraph transformation (#928)
* Fix preserving names of output layers after TopK NGraph transformation (#843)

* Fix preserving names of output layers after TopK NGraph transformation

It helps to infer semantic-segmentation-adas-0001 model. See CVS-31977.

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix a test for TopK

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix TopK NGraph transformation and its test

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Disable smoke_LoadNetworkAccuracy due to sporadic failure

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-06-15 20:57:45 +03:00
Anastasia Kuporosova
a67d74c41f [Python API] Fix long inference (#897) 2020-06-15 16:21:41 +03:00
Ivan Tikhonov
26c563132d Revert prior box constant folding (#906)
* Revert "Const folding and reference implementation for PriorBox(Clustered) ops (#785)"

This reverts commit 9fc818478a.

* apply codestyle for ngraph part
2020-06-15 12:38:27 +03:00
Ilya Lavrenov
dc1ca195dd Updated dates of removal for deprecated API (#911) 2020-06-15 12:24:27 +03:00
Vladimir Paramuzov
f5ad3e6f89 [IE CLDNN] Fixed clone network to preserve original CNNNetwork (#870) 2020-06-12 15:53:30 +03:00
Konrad Dobros
6c736ce001 [IE CLDNN] Fix fsv16 -> bfyx reorder removal (#873) 2020-06-12 15:43:54 +03:00
Anastasia Kuporosova
30ab6534e1 [Python API] Fixate requirements (#905) 2020-06-12 12:06:11 +03:00
Ilya Lavrenov
259a4c25ce TESTS: Added test for parallel LoadNetwork with accuracy check (#858) 2020-06-12 11:56:59 +03:00
Andrey Somsikov
347930008c Use default thread sanitizer linkage (#899)
GCC and CLang *default* sanitizer linkage differs (static vs. dynamic).
Prefer default behavior as alternate seen having issues.

Default (GN)U linker fails with unresolved symbols linking Clang built
binaries with sanitizer enabled. Force use LLVM linker lld for Clang
builds.

Sanitizer instrumentation and link flags should be retained for all
binaries. Updating samples cmake configuration to keep those flags
after unset logic at the ie_build_samples().
2020-06-12 00:36:03 +03:00
Evgeny Latkin
4fa251483a [IE][Myriad] fix HW tiling (#894) 2020-06-11 20:48:56 +03:00
Vladimir Paramuzov
30f8af70fc [IE CLDNN] fix perf for fsv16 global avg pooling (#666) 2020-06-11 20:44:37 +03:00
Andrew Bakalin
3fc6d8a188 [VPU] Update firmware (#898) 2020-06-11 20:44:20 +03:00
Denis Orlov
66c8df6a87 [GNA] Fixes in checks, asserts, etc. (#867) 2020-06-11 20:04:46 +03:00
Nikolay Shchegolev
e53eb86334 [Common] Static analysed issues. Part II. 2020-06-11 19:59:44 +03:00
Edward Shogulin
2df99d4263 [LPT] Static code analysis issues fix (#889) 2020-06-11 15:09:20 +03:00
Gleb Kazantaev
deab4d38b0 Fix NopElimination (#869) 2020-06-11 13:28:27 +03:00
Vladimir Paramuzov
412428f1dd [IE CLDNN] Always use FP32 as intermediate type for fused quantize (#829) 2020-06-11 12:22:27 +03:00
Evgeny Lazarev
167c96a8af Relaxed MO requirements for "protobuf" package (#862) 2020-06-10 18:26:16 +03:00
Gleb Kazantaev
b7363ba711 Fix divide conversion for integer input type (#853) 2020-06-10 16:25:57 +03:00
Evgeny Lazarev
5cef9f3734 Fixed StridedSlice to Crop transformation (#836) (#845)
* Fixed StridedSlice to Crop transformation to not apply when rank of data is changed

* Added unit test for StridedSlice to Crop transformation
2020-06-10 11:54:02 +03:00
Andrey Dmitriev
0bf1f53356 [GNA] Added support permute layer (#723)
* [GNA] Added GNA natively supported permute layer cases.
2020-06-09 16:43:01 +03:00
Maksim Doronin
18004bdb5e [IE VPU] Dynamic Broadcast tests (#737)
* [IE VPU] Enable StaticShapeBroadcast tests

* [IE VPU] DSR: support case when shape is output and input for stage

* [IE VPU] Enable Broadcast and Transpose tests

* [IE VPU] DSR: fix typo

* [IE VPU] Add assertion for numConsumer in DSR

* [IE VPU] Added CheckMyriadX helper method

* [IE VPU] New DSR assert for input->getInputTo

* [IE VPU] Fix myriad2 tests bug
2020-06-09 16:10:12 +03:00
Ivan Tikhonov
9fc818478a Const folding and reference implementation for PriorBox(Clustered) ops (#785)
* Constant folding for PriorBox, PriorBoxClustered; Deleted PriorBoxIE, PriorBoxClusteredIE and transformations; Added unit tests; codestyle

* Delete debug info

* delete unnecessary convert_prior_to_ie_prior.hpp file

* fix ngraph reader tests; delete PriorBoxIE functional test

* fix for ngraph reader tests

* Apply review comment

* apply ngraph codestyle

* restore PriorBoxClustered tests in disabled state
2020-06-09 14:47:49 +03:00
Denis Orlov
ef8a8dd309 add support for multiple scale factors in speech sample (#835)
Co-authored-by: Anna Alberska <anna.alberska@intel.com>
2020-06-09 14:36:28 +03:00
Andrey Sokolov
d4e880de3d [IE VPU] Update firmware; enable convolution VPU OCL tests (#802) 2020-06-09 14:34:10 +03:00
Vladimir Paramuzov
fe198dd544 [IE CLDNN] Added 6d tensor support in eltwise/scale primitives (#826) 2020-06-09 14:29:36 +03:00
Anton Zaytsev
b0eb3e67ee [ci-skip][IE MKLDNN] Add Precision U16 in MKLDNN (#783) 2020-06-09 14:20:43 +03:00
dmitrygo
434361cea9 [TESTS] fixes after rebase 2020-06-09 14:11:18 +03:00
dmitrygo
aa30580109 [CPU] mkldnn submodule up 2020-06-09 14:11:18 +03:00
dmitrygo
051a429c31 [LPT] Fixed quantizeBlob routine for 3D case 2020-06-09 14:11:18 +03:00
Edward Shogulin
8eb88d51f2 [LPT] GPU tests were fixed 2020-06-09 14:11:18 +03:00
Edward Shogulin
971811c8c8 [LPT] [TEST] LayerTransformation test threshold was updated 2020-06-09 14:11:18 +03:00
Anton Voronov
629ca3a5d8 [CPU] Gemm node: supported precisions U8 and I8 and added tests 2020-06-09 14:11:18 +03:00
Edward Shogulin
92e5e010b9 [LPT] FullyConnected & Gemm tests 2020-06-09 14:11:18 +03:00
dmitrygo
c7313bab7f [CPU] Fixed weights candidate initialization in FC node 2020-06-09 14:11:18 +03:00
Edward Shogulin
d798831c95 [LPT] Gemm and FullyConnected 3D improvement 2020-06-09 14:11:18 +03:00
Edward Shogulin
4d01adbe01 [LPT] tests extending 2020-06-09 14:11:18 +03:00
Edward Shogulin
1d51d2185a [LPT] [Test] Low precision transformations functional tests infrastructure improvement 2020-06-09 14:11:18 +03:00
Edward Shogulin
65b00c1dfb [LPT] FullyConnected transformation fix 2020-06-09 14:11:18 +03:00
Edward Shogulin
9758305b32 [nGraph] Remove Reshape for 3D FullyConnected 2020-06-09 14:11:18 +03:00
Edward Shogulin
d7c77212b8 [IE COMMON] [LPT] Concat asymmetric quantization with signed interval fix 2020-06-09 14:11:18 +03:00
Edward Shogulin
e544dd1e28 [IE COMMON] [LPT] Support 3D layout for FullyConnected transformation 2020-06-09 14:11:18 +03:00
dmitry-gorokhov
bc98d17121 [CPU] Added custom implementations (power=0.5, power=-1.0) for Power node 2020-06-09 14:11:18 +03:00
dmitry-gorokhov
bcd38100db [CPU][WA] Supported 3D layout for FullyConnected primitive
Extended jit uni depthwise primitive to support 3D inputs
2020-06-09 14:11:18 +03:00
Nikolay Shchegolev
b6f2c06b26 [Common] Static analyzed issues. (#804) 2020-06-09 13:49:50 +03:00
Vladimir Paramuzov
b4546ad1e0 [IE CLDNN] Better error message when output is not found (#824) 2020-06-09 12:26:28 +03:00
Edward Shogulin
d02b9a9b81 [LPT] [TEST] LayerTransformation test threshold was updated (#828) 2020-06-09 10:34:17 +03:00
Maxim Andronov
d8e82d56d2 [CPU] fix set up config for bin conv fused (#608) 2020-06-09 09:59:29 +03:00
Anastasia Kuporosova
e91453e006 [Python API] Fixate requirements versions (#830) 2020-06-09 08:49:49 +03:00
Anastasia Kuporosova
6a60f93af0 [Python API] Fix deprecation warnings (#812) 2020-06-09 08:48:08 +03:00
Edward Shogulin
ca643edb1b [LPT] [CPU] NormalizeL2 transformation (#662)
* [LPT] NormalizeL2 transformation

* [LPT] NormalizeL2 transformation tests improvement

* [CPU] Fixed depthwise injector aux_vec_count for broadcasting case

* [LPT] Normalize on GPU enabling

Co-authored-by: Zinoviev, Vladimir <vladimir.zinoviev@intel.com>
Co-authored-by: dmitrygo <dmitry.gorokhov@intel.com>
2020-06-08 22:42:50 +03:00
Pavel Esir
7a11e36eeb Add fixedscale(bias) components to Kaldi (#725)
* Added fixed scale(bias) components

* Successfully converted after adding fixed bias,scale components

* Added unittests
2020-06-08 21:37:44 +03:00
Mikhail Letavin
155916acde [IE CLDNN] Fix variable initialization issues (#816) 2020-06-08 21:07:50 +03:00
Nikita Kudriavtsev
ac65ea30fd [ICV] Watchdog switch + ddr initialization (#554)
* [IE Myriad] Added XLinkBootFirmware method in XLink API for booting firmware buffer

* [IE Myriad] Patch firmware in mvnc. Added test to check device reset without connecting.

* [IE Myriad] Added option MOVIDIUS_DDR_TYPE for Myriad plugin

* [IE Myriad] Added tests for new option MOVIDIUS_DDR_TYPE

* [IE Myriad] Update firmware 1201 -> 1212

* [IE Myriad] Convolution3x3 tests are disabled due to firmware issue. #-32921
2020-06-08 20:51:45 +03:00
Irina Efode
3b5de94a09 [IE TEST] Eltwise tests refactoring (#726)
* [IE TEST] Eltwise tests refactoring

* [IE TESTS] Fix comments
2020-06-08 18:44:42 +03:00
Denis Orlov
ff00817bb7 [GNA] Support changing the execution mode in runtime (#801) 2020-06-08 18:43:12 +03:00
iliya mironov
eefaf56075 Fix unit tests for select layer. (#638)
* Fix unit tests for select layer.
2020-06-08 18:39:40 +03:00
Maxim Vafin
f1811ad060 Implement support for opset3 EmbeddingBag ops (#546)
* [MO] Implement EmbeddingBag_3

* Transform dynamic sub-graph of Wide and Deep into EmbeddingSegmentsSum

- Expressed SparseWeightedSum sub-graph through EmbeddingSegmentsSum
- Removed experimental SparseWeightedSum layer
- Implemented tests for the transformation

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix EmbeddingBag shape infer

* Fix EmbeddingSegmentsSum transformation for Wide and Deep

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix EmbeddingSegmentSum replacer after ports swap

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Update package_BOM.txt

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Add unit tests for EmbeddingXXX shape infer

* Fix ATen resolver

* Remove deleted files from BOM

* Add opset version to embedding_bag

* Use base class for EmbeddingBag

* Fix per_sample_weights case

* Fix EmbeddingSegmentsSum transformation

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix EmbeddingBag checks

* Fix ATen front transformation and merge conflicts

* Fix BOM

* Work around limitation for I64 input of W&D model

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Cleanup where operation to fix affect of WhereDecomposition transform

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix BOM

* Correct EmbeddingSegmentSum transform for Wide and Deep

Add casting segment ids to i32 and remove ConstToResult sub-graph.

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Update BOM with RemoveConstToResult transform

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Add more comments for RemoveConstToResult transformation

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Remove useless logging in EmbeddingSegmentsSum transformation

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Small fixes

* Move EmbeddingBag resolving back to front phase

* Improve error messages

* Fix typo in unittests

* Reimplement sparse_reshape middle transform

Avoid deprecated API.

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Clean-up graph after sparse_reshape and ConstToResult transformation

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix clean-up for transformations

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix clean-up for transformation #2

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-06-08 18:06:40 +03:00
Konrad Dobros
d155483573 [IE CLDNN] Optimize 1x1 imad convolution kernel (#757) 2020-06-08 16:44:50 +03:00
Andrey Somsikov
626bc4f3d4 Add commit links to memcheck report (#820) 2020-06-08 15:08:58 +03:00
Tomasz Dołbniak
60d4d62536 Disable warnings-as-errors for ONNX target (#749)
* Disable warnings-as-errors for ONNX target

* Disable warnigs-as-errors for windows too

* Change WIN32 -> MSVC
2020-06-08 13:52:45 +03:00
Evgenya Stepyreva
e7f5f53f92 [ MO ] Groupped conv fusion (#797)
Fixed the group convolution fusion pass to properly get the feature dim in NCHW layout case.
2020-06-08 13:00:54 +03:00
Edward Shogulin
a224078c5c [LPT] [Test] DepthToSpace sporadic fail fix (#815) 2020-06-08 12:55:37 +03:00
Alexander Zhogov
9a968b12db Azure CI: increase timeout for Mac to 180 min 2020-06-08 12:17:50 +03:00
Vladimir Paramuzov
f0498ad011 [IE CLDNN] Enable ShuffleChannels op (#787) 2020-06-07 22:57:20 +03:00
Edward Shogulin
63ee9f8916 [LPT] [CPU] DepthToSpace transformation (#663)
* [LPT] [TEST] LayerTransformation generalization

* [LPT] DequantizationDetails extending

* [LPT] DepthToSpace transformation implementation
2020-06-07 21:12:52 +03:00
Alexander Zhogov
93b60cacfa Azure: Add Ninja (#803)
* Azure: Add Ninja

* Fix 'Install Ninja' on Linux

* Fix bin dir path on Windows

* Add -Wno-unused-variable on Mac

* Add -Wno-error=unused-command-line-argument on Mac

* Set CXXFLAGS for Mac

* Improvements

* Fix BIN_DIR on Linux
2020-06-06 15:56:24 +03:00
Vladimir Paramuzov
0022eebd71 [IE CLDNN] Enable DepthToSpace (#780)
Enabled DepthToSpace ngraph transformat
Updated implementation to support 5d and mode parameter
fsv16 direct support
Functional tests for GPU
2020-06-05 20:16:47 +03:00
Daria Mityagina
807f85f93f it is duplicate of PR: #656, but without test modification (#794) 2020-06-05 19:57:03 +03:00
Chance Luo
7f09b54af8 Disable Hw Avg Pooling for small output tensors if excludePad=true (#772) 2020-06-05 19:47:53 +03:00
Kami-996
cad3ccd8a3 add /wd4819 to disable C4819 warning, which is treated as error in win32 (#767)
Co-authored-by: jasonlee <jasonlee@qiyi.com>
2020-06-05 16:04:59 +03:00
emmanuelattia-philips
a0d1dae91d Fix: ITT_INCLUDE_DIR was not correctly detected (#748) 2020-06-05 14:46:39 +03:00
Ilya Znamenskiy
4d3ddc1684 [IE CLDNN] GEMM int8 optimization using MMAD macro (#635) 2020-06-05 14:28:21 +03:00
Anton Voronov
70c2058b61 [CPU] supported ShuffleChannels and added tests (#636) 2020-06-05 14:10:55 +03:00
Ilya Churaev
3571d44896 Save the name of output data if we remove previous layer (#760)
* Save the name of output data if we remove previous layer

* Added test
2020-06-05 13:36:35 +03:00
Pavel Rodionov
20d812d959 [GNA] Set default GNA library to GNA2 (#771) 2020-06-05 13:00:58 +03:00
dmitrygo
b485e829d6 [CPU] DepthToSpace review leftovers 2020-06-05 12:47:24 +03:00
Maxim Vafin
f51c533ea8 Add ReduceL2 decomposition (#733)
* Add ReduceL2 decomposition

* Add ReduceL2 transformation tests

* Add const propagation unit test for ReduceL2
2020-06-05 12:34:57 +03:00
Denis Orlov
67e3e06bee Fix hetero mode in speech sample - set config when loading network (#786) 2020-06-05 11:54:03 +03:00
Ilya Churaev
7a5d447e9f [SAMPLES] Use defined constant instead of string (#788) 2020-06-05 11:22:24 +03:00
Gladilov, Gleb
f80bd537bf [IE][VPU][nGraph]: Fixes DTS transformations to properly keep outputs names (#734)
* NonZero, Broadcast

* Concat

* Gather

* [IE][VPU][nGraph]: Fixes DTS transformations to correctly keep outputs names

* [IE][VPU][nGraph]: Fixes dynamic to static shape nonzero tests

Co-authored-by: Roman Vyunov <roman.vyunov@intel.com>
2020-06-05 11:16:52 +03:00
Edward Shogulin
f9ac555857 [LPT] Output layers update fix (#754) 2020-06-05 10:54:38 +03:00
Sergey Shlyapnikov
6e491a89ad [IE CLDNN] Improve Gather performance and add fusing support (#736) 2020-06-05 10:20:58 +03:00
Egor Churaev
2100521a14 [IE CLDNN] Implement NormalizeL2 int8 kernels (#720) 2020-06-05 10:16:27 +03:00
Ilya Churaev
a705f0c358 Avoid loading of reader if it doesn't exist (#758)
* Avoid loading of reader if it doesn't exist

* Updated error messages
2020-06-04 21:21:13 +03:00
Maxim Vafin
c7d130efbe Fix Proposal for the case of 2 outputs (#773) 2020-06-04 20:56:46 +03:00
Evgeny Lazarev
c10ff28f12 Added default value for 'aligned' in the ExperimentalDetectronROIFeatureExtractor for backward compatibility (#777)
Fixed backward compatibility issue that old IRs with ExperimentalDetectronROIFeatureExtractor operation cannot be loaded with the new IE
2020-06-04 20:47:52 +03:00
Lukasz Debski
698dfc4bf6 [IE CLDNN] Permute fused ops support (#642) 2020-06-04 17:01:21 +03:00
Alexey Varyzgin
85aa23ec8a [CPU][BF16] Default Optimisation Capability of BF16 was enabled on CPX (#647) 2020-06-04 16:06:15 +03:00
Maxim Vafin
1001caf04e Add support for ONNX Pad-11 (#744) 2020-06-04 14:48:31 +03:00
Denis Orlov
0e60aed97a [GNA] Support 100 inputs, instead of 10 (#741) 2020-06-04 14:33:09 +03:00
Gorokhov Dmitriy
3183c116d9 DepthToSpace, SpaceToDepth layers optimizations (#706)
* [CPU] Updated DepthToSpace and SpaceToDepth layers to be conformant with the specification

The patch also includes n[d]hwc layout support as well as some optimizations

* [CPU][TESTS] Removed old DepthToSpace test since it doesn't corresponds to layer's specification

* [nGraph] Utilize CommonOptimizations pass with custom transformations callback
2020-06-04 14:25:19 +03:00
Evgenya Stepyreva
01e60d057d [ MO ] InterpolateConcat empty sources fix (#764) 2020-06-04 14:18:33 +03:00
Vladimir Paramuzov
d7fad0109a [IE CLDNN] Disabled sporadic detection output tests (#740) 2020-06-04 11:14:05 +03:00
Vladimir Paramuzov
28ffbf0857 [IE CLDNN] Remove unused fused deps for FQ (#712)
Remove unused fused FQ kernel arguments to avoid extra setArg() calls which significantly reduces host overhead
2020-06-04 10:30:46 +03:00
Egor Churaev
546377dc8e [IE CLDNN] Implement EmbeddingBag operations (#623)
Implemented three operations: EmbeddingBagPackedSum,
EmbeddingBagOffsetsSum and EmbeddingSegmentsSum. These operations do
the same work but have a different format of inputs.
2020-06-04 10:25:28 +03:00
Anton Voronov
e53b1b7fbc [MKLDNN_PLUGIN] Convolution node: skip initializing of primitive descriptors for planar layout if there is already jit primitive (#672) 2020-06-04 08:06:14 +03:00
Ilya Lavrenov
158d32139f Revert "Enabled thread tests (#717)" (#756)
This reverts commit 99a2423ec0.
2020-06-03 22:32:55 +03:00
wistal
2bb7010193 MO should support LRN k param with caffe model, rather than fixed to 1 (#716)
Co-authored-by: yipengqu <yipeng.qu@intel.com>
2020-06-03 20:33:55 +03:00
Alexey Suhov
1ffada0b23 [Docs] Fixes in readme files: (#750)
- change repo name to openvino
- update driver version
- fix path to samples data
- remove section about Movidius driver installation
- change latest release to 2020.3
- merge fixes in install_dependencies.sh from 2020 branch
2020-06-03 20:14:35 +03:00
Mikołaj Życzyński
023344a317 [IE CLDNN] Added fusing suport to all pooling kernels (#689)
adds fusing support to all available pooling kernels
tests all possible input type/output type configurations
fixes minor bug in max pooling in pooling_gpu_test.cpp
fixed minor bug with yxbf format in pooling_gpu_ref and pooling_gpu_int8_ref kernels
fixes bug with b_fs_yx_fsv32 format in pooling_gpu kernel
resolves bug with max pooling accuracy missmatch in case of non zero pad end layer parameter
resolves average pooling accuracy missmatch in case of non zero pad end layer parameter
2020-06-03 19:44:27 +03:00
Lukasz Debski
e2d1ae7055 [IE CLDNN] Fixed stack overflow in calculate_prior_boxes pass (#747)
The problem behind this error was in program_impl::init_graph() where in calculate_prior_boxes we are trying to calculate output layout of an entire network recursively which causes stack overflow. Calculating output layouts beforehand in processing order fixes this issue.
2020-06-03 19:42:50 +03:00
Ilya-Krylov
cfb5f27899 Add 'aligned' param to ExperimentalDetectronROIFeatureExtractor for CPU plugin and MO 2020-06-03 17:52:40 +03:00
Tomasz Dołbniak
53927034da Python API for Assign, ReadValue and ExtractImagePatches (#719) 2020-06-03 15:01:43 +02:00
LiweiSong
63a77bb4a1 mkldnn_memory_solver.hpp: include stdint.h to avoid build error (#729)
fix the following compile error:

inference-engine/src/mkldnn_plugin/mkldnn_memory_solver.hpp:60:9: error: 'int64_t' does not name a type
|    60 |         int64_t size;
|       |         ^~~~~~~

include stdint.h to fix this.

Signed-off-by: Liwei Song <liwei.song@windriver.com>
2020-06-03 15:19:29 +03:00
Edward Shogulin
7edebd8d87 [LPT] [TEST] Sporadic test fail fix (workaround) (#742) 2020-06-03 15:05:45 +03:00
Evgenya Stepyreva
da230131d0 [ nGraph ] FP16 for evaluate (#722) 2020-06-03 14:14:59 +03:00
Vitaliy Urusovskij
72d9a9fae7 Use pre-defined DB collection names in memcheck_upload.py CLI (#651)
Use argparses `choices` for `--db_collection` option.

Also removed unnecessary redefinition of `db_collection` in memcheck_upload.py
2020-06-03 13:54:38 +03:00
Sergey Shlyapnikov
20ef9a9423 [IE CLDNN] Improve kernel selection for b_fs_yx_fsv16 layout and optimize Convolution kernels (#730) 2020-06-03 13:42:15 +03:00
Anton Zaytsev
b457553593 [IE TESTS] Move InferRequestTests (#618)
* [IE TESTS] move Infer_request tests

* fix v0

* [ci-skip][IE TESTS] test update basic class v0

* [ci-skip][IE TESTS] test update basic class v1

* [ci-skip][IE TESTS] test update basic class

* [ci-skip][IE TESTS] test update basic class v3

* [ci-skip][IE TESTS] test update basic class final versions

* [ci-skip][IE TESTS] fix

* [ci-skip][IE TESTS] fix codestaly and comment

Co-authored-by: Irina Efode <irina.efode@intel.com>
2020-06-03 12:16:00 +03:00
Evgeny Talanin
ed85690136 Skip some functional tests on VPU (#568) 2020-06-03 12:15:06 +03:00
Adam Osewski
3a80f0476b [ONNX] GRU and RNN operators. (#607)
* Create generic RecurrentSequenceDirection enum.

* Helper class RecurrentSequenceOp.

* Add ONNX GRU & RNN operators.

* Use OutputVector.

* Update doc.

* Add UTs for GRU and skip them on IE_CPU

* Add UT for bidirectional mode and fix it.

* Normalize activation function name case.

* Add unit-tests for RNN operator.

* UT for GRU with linear_before_reset set to true.

* Fix ONNX GRU for linear_before_reset case.

* Remove unnecessary symbol export macro.

* Fix CentOS error.

* Update UTs.

- Update few tests accuracy tolerance
- Update rnn_fwd_activations with new reference values and model.

* Review comment: add check for static shape

* Add UT for RNN with constant inputs W, R.

* Skip UT with const W,R on IE_CPU
2020-06-03 12:01:56 +03:00
Gladilov, Gleb
4e0c7a217f [IE][VPU]: Faster-RCNN fixes on myriad plugin side (#711)
* [IE][VPU]: Enables pass for propagating dynamism to network outputs

If network had dynamic output and then myriad Front-End inserted
convert stage at the end (to convert FP16 -> FP32 - output precision)
then dynamism would not be propagated - we have convert stage that
has dynamic input, but static output. As a result, we have run-time
error in Convert kernel: input and output shapes do not match.

At the moment, pass supports only Convert stage as output stage
over which we should propagate dynamism to outputs.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU]: Fixes parse DSR in case of output data

Replacing stage output must be done after replacing
data to shape parent, because the last one may access
original parent producer, but after replacing stage output
it'd not have one.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU]: Fixes MacOS build

* [IE][VPU]: Fixes shape data naming convention

Plugin part assumes that if there is dynamic data object, that's
represented as 2 different data objects (data and shape), then
shape data object has name = data object name + @shape suffix.

Pass that creates new dynamic data object should respect that
assumption.

* [IE][VPU]: Fixes dis-alignment in names of data objects representing dynamic data object

MyriadInferRequest::GetResult assumes that in case of dynamic data object
"data" data object and "shape" data object will have aligned names:
"shape" name = "data" name + "@shape" suffix.

In order to meet that expectation propagating dynamism pass must use output
data object name as prefix. Additionally, propagating pass must be applied
before converting shape notation pass in order to make output shape in IE
notation, not MDK, as MyriadInferRequest::GetResult is expecting.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
2020-06-03 11:43:19 +03:00
Mikhail Treskin
447dd3570d Remove deprecated layer test class (#610)
* Update activation layer test

Signed-off-by: Mikhail Treskin <mikhail.treskin@intel.com>

* Get rid of LayerTestsCommonDeprecated class

Signed-off-by: Mikhail Treskin <mikhail.treskin@intel.com>

* Fix activation tests instantiations for gpu and myriad plugins

* Remove leaking inferWithInterp function
2020-06-03 11:04:15 +03:00
Mikołaj Życzyński
3ea1657e4f [IE CLDNN] Activation with fused quantize bug fix (#613)
fixed bug connected with quantization fusing to activation
added scale and activation fusing support
added corresponding tests
2020-06-03 09:30:49 +03:00
Ilya Lavrenov
cdd31da1c7 Updated deprecated messages (#715) 2020-06-03 06:04:50 +03:00
Edward Shogulin
9f6fde9af2 [LPT] Output layers fix (#677) 2020-06-02 23:44:24 +03:00
Ilya Churaev
99a2423ec0 Enabled thread tests (#717) 2020-06-02 23:42:05 +03:00
Nikolay Shchegolev
4f6c976add [CPU] EmbeddingBagOffsetsSum, EmbeddingBagPackedSum, EmbeddingSegmentsSum operations. (#576)
* [CPU] EmbeddingBagOffsetsSum, EmbeddingBagPackedSum, EmbeddingSegmentsSum operations.

* Performance fix

* Perf v2

* Code style
2020-06-02 21:56:17 +03:00
Anna Alberska
4c44ce9795 add PassManagerSettings & create more legible description for concat quantization exception and a test for it (#563) 2020-06-02 21:03:27 +03:00
Andrey Babushkin
6f69ba04c8 [Jenkinsfile] Add failFast parameter (#721)
It allows us to rebuild Jenkins build and wait until all stages are finished despite of some of them may fail
2020-06-02 20:22:25 +03:00
iimironov
a79cd75596 Imironov/cvs 31297 add yolov4 support (#594)
* Add transformation of softplus operation into log(1.0 + exp(x)).
2020-06-02 19:20:29 +03:00
Evgeny Latkin
b2816dc1ec [IE][Myriad] Gather: add test case (#644) 2020-06-02 17:41:19 +03:00
Gleb Kazantaev
638c7b891c Updated DeconvolutionIE to support dynamic shapes (#671)
* Updated DeconvolutionIE to support dynamic shapes

* Updated DeconvolutionIE to support output_shape input

* Updated ConvertConvolutions pass
2020-06-02 17:26:28 +03:00
Vladimir Paramuzov
cbe45b7d0a [IE CLDNN] Fixed names mapping chain in runtime graph to respect original names (#599) 2020-06-02 17:25:41 +03:00
Vitaliy Urusovskij
1d179fdb39 Add parallel downloads to stress tests (#678) 2020-06-02 17:24:22 +03:00
Gleb Kazantaev
be3b4a3362 specificCreator for Transpose operation (#713)
* Updated Transpose node convertor; replaced get_vector with cast_vector

* Replaced NodeCreator with specificCreator
2020-06-02 17:15:36 +03:00
Andrey Somsikov
5776b66fb2 Enable Control Flow Guard for Windows binaries (#714)
Control Flow Guard is security option.
2020-06-02 16:46:23 +03:00
azhogov
8377c714aa Revert "Add ittnotify from IntelSEAPI"
This reverts commit 0583b37a14.
2020-06-02 12:52:14 +03:00
azhogov
f15096e101 Revert "Use ittnotify from thirdparty"
This reverts commit 3863656f44.
2020-06-02 12:50:06 +03:00
Anton Chetverikov
265e3c7cba Remove TopKnormalizer from MO IR Reader transformation_list (#590)
* Remove TopKnormalizer from transformation_list and added call of normalize_outputs to fix read/save of some models
2020-06-02 12:43:41 +03:00
Maksim Doronin
daaeaa5881 [IE VPU] Enable s32->u8 conversion (#699) 2020-06-02 12:20:06 +03:00
Evgeny Lazarev
278868b7a1 Align MO requirements files (#710) 2020-06-02 11:32:39 +03:00
Vladimir Paramuzov
dbdaaa93dd [IE CLDNN] Quantized deeplabv3 optimizations (#646)
Enabled dilation for imad dw fsv16 kernel
Added argmax and mutable_data to fsv16 white list
Enabled byxf input for quantize scale_shift kernel
2020-06-02 09:17:39 +03:00
Somsikov, Andrey
3863656f44 Use ittnotify from thirdparty
VTune ittnotify lack of support aarch64. Switching to use ittnotify
in sources to support any target architecture.
2020-06-01 20:53:39 +03:00
Somsikov, Andrey
0583b37a14 Add ittnotify from IntelSEAPI
Adding ittnotify component of https://github.com/intel/IntelSEAPI

commit 88a56e0ecd162667c7afd2ee9969221d62a32509 (HEAD -> master, origin/master, origin/HEAD)
Merge: 6d743e1 809062a
Author: Alex <alexander.a.raud@intel.com>
Date:   Wed Jul 10 15:06:46 2019 -0700
2020-06-01 20:53:39 +03:00
Andrew Bakalin
d48e0ef5a6 [VPU][NGraph] Reuse NonZero evaluate in StaticShapeNonZero (#658)
* [VPU][NGraph] Reuse NonZero evaluate in StaticShapeNonZero

* [VPU][Tests] Adopt old tests to work with reverted indices

* [VPU] Update firmware
2020-06-01 18:57:06 +03:00
Katya
41ed6f0891 [IE Python API] fix TensorDesc test file name (#701) 2020-06-01 15:58:05 +03:00
Maksim Doronin
69e3af4c99 [IE VPU] OutShapeOfReshape per-layer tests (#631)
* [IE VPU] OutShapeOfReshape per-layer tests

* [IE VPU] Update firmware

* [IE VPU] OutShapeOfReshape: get rid of code duplication
2020-06-01 14:51:04 +03:00
Piotr Rozen
935b48b978 Added speech recognition demo package for centOS (#682) 2020-06-01 14:41:45 +03:00
Vladislav Vinogradov
88264b895a [IE] Fix build error (#703)
Missing changes in transformation library due to IE API dependency removal.
2020-06-01 13:09:23 +03:00
Mikhail Letavin
65f62945dd [IE CLDNN] Free up first copy of weights/biases that were transferred to USM device memory (#561) 2020-06-01 12:01:28 +03:00
Roman Kazantsev
004f414b89 Fix SparseWeightedSum transform for Wide and Deep (#698)
WhereDecomposition transform is applied to Where operation in for-garbage sub-graph remained after SparseWeightedSum transform.

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-06-01 11:48:06 +03:00
Jedrzej Hajduczenia
4001d0d99f [IE CLDNN] Prefer bf(wz)yx format for reshape (#691)
Performance improvement for icnet-camvid model
2020-06-01 10:38:33 +03:00
Ilya Churaev
d970d0494e Removed dependency on Inference Engine from transformation library (#680)
* Removed dependency on Inference Engine from transformation library

* Change transformations export macro

* Fixed comments
2020-06-01 10:31:31 +03:00
Ivan Tikhonov
cd01ccd449 Reshape-Permute-Reshape pattern to DepthToSpace layer transformation (#601)
* implemented depth_to_space transformation

* renaming

* added functional tests, fixed mistakes in implementation of the transformation

* disable ConvertSpaceToDepth/ConvertDepthToSpace transformation for CPU plugin, enable DepthToSpaceFusion for CPU plugin only, add specific creators

* fix wrong include

* fix for functional tests: set transformation callback

* revert callback calls for CPU plugin

* move functions to .cpp file

* Apply review comments

* Apply additional review comments

* fix cast to bool type
2020-06-01 09:24:16 +03:00
Ewa Tusień
b4893945c7 [ONNX] Add Range op to ONNX importer (#548)
* Added Range op to ONNX importer.

* Disable tests for IE.
2020-06-01 05:59:39 +03:00
emmanuelattia-philips
7ec63cafe3 Ie capi callback with explicit calling convention (#697)
* Added explicit calling convention to CAPI callback

* Fixed typo spacing

* Renamed INFERENCE_ENGINE_CALLBACK to INFERENCE_ENGINE_C_API_CALLBAC to make the macro really specific to the C API
2020-05-31 23:19:37 +03:00
Gladilov, Gleb
3bf7a69df1 [IE][VPU]: Faster-RCNN fixes on myriad plugin side (#665)
* [IE][VPU]: Fixes deallocation data for cases of CMX allocator run

The final loop tries to deallocate data objects that keep shape values for
other data objects that're outputs of a model. But the case when allocator
takes only CMX data into consideration was not handled and since allocation
could not happen, it lead to fail on deallocation of a data object that has
not been allocated.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU]: Fixes allocator with work on data to shape edges

Since there is new relationship between data objects: some
data objects may contain shape of other data object - allocator
must properly respect that. The thing is if 2 data objects are
connected in such a way, they represent unite entity (dynamic
data object) and should have the same lifetime.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
2020-05-31 13:17:36 +03:00
emmanuelattia-philips
bad5bb30a3 Added ie_core_read_network_from_memory to the C API ie_bridge. (#674)
* * Added ie_core_read_network_from_memory to the C ie_bridge.

* Added size argument for xml_content, fixed const correctness of the weight_blob, fixed unit test

* * Removed debug message

* Changed variables names from model_xxx to weights_xxx to be more consistent with the argument name of the tested function.

* Added a description for xml_content_size in ie_core_read_network_from_memory.

* * xml_content is now passed as uint8_t
* reading function factorized in the unit-test
2020-05-31 02:25:39 +03:00
Ilya Lavrenov
3d42871523 Added dependency on ONNX reader (#693) 2020-05-30 15:15:20 +03:00
Denis Orlov
9af51a165f [GNA] Workaround support for callbacks (#591) 2020-05-30 00:43:42 +03:00
Edward Shogulin
e2729b87f3 [LPT] Convolution regression tests (#543)
* [LPT] Base test infrastructure extending & Convolution test

* [LPT] LPT test infrastructure refactoring
2020-05-29 22:56:58 +03:00
Anastasia Kuporosova
3ef1a26174 [IE TOOLS] Use input_info in python benchmark app (#660) 2020-05-29 21:28:17 +03:00
Anastasia Kuporosova
cbad43f3a5 [Python API] Fix PreProcessInfo tests (#690) 2020-05-29 21:20:16 +03:00
Vladimir Gavrilov
3a24eb6a62 MO fails generating IR from XLNET model due to a bug in the transformation ConvertGroupedStridedSlice (#625)
* Small fix in the transformation ConvertGroupedStridedSlice. Now VariadicSplit is generated only in the case when node has at least 2 output nodes.

* Added unittests for the case when there is only one StridedSlice.
2020-05-29 21:01:09 +03:00
Ilya Churaev
963f55a189 Fixed CODEOWNERS paths (#684) 2020-05-29 20:57:32 +03:00
Vladimir Paramuzov
f7052a107d [IE CLDNN] Optimized FQ kernel in fsv16 layout (#573)
- Optimized FQ kernel in fsv16 layout. Enabled scaleshift transform for FP16 precision
- Disabled activation_opt kernel with fused ops in some cases
2020-05-29 20:10:30 +03:00
Evgenya Stepyreva
6cfa77223e [ nG ] Added F16 folding support (#686) 2020-05-29 19:09:01 +03:00
Ilya Churaev
11bd4f8a42 Do not use ONNX reader if ONNX importer was disabled (#683) 2020-05-29 17:46:40 +03:00
Anna Khakimova
be3b711972 Pre-processing(GAPI): AVX2/AVX512 implementation of 3C/4C Resize via universal intrinsics. (#612) 2020-05-29 15:44:12 +03:00
Ilya Lavrenov
011128cb54 Python: Fixed installation rules to install additional .so files generated from .pyx (#676) 2020-05-29 14:45:59 +03:00
Katarzyna Mitrus
5f8f9ec108 [nGraph] Reorder nGraph LSTMSequence inputs and outputs dimensions (#560)
* Reorder nGraph LSTMSequence input/outpt dimensions

* Update nGraph pythonAPI for LSTMSequence

* Reorder axes in ONNX importer LSTM

* Tests update

* Fix clang warning

* Use opset3 namespace

* Style apply

* Tests update

* Use opset1  namespace

* Remove usage of  GetOutputElement in ONNX importer LSTM

* Remove opset0 header

* Use Node::output()
2020-05-29 14:29:18 +03:00
Ivan Tikhonov
a4f13ae9fe fix constant folding of Concat op (#675) 2020-05-29 14:09:20 +03:00
Artyom Anokhov
09192b804e [OpenVINO scripts] Fixed *.sh files index from 644 to 755 (#664)
* Fixed *.sh files index from 644 to 755

* Added convert.py executable permission
2020-05-29 13:50:17 +03:00
Gladilov, Gleb
67d733d5a8 Enables VPU maintainers notification in case of PR to VPU related folders and files (#667) 2020-05-29 09:32:10 +03:00
Evgenya Stepyreva
e290b14ab1 [ MO Interpolate ] Fixing broken model reshape-ability (#619) 2020-05-29 09:15:47 +03:00
Evgenya Stepyreva
5cc8114322 [ MO: CVS-32286 ] IdentityN fix (#668) 2020-05-29 09:11:22 +03:00
Ilya Churaev
e51e1682ca Enabled Unit tests and remove IReaderPtr (#653)
* Enabled Unit tests and remove IReaderPtr

* Fixed unicode tests for Windows

* Fixed typo
2020-05-28 22:40:20 +03:00
Andrey Somsikov
5f6999ed7e Remove Safety dependency (#627)
Safety tool should be isolated from the environment it is validating:
https://github.com/pyupio/safety/security/advisories/GHSA-7q25-qrjw-6fg2

Suggesting docker solution by default.
2020-05-28 18:31:10 +03:00
Gleb Kazantaev
bb41994f56 Removed StridedSlice to StridedSliceIE transformation (#661) 2020-05-28 18:27:54 +03:00
Vladimir Gavrilov
33aca7d2c4 SplitConcatPairToInterpolate inserts Interpolate when input is 2D (#596)
* SplitConcatPairToInterpolate transformation was moved to middle stage and is applied only for 4D and 5D inputs.
2020-05-28 18:08:24 +03:00
Andrew Bakalin
77162bf8ee [VPU][Tests] Fix sanitizer issue in unit tests (#630) 2020-05-28 18:01:56 +03:00
Irina Efode
23f41213bb [IE TESTS] MOVE plugin tests (#659) 2020-05-28 17:22:19 +03:00
Gleb Kazantaev
b731ce13d8 Fixed NMSIE shape infer function (#648) 2020-05-28 16:45:48 +03:00
Evgeny Lazarev
0efe474342 Fixes for Mask-RCNN conversion (#654)
* Fixed ONNX Mask-RCNN conversion

* Fixed validate_and_infet_types for NMS ops: added check for number of connected inputs

* Updated NMS ops to properly handle optional input with index 2

* Fixed typo in the implementation
2020-05-28 14:31:42 +03:00
Evgenya Stepyreva
ec5c9db932 [ MO ] Memory usage (#657) 2020-05-28 14:00:42 +03:00
Anton Zaytsev
00b53d6c33 [IE TESTS] Move Config behavior tests (#615)
* [ci-skip][IE TESTS] move config test

* [ci-skip][IE TESTS] fix config
2020-05-28 13:55:37 +03:00
Anton Zaytsev
25d36568f8 [IE TESTS] Move ExecGraphInfoTests (#617)
* [ci-skip][IE TESTS] move ExecGraph test

* [ci-skip][IE TESTS] fix

* [ci-skip][IE TESTS] fix codestyle

Co-authored-by: Zaytsev, Anton <antonzay@intel.com>
2020-05-28 13:48:16 +03:00
Irina Efode
246790f264 [IE TESTS] Move unit tests to the new infra (#641) 2020-05-28 12:33:56 +03:00
Roman Kazantsev
958e425775 Implement Bucketize in MO and MKLDNN for opset3 (#583)
This operation is used for Wide and Deep Model

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-05-28 11:11:07 +03:00
Anastasia Kuporosova
e025f1464b [Python API] Add InputInfo and PreProcessInfo (#637) 2020-05-28 10:55:11 +03:00
Michał Karzyński
125dd89c01 Remove Runtime classes from nGraph Python API (#569) 2020-05-28 09:50:57 +02:00
Gleb Kazantaev
f276b5fbb4 Updated StridedSlice to StridedSliceIE conversion to support dynamic shapes (#621)
* Updated ConvertStridedSliceToStridedSliceIE transformation to support dynamic shapes

* Fixed stridesluce to crop transform not to fail with dynamic shapes
2020-05-28 01:14:12 +03:00
Edward Shogulin
57da5ddab8 [LPT] Concat complex graph support (#527)
* [LPT] [Tests] LowPrecisionTransformations base test extending

* [LPT] Concat complex (neighbor) graph support

* [LPT] Multichannel concat: scale per channel support

* [LPT] test improvements

* [TEST] tests infrastructure improvements
2020-05-27 21:53:50 +03:00
Mikołaj Życzyński
e734377590 [IE CLDNN] Grouped convolution bug fix (#572)
Fixes bug in grouped convolution connected with wrong weights layout in SetDefault() method
2020-05-27 21:19:49 +03:00
Ilya Churaev
c75fd4db92 Removed CI and docker scripts (#622) 2020-05-27 20:58:03 +03:00
Alexander Zhogov
79b780413f Azure CI: Add timeouts, *smoke* filter (#574) 2020-05-27 19:47:23 +03:00
Alexander Zhogov
93333780c7 CODEOWNERS: Add link to help, and small fix 2020-05-27 18:50:47 +03:00
Ilya Churaev
3c718809d3 Added ONNX reader for the OpenVINO (#532)
* Added ONNX reader for the OpenVINO

* Fixed comments

* Fixed comments

* Fixed message

* Fixed memory consumption

* Revert IReaderPtr

* Fixed Myriad tests

* Fixed comment

* Renamed inference_engine_ir_readers to inference_engine_ir_reader
2020-05-27 18:37:19 +03:00
Gleb Kazantaev
d5434a036e CODEOWNERS: Added nGraph/Transformations/nGarphTests/IECore (#633) 2020-05-27 18:30:14 +03:00
Irina Efode
7fcb12603e [IE TESTS][IE CMAKE] Fix download 'testdata' repo via HTTPS (#597) 2020-05-27 16:20:09 +03:00
Gorokhov Dmitriy
c5124763db [CPU] Added quantization post op to the list of supported by FP32 DW Conv (#592) 2020-05-27 16:00:13 +03:00
Nikolay Shchegolev
27e8580b7d [CPU] ExtractImagePatches operation (#575) 2020-05-27 15:46:49 +03:00
Andrew Bakalin
fd1cc08cd8 [VPU][GT] Add convert shape notation pass (#559)
* [VPU] Update firmware

* [VPU][GT] Adjust allocator to deal with undeallocated shapes

* [VPU][Tests] Adjust NonZero tests and references

* [VPU][Tests] Add unit tests for pass

* [VPU][GT] Adjust previous unit tests

* [VPU][GT] Introduce convertShapeNotation pass

* [VPU][GT] Review fixes

* [VPU] Change dims order in dynamic output
2020-05-27 15:35:28 +03:00
Pavel Esir
e337350cc1 Fix skipping incorrect names in scale/mean values (#535)
* Fix skipping incorrect names in scale/mean values

* removed inappropriate comment in cli_parser.py
2020-05-27 14:53:50 +03:00
Evgeny Latkin
d24132912e ICV: fix Scatter layers: fix validators (#541)
* ICV: fix Scatter layers: fix validators

* ICV: fix Scatter layers: enable 0D for `axis`

* Revert "ICV: fix Scatter layers: enable 0D for `axis`"

This reverts commit 82da24b989678061a585a5c7ffd7d5dab10f5edc.

* ICV: fix Scatter layers: test, fix CNNNetworkImpl
2020-05-27 13:14:46 +03:00
Vladislav Vinogradov
946ed119c8 [IE CMAKE] Fix OpenBLAS dependency handling for Yocto ARM64 platfrom (#562)
Use `THIRDPARTY_SERVER_PATH` variable to override remote artifacts path.
2020-05-27 13:06:20 +03:00
Michał Karzyński
dcdeb34c8f CODEOWNERS: Add openvino-ngraph-maintainers (#628) 2020-05-27 12:50:18 +03:00
Konstantin Satunin
bfe416704d Change region of VMSS agents (#595) 2020-05-27 12:13:52 +03:00
Irina Efode
44cd77f54b [IE TESTS] Move old IE Unit tests to the new infra (#605) 2020-05-27 11:53:00 +03:00
Egor Churaev
31fe146539 [IE CLDNN] Implement CumSum operation (#533)
CumSum performs cumulative summation of the input elements along the given axis.

Details:
By default, it will do the sum inclusively meaning the first element is
copied as is. Through an "exclusive" attribute, this behavior can change
to exclude the first element. It can also perform summation in the
opposite direction of the axis. For that, set "reverse" attribute to
true.

JIRA: 29994
2020-05-27 11:47:16 +03:00
Nikita Kudriavtsev
2012d084f2 [IE Myriad] "printf" methods were replaced with mvLog (#552) 2020-05-27 11:45:34 +03:00
Andrew Bakalin
d337b4ed97 [VPU][GT] Refine edges methods (#550)
* [VPU][GT] Extract order manipulation into separate methods

* [VPU][GT] Rename data -> dependency

* [VPU][GT] Extend unit tests

* [VPU][GT] Introduce replacement and removal methods for StageDependency

* [VPU][GT] Update DataToShape connection methods
2020-05-27 11:14:02 +03:00
Evgenya Stepyreva
5c2eb05990 [ MO ONNX ] Resize-11 clear error message (#620)
* Small refactoring of extractors

* [ MO ] Throwing an exception while extracting Resize-11 which is not supported
2020-05-27 08:09:15 +03:00
Konrad Dobros
d3ea03bbfc [IE CLDNN] Enable int8 activation for fsv16 format (#516)
This change enables int8/uint8 standalone activation to use optimized
block format (b_fs_yx_fsv16). This should eliminate cases where such
activation had reorders before and after.

Support for this is already provided by activation_kernel_ref implementation.

Related JIRA: CVS-28494
2020-05-27 05:37:38 +03:00
Gleb Kazantaev
6788153ba9 Updated convert_nms_to_nms_ie transformation to support dynamic shapes (#614) 2020-05-27 00:38:25 +03:00
Gleb Kazantaev
851f64946a Updated ConvertGatherToGatherIE transformation to support dynamic shapes (#611) 2020-05-27 00:38:04 +03:00
Evgeny Lazarev
c1625743df Change Elu a regular op since decomposition works extremely slowly (#582)
* Moved Elu operation from Fused to regular ones because the decomposition works extremely slowly.

* Added reference implementation for the Elu op
2020-05-26 21:59:08 +03:00
Evgenya Stepyreva
73f3b7c8fc [ MO ONNX ] TopK-1/10/11 proper extracting (#600) 2020-05-26 21:53:24 +03:00
Vitaliy Urusovskij
4a44f84dab [Stress] Updated test_configs with new path to OMZ mtcnn models (#602) 2020-05-26 20:11:46 +03:00
Ilya Lavrenov
bb039adef8 Fixed compilation with clang-10 + xcode (#521) 2020-05-26 17:17:36 +03:00
Shashwat Dalakoti
4943a954c7 Updated requiremnets.txt (#593)
Alignment with the requirements_tf.txt file
2020-05-26 16:19:43 +03:00
JunX
7595512d1f fix issue log print wrong origin image shape (#581) 2020-05-26 14:27:14 +03:00
Irina Efode
c3aa866a33 [IE CMAKE] FIX PATHS (#553)
* [IE CMAKE] FIX PATHS

* Fix problems
2020-05-26 11:57:02 +03:00
Ilya Churaev
42a8364cb6 Disable nGraph tests if ENABLE_TESTS=OFF (#579) 2020-05-26 11:51:47 +03:00
Gleb Kazantaev
d3764a7563 Updated Mul->Add conversion to support dynamic shapes (#512)
* Updated Mul Add conversion to support dynamic shapes

* Keep changes

* Fix for cases when eltwise performs broadcasting via Constant

* Added comments;Fixed eltwise shape infer; Updated tests
2020-05-26 10:24:52 +03:00
Roman Donchenko
e835a4cf58 MO: Flush after dumping the arguments to stdout (#570)
When stdout is not a terminal, Python will buffer it by default. This
means that a consumer of MO's output will not see the argument information
until the buffer is flushed, which will normally only happen once MO
finishes (which might take a while).

Flushing stdout explicitly allows the consumer to see this info as soon
as it's printed.
2020-05-26 07:44:25 +03:00
Gleb Kazantaev
d3923f2ce0 Update TopKIE operation and transform to support dynamic shapes (#526)
* Update TopKIE operation and transform to support dynamic shapes

* Fix TopKIE shape infer

* Updated TopKIE infer function

* Removed index_element_type; changed swtich with as_string<> method

* Fixed ieFuncTests

* Fixed convert_topk transformation

* Updated convert_topk transformations

* ngraph::copy_runtime_info(topk, new_ops);
2020-05-26 01:19:38 +03:00
Irina Efode
c6e03d73d8 [IE TESTS] Move old IE unit tests to the new infra (#544)
* [IE TESTS] Move ie_blob_proxy tests

* [IE TESTS] Move network serializer tests

* [IE TESTS] Move CNNNetwork tests to the IE func

* [IE TEST] Fix deprecation warnings

* Fix comments
2020-05-25 23:28:59 +03:00
Vladimir Paramuzov
0b23215b72 CODEOWNERS: added cpu/gpu developers teams (#540) 2020-05-25 21:54:54 +03:00
Konstantin Satunin
2f9fd74151 Use compute optimized VMs for CI (#567) 2020-05-25 21:31:57 +03:00
Maxim Vafin
8c8629a4af Support ONNX Clamp-11 (#538) 2020-05-25 19:59:07 +03:00
Ilya Churaev
04bb8ab51d Added case less check for enum names (#534)
* Added case less check for enum names

* Added <algorithm> header
2020-05-25 16:23:55 +03:00
Nikita Kudriavtsev
74e8b54ce3 [IE Myriad] Correct destruction order in functional tests with DISABLE_PLUGIN_CACHE env. variable (#542) 2020-05-25 15:45:59 +03:00
Evgenya Stepyreva
b6a05c232e [ MO TF ] IdentityN support (#529) 2020-05-25 10:52:58 +03:00
Alexander Zhogov
507c06c8bc Azure CI: Enable cpuFuncTests on Windows 2020-05-23 01:29:36 +03:00
Alexander Zhogov
244f4e9fe7 CODEOWNERS: Fix 2020-05-23 01:27:53 +03:00
Alexander Zhogov
43fdf32729 Fix MO CI job name (#520) 2020-05-23 00:24:05 +03:00
Alexander Zhogov
20c1755efc Update public CI (#514)
* Update public CI

* Add MO test check

* Disable cpuFuncTests on Windows
2020-05-22 23:34:26 +03:00
Alexey Suhov
0064c299c3 add plugin template (#515) 2020-05-22 22:34:00 +03:00
Irina Efode
2e3928071f Update CODEOWNERS using openvino-ie-tests-maintainers group (#519) 2020-05-22 22:17:06 +03:00
Irina Efode
f1aa573b79 Update CODEOWNERS (#518) 2020-05-22 21:37:03 +03:00
Irina Efode
acc311e6f9 [IE TESTS] Fix win func test issue (#508) 2020-05-22 21:19:28 +03:00
Evgeny Talanin
d006030ad3 Update codeowners 1 (#517)
* Fine-grained groups to CODEOWNERS at day 1

* Fix

* Fix ie-maintainers

Co-authored-by: Alexander Zhogov <alexander.zhogov@intel.com>
2020-05-22 21:18:54 +03:00
Ilya Lavrenov
fc899e6ceb Remove test artifact (#511) 2020-05-22 20:02:00 +03:00
Alexander Zhogov
a3d482035e Azure: Update job names, add cpuFuncTests (#509) 2020-05-22 17:47:05 +03:00
Alexey Suhov
ca9a78874a Remove Dimension::size_t and callers
(cherry-pick master commit 72fa20942a3f135ea2e324f47dd401506a913876)
2020-05-22 11:17:20 +03:00
azhogov
b8611139ca Update job name 2020-05-22 10:23:59 +03:00
Alexander Zhogov
6e2cfbca0c CODEOWNERS: Add Jenkinsfile 2020-05-22 10:09:47 +03:00
Alexander Zhogov
b36d0df477 CODEOWNERS: add tools 2020-05-22 10:06:33 +03:00
Alexey Suhov
ccb7438803 publish master branch snapshot, revision ea98a886d925eb152931aab13856e68037665562 2020-05-22 03:42:00 +03:00
Alexey Suhov
deb008a26f publish master branch snapshot, revision 8d31237e2c3f673cbb0f0ba110fc10f5cce1d2bb 2020-05-22 02:23:12 +03:00
Alexey Suhov
eab7ef4895 add submodules for mkl-dnn, gflags and gtest 2020-05-21 23:00:55 +03:00
Konstantin Satunin
778063e5cb fixed latest release 2020-05-21 17:27:44 +03:00
Alexey Suhov
d222c99ca7 add speech demo 2020-05-21 17:14:03 +03:00
Alexey Suhov
29d24c613a move dependencies to https://download.01.org/opencv/master 2020-05-21 15:00:31 +03:00
Alexey Suhov
f1b7a7292b update TBB and VPU binary dependencies 2020-05-20 22:02:34 +03:00
azhogov
ec2ca3e54f Azure: disable IE_Lin 2020-05-20 13:15:07 +03:00
Alexander Zhogov
6d56e824d2 Azure Pipelines: Set -j12 for Lin_self 2020-05-20 12:05:04 +03:00
Konstantin Satunin
7566e8202f Test Ubuntu 1804 VMSS 2020-05-20 11:46:09 +03:00
Alexey Suhov
f30dcc218c publish master branch snapshot, revision 9df5eb1f84e13a35720a918f88324561222ab114 2020-05-20 01:13:06 +03:00
Alexey Suhov
3ad0e4e434 remove ngraph submodule 2020-05-20 00:20:33 +03:00
Alexander Zhogov
4893f27fb9 Update How to Contribute 2020-05-19 19:08:14 +03:00
Alexander Zhogov
12f0fc72db Create CONTRIBUTING.md 2020-05-19 19:04:27 +03:00
Alexander Zhogov
6dd7ce89af Update CODEOWNERS 2020-05-19 14:42:35 +03:00
Andrey Babushkin
ed9cd78421 [ie/scripts/dependencies.bat] Fix unpack for opencv 2020-05-18 20:56:05 +03:00
Alexander Zhogov
eb57da7605 Azure Pipelines: Try -j12 for Win vmss 2020-05-18 20:38:27 +03:00
azhogov
5bc6a1e723 Azure: Try -j8 for Win vmss 2020-05-18 20:33:56 +03:00
Konstantin Satunin
76b3d2d47b Check VMSS 2020-05-18 20:10:29 +03:00
Alexey Suhov
dd0a195f2d fix BOM file for model optimizer 2020-05-18 19:20:16 +03:00
Alexey Suhov
3248c3002a Merge branch 'master' of https://github.com/openvinotoolkit/openvino 2020-05-18 18:29:42 +03:00
Alexander Zhogov
c78a575d23 Azure Pipelines: Check WIN_VMSS_VENV 2020-05-18 18:28:54 +03:00
Alexey Suhov
d22e5e8260 add execute permissions to run_code_checks.sh 2020-05-18 18:28:53 +03:00
Alexey Suhov
ba0a339888 publish master branch snapshot, revision 59af1853ca21ea08acf17b177da0b239753deb46 2020-05-18 17:21:58 +03:00
Alexander Zhogov
0a5a63bc0c Azure Pipelines: change pool for Win_self to WIN_VMSS 2020-05-18 16:02:40 +03:00
azhogov
32488a5c26 Fix VS2017 compilation issue: Intermediate channels count type changed to size_t
(cherry-pick master 0f6155ac3616fb2a7b51cfaddfdad1cc189f968d)
2020-05-18 13:17:10 +03:00
Alexander Zhogov
8081638bb5 Update README.md links 2020-05-16 10:49:12 +03:00
Alexander Zhogov
c50d41826d Azure Pipelines: disable nGraph GPU UT, LTO, Mac crashed UT 2020-05-15 19:16:28 +03:00
Alexander Zhogov
7b5887afba Azure Pipelines: disable nGraph GPU UT 2020-05-15 17:16:04 +03:00
Alexander Zhogov
54bb6b057f Create CODEOWNERS 2020-05-15 11:41:46 +03:00
Alexey Suhov
645641e87d add execute permissions to get_testdata.py 2020-05-14 23:17:54 +03:00
Alexey Suhov
3d63b13ba5 Revert LTO on Windows 2020-05-14 16:30:29 +03:00
Alexey Suhov
5b428f0655 publish master branch snapshot, revision 49482ae3bea0cbaa07474f86f36db11943142687 2020-05-13 21:12:22 +03:00
Alexander Zhogov
9d6501e9a6 Azure Pipelines: exclude failed Mac test fix 2020-05-11 14:59:09 +03:00
Alexander Zhogov
5b07298559 Azure Pipelines: exclude failed Mac test fix 2020-05-11 12:27:57 +03:00
Alexander Zhogov
3a0a7e79ff Azure Pipelines: exclude failed Mac test 2020-05-10 20:30:18 +03:00
Alexander Zhogov
11b84926d4 Azure Pipelines: exclude failed Mac test 2020-05-10 10:58:47 +03:00
Alexander Zhogov
112c58cc40 Azure Pipelines: set -j3 2020-05-08 18:40:14 +03:00
Andrey Babushkin
2430d96a3e Create .coveragerc 2020-05-06 23:38:42 +03:00
Alexey Suhov
64df940035 add scripts which download tests dependencies 2020-05-06 21:52:42 +03:00
Alexander Zhogov
67077e4aa7 Azure Pipelines: Update Mac options 2020-04-30 12:03:14 +03:00
Alexander Zhogov
5b009e9a38 Azure Pipelines: Fix test env on Windows 2020-04-30 01:30:33 +03:00
Andrey Babushkin
1bb752f1b8 Run pylint workflow on pull request events (#476)
Also remove pylint cmdline arguments to ignore import errors
2020-04-29 17:05:24 +03:00
Alexander Zhogov
5176df56dd Azure Pipelines: Fix test env 2020-04-29 15:34:04 +03:00
Alexander Zhogov
107d67e44d Azure Pipelines: exclude backend_api.config_unsupported from nGraph UT 2020-04-29 11:44:15 +03:00
Alexander Zhogov
833ff8b591 Add testdata to Azure Pipelines 2020-04-29 10:23:05 +03:00
Alexey Suhov
9314daeb3c fix NGRAPH_ONNX_IMPORT_ENABLE in cmake 2020-04-28 22:20:54 +03:00
Andrey Babushkin
aa2cb40f17 Add GitHub Actions workflow to run pylint against model optimizer (#474) 2020-04-28 18:41:12 +03:00
Alexander Zhogov
079e16c4d1 Update Azure Pipelines 2020-04-28 11:49:03 +03:00
Alexey Suhov
357cc7eb4c publish master branch snapshot, revision 0110d9c98fd7209589d06344f0d836f61d81f4b3 2020-04-27 21:21:29 +03:00
Alexander Zhogov
822692f526 Update Azure Pipelines 2020-04-17 12:37:19 +03:00
Alexander Zhogov
4ea5ac39fc Update Azure Pipelines 2020-04-16 20:52:03 +03:00
Alexey Suhov
67ac796715 Merge branch 'master' of https://github.com/opencv/dldt 2020-04-16 14:40:24 +03:00
Alexey Suhov
6300b1490d fixed BOM file for model optimizer 2020-04-16 14:38:57 +03:00
Alexander Zhogov
165c00fe6d Update Azure Pipelines 2020-04-16 13:54:47 +03:00
Alexander Zhogov
68bdd184ef Fix typo 2020-04-16 11:07:04 +03:00
Alexander Zhogov
56b67d7d1c Set up CI with Azure Pipelines 2020-04-16 11:02:27 +03:00
Alexey Suhov
ae03bda480 moved pylint configuration files 2020-04-15 21:46:27 +03:00
Alexey Suhov
127cbac5bc publish master branch snapshot, revision cdcab9d7ab48ffb0ee5629fabbfa06cb45debd9b 2020-04-15 19:01:57 +03:00
Alexey Suhov
95a57795dc Publishing 2020.2 content 2020-04-13 21:17:23 +03:00
Alexey Suhov
a347375d01 removed ie_rh_decoder.cmake from install target 2020-03-19 21:14:29 +03:00
Alexey Suhov
b2140c083a Publishing 2020.1 content 2020-02-11 22:48:49 +03:00
Alexey Suhov
949b74059f Merge pull request #296 from dkurt/patch-1
Do not build CMake from source
2020-02-10 21:08:40 +03:00
Alexey Suhov
651161be1c Merge pull request #378 from Danile71/2019
Fix error (libpng-0)
2020-02-06 19:38:41 +03:00
Daniel
f73852ea3d Fix error (libpng-0) 2020-02-06 16:07:14 +03:00
Alexey Suhov
b0c5accaf8 fixed link to Intel models and model downloader 2019-11-15 13:55:44 +03:00
Alexey Suhov
733dae46cc lower minimal cmake version to 3.5 2019-11-06 17:42:34 +03:00
Alexey Suhov
fe3f978b98 Merge pull request #309 from asuhov/2019-r31
Publishing 2019 R3.1 content
2019-10-28 21:34:43 +03:00
Alexey Suhov
6dfc778940 Publishing 2019 R3.1 content 2019-10-28 21:25:18 +03:00
Alexey Suhov
1798ac0d26 turned off cpplint by default 2019-10-24 17:39:17 +03:00
Dmitry Kurtaev
298900790c Do not build CMake from source 2019-10-22 10:32:43 +03:00
Alexey Suhov
1c794d971c Merge pull request #278 from asuhov/2019-r3
Publishing 2019 R3 content
2019-10-04 19:54:45 +03:00
Alexey Suhov
0923303e02 Publishing 2019 R3 content 2019-10-04 19:26:43 +03:00
Alexey Suhov
ba6e22b1b5 Publishing 2019 R2 content (#223) 2019-08-09 19:02:42 +03:00
Alexey Suhov
c585b530c1 replaced recommended stackoverflow dldt tag with openvino; removed outdated setup.py for python api (#195) 2019-06-27 21:01:22 +03:00
Alexey Suhov
693ab4e79a updated license headers in movidius sources (#163) 2019-05-28 15:40:53 +03:00
Alexey Suhov
0ef92871b6 Publishing 2019 R1.1 content and Myriad plugin sources (#162)
* Publishing 2019 R1.1 content and Myriad plugin sources
2019-05-27 21:18:32 +03:00
Alexey Suhov
e206d06f18 Publishing 2019 R1.0.1 content 2019-04-30 18:55:07 +03:00
Viacheslav Matveichev
b235c73481 Merge pull request #129 from asuhov/2019-r1
Publishing 2019 R1 content
2019-04-13 01:02:28 +03:00
Alexey Suhov
72660e9a4d Publishing 2019 R1 content 2019-04-12 18:25:53 +03:00
Dmitry Kurtaev
669bee86e5 Add a section of how to link IE with CMake project (#99) 2019-03-14 13:13:27 +03:00
Alexey Suhov
17e66dc5a6 Added unit tests and readme for model optimizer (#79)
* added unit tests
* added readme for model optimizer
* added a list of supported IE plugins
2019-01-23 20:23:27 +03:00
openvino-pushbot
30594bb309 Update readme 2019-01-21 23:30:11 +03:00
Alexey Suhov
9de27f16bc Publishing R5 content (#72)
* Publishing R5 content

* Updated ade revision

* updated readme

* add possibility to build CPU plugin with Intel MKL package
2019-01-21 21:31:31 +03:00
Alexey Suhov
fbc7a4a710 updated readme files (#54) 2018-12-14 21:26:38 +03:00
RachelRen05
e5d4940a0f update the dependency file to support ubuntu 18.04 (#17)
* update dependency file to support ubuntu 18.04

* update dependency file to support ubuntu 18.04
2018-12-14 21:09:44 +03:00
Alexey Suhov
3600f36d7b updated install_dependencies.sh and readme for python api (#43)
* use absolute path in readme for python api
* Update install_dependencies.sh
2018-11-29 21:04:21 +03:00
openvino-pushbot
91160e65cf Update README.md 2018-11-23 16:26:19 +03:00
Alexey Suhov
55a41d7570 Publishing R4 (#41)
* Publishing R4
2018-11-23 16:19:43 +03:00
Sergei Belousov
54eab18036 Update ie_api.pyx (#31)
Fix error: dldt/inference-engine/ie_bridges/python/inference_engine/ie_api.pyx:296:10: Signature not compatible with previous declaration
2018-11-22 21:01:04 +03:00
openvino-pushbot
e607ee7021 fixed scripts permissions 2018-10-16 20:52:11 +03:00
13717 changed files with 1605949 additions and 1173030 deletions

55
.github/workflows/mo.yml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: MO
on:
push:
paths:
- 'model-optimizer/**'
pull_request:
paths:
- 'model-optimizer/**'
jobs:
Pylint-UT:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- 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('model-optimizer/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 Pylint
pip install tensorflow==1.14.0 tensorboard==1.14.0 tensorflow-estimator==1.14.0
# For UT
pip install unittest-xml-reporting==3.0.2
# MO requirements
pip install -r requirements.txt
pip install -r requirements_dev.txt
working-directory: model-optimizer
- name: Pylint
run: pylint -d C,R,W mo/ mo.py extensions/
working-directory: model-optimizer
- 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: model-optimizer

384
.gitignore vendored
View File

@@ -1,343 +1,71 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# build/artifact dirs
_*
# but ensure we don't skip __init__.py
!__init__.py
# 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
# developer tools
*.idea
.vscode
cmake-build-*
.DS_Store
# 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/
doc/
.dir-locals.el
GTAGS
GPATH
GRTAGS
GSYMS
**/tags
compile_commands.json
service/dot-net-service/Output
**/sublime_build
/.project
.vscode/
/vsx32
/service/dot-net-service/.klocwork/DotNetService
cmake-build-*/
/lin64
.gdb_history
bin/
build/
.local_vimrc
.ycm_extra_conf.py
tags
.gdb_history
.vimspector.json
doc/
!ngraph/doc
docs/build_documentation/work_dir/
inference-engine/plugins/
inference-engine/temp
inference-engine/report
.repo/
docs/template_plugin/html/
CMakeLists.txt.user
docs/IE_PLUGIN_DG/html/
# from Model Optimizer repo
.idea
.project
.cproject
.pydevproject
.settings
/bin/
/gen/
*.project
*.cproject
*.pydevproject
*.settings
*/gen/
__pycache__
*.swp
/config.xml
# Python-specific
.env3
*.env3
*.pyc
# Tests-specific
.coverage
htmlcov
pylint_report.txt
pylint_report_comments.txt
# Documentation-generated
docs/build
docs/source/_static
docs/source/_templates
docs/source/generated/
*.coverage
*htmlcov
*pylint_report.txt
*pylint_report_comments.txt
# Artifacts
/*.bin
/*.xml
/*.json
/*.so
/*.txt
/*.mapping
/*.dat
/*.svg
/model-optimizer/*.bin
/model-optimizer/*.xml
/model-optimizer/*.json
/model-optimizer/*.so
/model-optimizer/*.txt
/model-optimizer/*.pb
/model-optimizer/*.pbtxt
/model-optimizer/!CMakeLists.txt
/model-optimizer/*.mapping
/model-optimizer/*.dat
/model-optimizer/*.svg
# ngraph
ngraph/src/CPackConfig.cmake
ngraph/src/CPackSourceConfig.cmake
ngraph/src/VERSION
ngraph/src/gtest/
ngraph/src/json/
ngraph/src/ngraphConfig.cmake
ngraph/src/ngraphConfigVersion.cmake
ngraph/src/protobuf/
ngraph/src/src/
ngraph/src/test/

16
.gitmodules vendored Normal file
View File

@@ -0,0 +1,16 @@
[submodule "inference-engine/thirdparty/ade"]
path = inference-engine/thirdparty/ade
url = https://github.com/opencv/ade.git
ignore = dirty
[submodule "inference-engine/thirdparty/mkl-dnn"]
path = inference-engine/thirdparty/mkl-dnn
url = https://github.com/openvinotoolkit/oneDNN.git
ignore = dirty
[submodule "inference-engine/tests/ie_test_utils/common_test_utils/gtest"]
path = inference-engine/tests/ie_test_utils/common_test_utils/gtest
url = https://github.com/openvinotoolkit/googletest.git
ignore = dirty
[submodule "inference-engine/samples/thirdparty/gflags"]
path = inference-engine/samples/thirdparty/gflags
url = https://github.com/gflags/gflags.git
ignore = dirty

163
CMakeLists.txt Normal file
View File

@@ -0,0 +1,163 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
cmake_policy(SET CMP0054 NEW)
# TODO: for make instal / package we need to use 3.13.3 version because
# it allows to install targets created outside of current projects
# See https://blog.kitware.com/cmake-3-13-0-available-for-download/
if (APPLE)
if(CMAKE_GENERATOR STREQUAL "Xcode")
# due to https://gitlab.kitware.com/cmake/cmake/issues/14254
cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
else()
# due to https://cmake.org/cmake/help/v3.12/policy/CMP0068.html
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
endif()
else()
cmake_minimum_required(VERSION 3.7.2 FATAL_ERROR)
endif()
project(OpenVINO)
set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(IE_MAIN_SOURCE_DIR ${OpenVINO_MAIN_SOURCE_DIR}/inference-engine)
list(APPEND CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake")
include(CTest)
include(features)
# include developer package
include(developer_package)
# These options are shared with 3rdparty plugins
# by means of developer package
include(check_features)
include(dependencies)
# resolving dependencies for the project
message (STATUS "PROJECT ............................... " ${PROJECT_NAME})
message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
message (STATUS "OpenVINO_MAIN_SOURCE_DIR .............. " ${OpenVINO_MAIN_SOURCE_DIR})
message (STATUS "IE_MAIN_SOURCE_DIR .................... " ${IE_MAIN_SOURCE_DIR})
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID})
message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE})
# remove file with exported developer targets to force its regeneration
file(REMOVE "${CMAKE_BINARY_DIR}/targets_developer.cmake")
file(REMOVE "${CMAKE_BINARY_DIR}/targets.cmake")
function(build_ngraph)
function(ngraph_set option value)
if(NOT DEFINED ${option})
set(${option} ${value} CACHE BOOL "" FORCE)
endif()
endfunction()
set(NGRAPH_BUILD_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE STRING "" FORCE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OpenVINO_MAIN_SOURCE_DIR}/ngraph/cmake/Modules/")
if (ENABLE_SANITIZER)
ngraph_set(NGRAPH_ADDRESS_SANITIZER TRUE)
else ()
ngraph_set(NGRAPH_ADDRESS_SANITIZER FALSE)
endif ()
ngraph_set(NGRAPH_PYTHON_BUILD_ENABLE FALSE)
if (NOT ANDROID)
if(ENABLE_TESTS)
ngraph_set(NGRAPH_UNIT_TEST_ENABLE TRUE)
ngraph_set(NGRAPH_IE_ENABLE TRUE)
else()
ngraph_set(NGRAPH_UNIT_TEST_ENABLE FALSE)
ngraph_set(NGRAPH_IE_ENABLE FALSE)
endif()
ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE TRUE)
else()
ngraph_set(NGRAPH_UNIT_TEST_ENABLE FALSE)
ngraph_set(NGRAPH_TEST_UTIL_ENABLE FALSE)
ngraph_set(NGRAPH_IE_ENABLE FALSE)
ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE FALSE)
endif()
ngraph_set(NGRAPH_INTERPRETER_ENABLE TRUE)
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
ie_add_compiler_flags(-Wno-error=uninitialized -Wno-error=literal-conversion)
elseif(UNIX)
ie_add_compiler_flags(-Wno-error=maybe-uninitialized -Wno-error=return-type -fPIC)
endif()
if(ANDROID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=defaulted-function-deleted -Wno-error=unused-command-line-argument")
endif()
# WA for GCC 7.0
if (UNIX)
ie_add_compiler_flags(-Wno-error=return-type -Wno-undef)
elseif(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4308 /wd4146 /wd4703 /wd4244 /wd4819")
endif()
if(ENABLE_LTO)
ie_enable_lto()
endif()
ie_cpack_add_component(ngraph)
set(SDL_cmake_included ON)
# set(NGRAPH_COMPONENT_PREFIX "deployment_tools/ngraph/")
add_subdirectory(ngraph)
set(NGRAPH_LIBRARIES ngraph PARENT_SCOPE)
endfunction()
build_ngraph()
add_subdirectory(inference-engine)
add_subdirectory(docs)
# cpack
# install setupvars
ie_cpack_add_component(setupvars REQUIRED)
if(UNIX)
install(PROGRAMS scripts/setupvars/setupvars.sh
DESTINATION bin
COMPONENT setupvars)
elseif(WIN32)
install(PROGRAMS scripts/setupvars/setupvars.bat
DESTINATION bin
COMPONENT setupvars)
endif()
# install install_dependencies
if(UNIX)
ie_cpack_add_component(install_dependencies REQUIRED)
install(DIRECTORY scripts/install_dependencies/
DESTINATION install_dependencies
COMPONENT install_dependencies)
endif()
# install files for demo
ie_cpack_add_component(demo_scripts REQUIRED DEPENDS core)
if(UNIX)
install(DIRECTORY scripts/demo/
DESTINATION deployment_tools/demo
COMPONENT demo_scripts
USE_SOURCE_PERMISSIONS
PATTERN *.bat EXCLUDE)
elseif(WIN32)
install(DIRECTORY scripts/demo/
DESTINATION deployment_tools/demo
COMPONENT demo_scripts
USE_SOURCE_PERMISSIONS
PATTERN *.sh EXCLUDE)
endif()
ie_cpack(${IE_CPACK_COMPONENTS_ALL})

66
CODEOWNERS Normal file
View File

@@ -0,0 +1,66 @@
# 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
azure-pipelines.yml @openvinotoolkit/openvino-admins
/.github/ @openvinotoolkit/openvino-admins
# QA Tests:
/tests/ @openvinotoolkit/openvino-tests-maintainers
# IE Core:
/inference-engine/ @openvinotoolkit/openvino-ie-maintainers
/inference-engine/src/transformations/ @GlebKazantaev @ichuraev
/inference-engine/src/legacy_api/ @openvinotoolkit/openvino-ngraph-maintainers
/inference-engine/src/readers/ @openvinotoolkit/openvino-ngraph-maintainers
# IE CPU:
/inference-engine/src/mkldnn_plugin/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers
/inference-engine/src/low_precision_transformations/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers
/inference-engine/thirdparty/mkl-dnn/ @openvinotoolkit/openvino-ie-cpu-maintainers @openvinotoolkit/openvino-ie-cpu-developers
# IE GPU:
/inference-engine/src/cldnn_engine/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers
/inference-engine/include/gpu/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers
/inference-engine/include/cldnn/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers
/inference-engine/thirdparty/clDNN/ @openvinotoolkit/openvino-ie-gpu-maintainers @openvinotoolkit/openvino-ie-gpu-developers
# IE VPU:
/inference-engine/src/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers
/inference-engine/include/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers
/inference-engine/thirdparty/movidius/ @openvinotoolkit/openvino-ie-vpu-maintainers
/inference-engine/tests_deprecated/unit/engines/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
/inference-engine/tests_deprecated/functional/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
/inference-engine/tests_deprecated/behavior/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
/inference-engine/tests/functional/plugin/myriad/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
/inference-engine/tests/unit/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
/inference-engine/tests/unit/engines/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers @openvinotoolkit/openvino-ie-tests-maintainers
/inference-engine/tools/vpu/ @openvinotoolkit/openvino-ie-vpu-maintainers
/inference-engine/scripts/run_tests_myriad_multistick.sh @openvinotoolkit/openvino-ie-vpu-maintainers
# IE GNA:
/inference-engine/src/gna_plugin/ @openvinotoolkit/openvino-ie-gna-maintainers
/inference-engine/include/gna/ @openvinotoolkit/openvino-ie-gna-maintainers
# IE MULTI:
/inference-engine/src/multi_device/ @openvinotoolkit/openvino-ie-multi-maintainers
/inference-engine/include/multi-device/ @openvinotoolkit/openvino-ie-multi-maintainers
# IE Tests:
/inference-engine/tests/ @openvinotoolkit/openvino-ie-tests-maintainers
/inference-engine/tests_deprecated/ @openvinotoolkit/openvino-ie-tests-maintainers
/inference-engine/tests/functional/inference_engine/ngraph_reader/ @openvinotoolkit/openvino-ie-tests-maintainers @openvinotoolkit/openvino-ngraph-maintainers
/inference-engine/tests/functional/inference_engine/transformations/ @openvinotoolkit/openvino-ie-tests-maintainers @openvinotoolkit/openvino-ngraph-maintainers
# MO:
/model-optimizer/ @openvinotoolkit/openvino-mo-maintainers
# nGraph:
/ngraph/ @openvinotoolkit/openvino-ngraph-maintainers
# Tools
/tools/ @openvinotoolkit/openvino-tools-maintainers

18
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,18 @@
# How to Contribute
We welcome community contributions to the OpenVINO™ 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 relevant unit tests and one or more sample
* Submit a pull request at https://github.com/openvinotoolkit/openvino/pulls
## OpenVINO™ Coding Style Guide
We basically use the Google style (https://google.github.io/styleguide/cppguide.html) with some exceptions:
* 4 spaces instead of 2 spaces for indentations
* Limitation of 160 symbols for the line length
* Exceptions are allowed
* Using namespace are allowed in cpp and prohibited in headers
* Underscore symbol before member in classes/structures
* thisStyleForFunctions()
* theSameStyleForVariables

10
Jenkinsfile vendored Executable file
View File

@@ -0,0 +1,10 @@
#!groovy
properties([
parameters([
booleanParam(defaultValue: true,
description: 'Cancel the rest of parallel stages if one of them fails and return status immediately',
name: 'failFast')
])
])
dldtPipelineEntrypoint(this)

View File

@@ -1,37 +1,48 @@
# [OpenVINO™ Toolkit](https://01.org/openvinotoolkit) - Deep Learning Deployment Toolkit repository
[![Stable release](https://img.shields.io/badge/version-2018.R3-green.svg)](https://github.com/opencv/dldt/releases/tag/2018_R3)
[![Stable release](https://img.shields.io/badge/version-2020.4-green.svg)](https://github.com/openvinotoolkit/openvino/releases/tag/2020.4.0)
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
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 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*.
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® 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\*.
## Repository components:
* [Inference Engine](https://software.intel.com/en-us/articles/OpenVINO-InferEngine)
* [Model Optimizer](https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer)
* [Inference Engine]
* [Model Optimizer]
## 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.
## Documentation
* [OpenVINO™ Release Notes](https://software.intel.com/en-us/articles/OpenVINO-RelNotes)
* Inference Engine [build instructions](inference-engine/README.md)
* [OpenVINO™ Inference Engine Build Instructions](build-instruction.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.
See [CONTRIBUTING](./CONTRIBUTING.md) for details. Thank you!
## Support
Please report questions, issues and suggestions using:
* [\#dldt](https://stackoverflow.com/search?q=%23dldt) tag on StackOverflow*
* [GitHub* Issues](https://github.com/opencv/dldt/issues)
* The `openvino` [tag on StackOverflow]\*
* [GitHub* Issues](https://github.com/openvinotoolkit/openvino/issues)
* [Forum](https://software.intel.com/en-us/forums/computer-vision)
---
\* Other names and brands may be claimed as the property of others.
\* Other names and brands may be claimed as the property of others.
[Open Model Zoo]:https://github.com/opencv/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
[tag on StackOverflow]:https://stackoverflow.com/search?q=%23openvino

333
azure-pipelines.yml Normal file
View File

@@ -0,0 +1,333 @@
jobs:
- job: Lin
# About 150% of total time
timeoutInMinutes: 75
pool:
#vmImage: 'ubuntu-18.04'
name: LIN_VMSS_VENV_F8S_WU2
variables:
BUILD_TYPE: Release
BIN_DIR: ../bin/intel64/$(BUILD_TYPE)
steps:
- script: |
whoami
uname -a
which python3
gcc --version
lsb_release
env
cat /proc/cpuinfo
cat /proc/meminfo
vmstat -s
df
displayName: 'System properties'
- script: |
sudo apt --assume-yes install libusb-1.0-0-dev
python3 -m pip install -r ./inference-engine/ie_bridges/python/requirements.txt
# For running Python API tests
python3 -m pip install -r ./inference-engine/ie_bridges/python/src/requirements-dev.txt
displayName: 'Install dependencies'
- script: |
wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip
unzip ninja-linux.zip
sudo cp -v ninja /usr/local/bin/
displayName: 'Install Ninja'
- script: git submodule update --init --recursive --jobs 8
displayName: 'Clone submodules'
- script: |
mkdir dldt-build
cd dldt-build
displayName: 'Create build directory'
- task: CMake@1
inputs:
workingDirectory: dldt-build
# 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.6 -DENABLE_TESTS=ON
- script: ninja
workingDirectory: dldt-build
displayName: 'Build Lin'
- script: ls -alR ../bin/
workingDirectory: dldt-build
displayName: 'List files'
- script: $(BIN_DIR)/unit-test --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU*
workingDirectory: dldt-build
displayName: 'nGraph UT'
continueOnError: false
- script: $(BIN_DIR)/InferenceEngineUnitTests
workingDirectory: dldt-build
displayName: 'IE UT old'
continueOnError: false
- script: $(BIN_DIR)/ieUnitTests
workingDirectory: dldt-build
displayName: 'IE UT'
continueOnError: false
- script: $(BIN_DIR)/cpuUnitTests
workingDirectory: dldt-build
displayName: 'CPU UT'
continueOnError: false
- script: $(BIN_DIR)/gnaUnitTests
workingDirectory: dldt-build
displayName: 'GNA UT'
continueOnError: false
- script: $(BIN_DIR)/vpuUnitTests
workingDirectory: dldt-build
displayName: 'VPU UT'
continueOnError: false
- script: $(BIN_DIR)/ieFuncTests
workingDirectory: dldt-build
displayName: 'IE FuncTests'
continueOnError: false
- script: $(BIN_DIR)/cpuFuncTests
workingDirectory: dldt-build
displayName: 'CPU FuncTests'
continueOnError: false
- script: $(BIN_DIR)/MklDnnBehaviorTests
workingDirectory: dldt-build
displayName: 'MklDnnBehaviorTests'
continueOnError: false
- script: git clone https://github.com/openvinotoolkit/testdata.git
displayName: 'Clone testdata'
- script: |
export DATA_PATH=`pwd`/../testdata
export MODELS_PATH=`pwd`/../testdata
$(BIN_DIR)/MklDnnFunctionalTests --gtest_filter=*smoke*:-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric*
workingDirectory: dldt-build
displayName: 'MklDnnFunctionalTests'
continueOnError: false
- script: |
export DATA_PATH=`pwd`/../testdata
export MODELS_PATH=`pwd`/../testdata
$(BIN_DIR)/InferenceEngineCAPITests
workingDirectory: dldt-build
displayName: 'IE CAPITests'
continueOnError: false
- script: |
export DATA_PATH=`pwd`/../testdata
export MODELS_PATH=`pwd`/../testdata
export LD_LIBRARY_PATH=`pwd`/$(BIN_DIR)/lib
export PYTHONPATH=`pwd`/$(BIN_DIR)/lib/python_api/python3.6
env
cd ../inference-engine/ie_bridges/python/tests
pytest
workingDirectory: dldt-build
displayName: 'Python API Tests'
continueOnError: false
enabled: false
- job: Mac
# About 200% of total time (perfomace of Mac hosts is unstable)
timeoutInMinutes: 180
pool:
vmImage: 'macOS-10.15'
variables:
BUILD_TYPE: Release
BIN_DIR: ../bin/intel64/$(BUILD_TYPE)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
- script: |
whoami
uname -a
which python3
gcc --version
xcrun --sdk macosx --show-sdk-version
env
sysctl -a
displayName: 'System properties'
- script: |
brew install cython
brew install automake
displayName: 'Install dependencies'
- script: brew install ninja
displayName: 'Install Ninja'
- script: git submodule update --init --recursive --jobs 8
displayName: 'Clone submodules'
- script: |
mkdir dldt-build
cd dldt-build
displayName: 'Create build directory'
- script: |
export PATH="/usr/local/opt/cython/bin:$PATH"
export CC=gcc
export CXX=g++
# Disable errors with Ninja
export CXXFLAGS="-Wno-error=unused-command-line-argument"
export CFLAGS="-Wno-error=unused-command-line-argument"
cmake .. -GNinja -DVERBOSE_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_PYTHON=ON -DENABLE_TESTS=ON
workingDirectory: dldt-build
displayName: 'CMake'
- script: ninja
workingDirectory: dldt-build
displayName: 'Build Mac'
- script: ls -alR ../bin/
workingDirectory: dldt-build
displayName: 'List files'
- script: $(BIN_DIR)/unit-test --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU*:IE_CPU.onnx_model_sigmoid
workingDirectory: dldt-build
displayName: 'nGraph UT'
continueOnError: false
- script: $(BIN_DIR)/InferenceEngineUnitTests
workingDirectory: dldt-build
displayName: 'IE UT old'
continueOnError: false
- script: $(BIN_DIR)/ieUnitTests
workingDirectory: dldt-build
displayName: 'IE UT'
continueOnError: false
- script: $(BIN_DIR)/cpuUnitTests
workingDirectory: dldt-build
displayName: 'CPU UT'
continueOnError: false
- script: $(BIN_DIR)/vpuUnitTests
workingDirectory: dldt-build
displayName: 'VPU UT'
continueOnError: false
- script: $(BIN_DIR)/ieFuncTests
workingDirectory: dldt-build
displayName: 'IE FuncTests'
continueOnError: false
- script: $(BIN_DIR)/cpuFuncTests
workingDirectory: dldt-build
displayName: 'CPU FuncTests'
continueOnError: false
- script: $(BIN_DIR)/MklDnnBehaviorTests
workingDirectory: dldt-build
displayName: 'MklDnnBehaviorTests'
continueOnError: false
- script: git clone https://github.com/openvinotoolkit/testdata.git
displayName: 'Clone testdata'
- script: |
export DATA_PATH=`pwd`/../testdata
export MODELS_PATH=`pwd`/../testdata
$(BIN_DIR)/MklDnnFunctionalTests --gtest_filter=*smoke*:-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric*
workingDirectory: dldt-build
displayName: 'MklDnnFunctionalTests'
continueOnError: false
- script: |
export DATA_PATH=`pwd`/../testdata
export MODELS_PATH=`pwd`/../testdata
$(BIN_DIR)/InferenceEngineCAPITests
workingDirectory: dldt-build
displayName: 'IE CAPITests'
continueOnError: false
- job: Win
# About 150% of total time
timeoutInMinutes: 120
pool:
#vmImage: 'vs2017-win2016'
name: WIN_VMSS_VENV_F8S_WU2
variables:
BUILD_TYPE: Release
BUILD_DIR: D:\dldt-build
BIN_DIR: ..\bin\intel64
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
steps:
- script: |
where python3
wmic computersystem get TotalPhysicalMemory
wmic cpu list
wmic logicaldisk get description,name
wmic VOLUME list
set
displayName: 'System properties'
- script: |
certutil -urlcache -split -f https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip ninja-win.zip
powershell -command "Expand-Archive -Force ninja-win.zip"
displayName: Install Ninja
- script: git submodule update --init --recursive --jobs 8
displayName: 'Clone submodules'
- script: |
rd /Q /S $(BUILD_DIR)
mkdir $(BUILD_DIR)\bin
rd /Q /S dldt-build
mkdir dldt-build
displayName: 'Create build directory'
- script: |
set PATH=$(Build.Repository.LocalPath)\ninja-win;%PATH%
call "$(MSVS_VARS_PATH)" && cmake -GNinja -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_TESTS=ON -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(Build.Repository.LocalPath)
workingDirectory: $(BUILD_DIR)
displayName: 'CMake'
- script: |
set PATH=$(Build.Repository.LocalPath)\ninja-win;%PATH%
call "$(MSVS_VARS_PATH)" && ninja
workingDirectory: $(BUILD_DIR)
displayName: 'Build Win'
- script: dir ..\bin\ /s /b
workingDirectory: dldt-build
displayName: 'List files'
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\unit-test --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU*
workingDirectory: dldt-build
displayName: 'nGraph UT'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\InferenceEngineUnitTests
workingDirectory: dldt-build
displayName: 'IE UT old'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\ieUnitTests
workingDirectory: dldt-build
displayName: 'IE UT'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\cpuUnitTests
workingDirectory: dldt-build
displayName: 'CPU UT'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\gnaUnitTests
workingDirectory: dldt-build
displayName: 'GNA UT'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\vpuUnitTests
workingDirectory: dldt-build
displayName: 'VPU UT'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\ieFuncTests
workingDirectory: dldt-build
displayName: 'IE FuncTests'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\cpuFuncTests
workingDirectory: dldt-build
displayName: 'CPU FuncTests'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\MklDnnBehaviorTests
workingDirectory: dldt-build
displayName: 'MklDnnBehaviorTests'
continueOnError: false
- script: git clone https://github.com/openvinotoolkit/testdata.git
workingDirectory: $(BUILD_DIR)
displayName: 'Clone testdata'
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;$(Build.Repository.LocalPath)\inference-engine\temp\opencv_4.3.0\opencv\bin;%PATH%
set DATA_PATH=$(BUILD_DIR)\testdata
set MODELS_PATH=$(BUILD_DIR)\testdata
$(BIN_DIR)\MklDnnFunctionalTests --gtest_filter=*smoke*:-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric*
workingDirectory: dldt-build
displayName: 'MklDnnFunctionalTests'
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;$(Build.Repository.LocalPath)\inference-engine\temp\opencv_4.3.0\opencv\bin;%PATH%
set DATA_PATH=$(BUILD_DIR)\testdata
set MODELS_PATH=$(BUILD_DIR)\testdata
$(BIN_DIR)\InferenceEngineCAPITests
workingDirectory: dldt-build
displayName: 'IE CAPITests'
continueOnError: false

704
build-instruction.md Normal file
View File

@@ -0,0 +1,704 @@
# Build OpenVINO™ Inference Engine
## Contents
- [Introduction](#introduction)
- [Build on Linux\* Systems](#build-on-linux-systems)
- [Software Requirements](#software-requirements)
- [Build Steps](#build-steps)
- [Additional Build Options](#additional-build-options)
- [Build for Raspbian* Stretch OS](#build-for-raspbian-stretch-os)
- [Hardware Requirements](#hardware-requirements)
- [Native Compilation](#native-compilation)
- [Cross Compilation Using Docker\*](#cross-compilation-using-docker)
- [Additional Build Options](#additional-build-options-1)
- [Build on Windows* Systems](#build-on-windows-systems)
- [Software Requirements](#software-requirements-1)
- [Build Steps](#build-steps-1)
- [Additional Build Options](#additional-build-options-2)
- [Building Inference Engine with Ninja* Build System](#building-inference-engine-with-ninja-build-system)
- [Build on macOS\* Systems](#build-on-macos-systems)
- [Software Requirements](#software-requirements-2)
- [Build Steps](#build-steps-2)
- [Additional Build Options](#additional-build-options-3)
- [Build on Android\* Systems](#build-on-android-systems)
- [Software Requirements](#software-requirements-3)
- [Build Steps](#build-steps-3)
- [Use Custom OpenCV Builds for Inference Engine](#use-custom-opencv-builds-for-inference-engine)
- [Add Inference Engine to Your Project](#add-inference-engine-to-your-project)
- [(Optional) Additional Installation Steps for the Intel® Movidius™ Neural Compute Stick and Neural Compute Stick 2](#optional-additional-installation-steps-for-the-intel-movidius-neural-compute-stick-and-neural-compute-stick-2)
- [For Linux, Raspbian Stretch* OS](#for-linux-raspbian-stretch-os)
- [Next Steps](#next-steps)
- [Additional Resources](#additional-resources)
## Introduction
The Inference Engine can infer models in different formats with various input
and output formats.
The open source version of Inference Engine includes the following plugins:
| PLUGIN | DEVICE TYPES |
| ---------------------| -------------|
| CPU plugin | Intel® Xeon® with Intel® AVX2 and AVX512, Intel® Core™ Processors with Intel® AVX2, Intel® Atom® Processors with Intel® SSE |
| GPU plugin | Intel® Processor Graphics, including Intel® HD Graphics and Intel® Iris® Graphics |
| GNA plugin | Intel® Speech Enabling Developer Kit, Amazon Alexa\* Premium Far-Field Developer Kit, Intel® Pentium® Silver processor J5005, Intel® Celeron® processor J4005, Intel® Core™ i3-8121U processor |
| MYRIAD plugin | Intel® Movidius™ Neural Compute Stick powered by the Intel® Movidius™ Myriad™ 2, Intel® Neural Compute Stick 2 powered by the Intel® Movidius™ Myriad™ X |
| Heterogeneous plugin | Heterogeneous plugin enables computing for inference on one network on several Intel® devices. |
Inference Engine plugin for Intel® FPGA is distributed only in a binary form,
as a part of [Intel® Distribution of OpenVINO™].
## Build on Linux\* Systems
The software was validated on:
- Ubuntu\* 18.04 (64-bit) with default GCC\* 7.5.0
- Ubuntu\* 16.04 (64-bit) with default GCC\* 5.4.0
- CentOS\* 7.4 (64-bit) with default GCC\* 4.8.5
### Software Requirements
- [CMake]\* 3.11 or higher
- GCC\* 4.8 or higher to build the Inference Engine
- Python 3.5 or higher for Inference Engine Python API wrapper
- (Optional) [Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 19.41.14441].
### Build Steps
1. Clone submodules:
```sh
cd openvino
git submodule update --init --recursive
```
2. Install build dependencies using the `install_dependencies.sh` script in the
project root folder.
```sh
chmod +x install_dependencies.sh
```
```sh
./install_dependencies.sh
```
3. By default, the build enables the Inference Engine GPU plugin to infer models
on your Intel® Processor Graphics. This requires you to
[Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 19.41.14441]
before running the build. If you don't want to use the GPU plugin, use the
`-DENABLE_CLDNN=OFF` CMake build option and skip the installation of the
Intel® Graphics Compute Runtime for OpenCL™ Driver.
4. Create a build folder:
```sh
mkdir build && cd build
```
5. Inference Engine uses a CMake-based build system. In the created `build`
directory, run `cmake` to fetch project dependencies and create Unix
makefiles, then run `make` to build the project:
```sh
cmake -DCMAKE_BUILD_TYPE=Release ..
make --jobs=$(nproc --all)
```
### Additional Build Options
You can use the following additional build options:
- The default build uses an internal JIT GEMM implementation.
- To switch to an OpenBLAS\* implementation, use the `GEMM=OPENBLAS` option with
`BLAS_INCLUDE_DIRS` and `BLAS_LIBRARIES` CMake options to specify a path to the
OpenBLAS headers and library. For example, the following options on CentOS\*:
`-DGEMM=OPENBLAS -DBLAS_INCLUDE_DIRS=/usr/include/openblas -DBLAS_LIBRARIES=/usr/lib64/libopenblas.so.0`.
- To switch to the optimized MKL-ML\* GEMM implementation, use `-DGEMM=MKL`
and `-DMKLROOT=<path_to_MKL>` CMake options to specify a path to unpacked
MKL-ML with the `include` and `lib` folders. MKL-ML\* package can be downloaded
from the Intel® [MKL-DNN repository].
- Threading Building Blocks (TBB) is used by default. To build the Inference
Engine with OpenMP\* threading, set the `-DTHREADING=OMP` option.
- Required versions of TBB and OpenCV packages are downloaded automatically by
the CMake-based script. If you want to use the automatically downloaded
packages but you already have installed TBB or OpenCV packages configured in
your environment, you may need to clean the `TBBROOT` and `OpenCV_DIR`
environment variables before running the `cmake` command, otherwise they
will not be downloaded and the build may fail if incompatible versions were
installed.
- If the CMake-based build script can not find and download the OpenCV package
that is supported on your platform, or if you want to use a custom build of
the OpenCV library, refer to the
[Use Custom OpenCV Builds](#use-custom-opencv-builds-for-inference-engine)
section for details.
- To build the Python API wrapper:
1. Install all additional packages listed in the
`/inference-engine/ie_bridges/python/requirements.txt` file:
```sh
pip install -r requirements.txt
```
2. Use the `-DENABLE_PYTHON=ON` option. To specify an exact Python version, use the following
options:
```
-DPYTHON_EXECUTABLE=`which python3.7` \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.7
```
- To switch the CPU and GPU plugins off/on, use the `cmake` options
`-DENABLE_MKL_DNN=ON/OFF` and `-DENABLE_CLDNN=ON/OFF` respectively.
- nGraph-specific compilation options:
`-DNGRAPH_ONNX_IMPORT_ENABLE=ON` enables the building of the nGraph ONNX importer.
`-DNGRAPH_JSON_ENABLE=ON` enables nGraph JSON-based serialization.
`-DNGRAPH_DEBUG_ENABLE=ON` enables additional debug prints.
## Build for Raspbian Stretch* OS
> **NOTE**: Only the MYRIAD plugin is supported.
### Hardware Requirements
* Raspberry Pi\* 2 or 3 with Raspbian\* Stretch OS (32-bit). Check that it's CPU supports ARMv7 instruction set (`uname -m` command returns `armv7l`).
> **NOTE**: Despite the Raspberry Pi\* CPU is ARMv8, 32-bit OS detects ARMv7 CPU instruction set. The default `gcc` compiler applies ARMv6 architecture flag for compatibility with lower versions of boards. For more information, run the `gcc -Q --help=target` command and refer to the description of the `-march=` option.
You can compile the Inference Engine for Raspberry Pi\* in one of the two ways:
* [Native Compilation](#native-compilation), which is the simplest way, but time-consuming
* [Cross Compilation Using Docker*](#cross-compilation-using-docker), which is the recommended way
### Native Compilation
Native compilation of the Inference Engine is the most straightforward solution. However, it might take at least one hour to complete on Raspberry Pi\* 3.
1. Install dependencies:
```bash
sudo apt-get update
sudo apt-get install -y git cmake libusb-1.0-0-dev
```
2. Go to the cloned `openvino` repository:
```bash
cd openvino
```
3. Initialize submodules:
```bash
git submodule update --init --recursive
```
4. Create a build folder:
```bash
mkdir build && cd build
```
5. Build the Inference Engine:
```bash
cmake -DCMAKE_BUILD_TYPE=Release \
-DENABLE_SSE42=OFF \
-DTHREADING=SEQ \
-DENABLE_GNA=OFF .. && make
```
### Cross Compilation Using Docker*
This compilation was tested on the following configuration:
* Host: Ubuntu\* 18.04 (64-bit, Intel® Core™ i7-6700K CPU @ 4.00GHz × 8)
* Target: Raspbian\* Stretch (32-bit, ARMv7, Raspberry Pi\* 3)
1. Install Docker\*:
```bash
sudo apt-get install -y docker.io
```
2. Add a current user to `docker` group:
```bash
sudo usermod -a -G docker $USER
```
Log out and log in for this to take effect.
3. Create a directory named `ie_cross_armhf` and add a text file named `Dockerfile`
with the following content:
```docker
FROM debian:stretch
USER root
RUN dpkg --add-architecture armhf && \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
crossbuild-essential-armhf \
git \
wget \
libusb-1.0-0-dev:armhf \
libgtk-3-dev:armhf \
libavcodec-dev:armhf \
libavformat-dev:armhf \
libswscale-dev:armhf \
libgstreamer1.0-dev:armhf \
libgstreamer-plugins-base1.0-dev:armhf \
libpython3-dev:armhf \
python3-pip
RUN wget https://www.cmake.org/files/v3.14/cmake-3.14.3.tar.gz && \
tar xf cmake-3.14.3.tar.gz && \
(cd cmake-3.14.3 && ./bootstrap --parallel=$(nproc --all) && make --jobs=$(nproc --all) && make install) && \
rm -rf cmake-3.14.3 cmake-3.14.3.tar.gz
```
It uses the Debian\* Stretch (Debian 9) OS for compilation because it is a base of the Raspbian\* Stretch.
4. Build a Docker\* image:
```bash
docker image build -t ie_cross_armhf ie_cross_armhf
```
5. Run Docker\* container with mounted source code folder from host:
```bash
docker run -it -v /absolute/path/to/openvino:/openvino ie_cross_armhf /bin/bash
```
6. While in the container:
1. Go to the cloned `openvino` repository:
```bash
cd openvino
```
2. Create a build folder:
```bash
mkdir build && cd build
```
3. Build the Inference Engine:
```bash
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="../cmake/arm.toolchain.cmake" \
-DTHREADS_PTHREAD_ARG="-pthread" \
-DENABLE_SSE42=OFF \
-DTHREADING=SEQ \
-DENABLE_GNA=OFF .. && make --jobs=$(nproc --all)
```
7. Press **Ctrl+D** to exit from Docker. You can find the resulting binaries
in the `openvino/bin/armv7l/` directory and the OpenCV*
installation in the `openvino/inference-engine/temp`.
>**NOTE**: Native applications that link to cross-compiled Inference Engine
library require an extra compilation flag `-march=armv7-a`.
### Additional Build Options
You can use the following additional build options:
- Required versions of OpenCV packages are downloaded automatically by the
CMake-based script. If you want to use the automatically downloaded packages
but you already have installed OpenCV packages configured in your environment,
you may need to clean the `OpenCV_DIR` environment variable before running
the `cmake` command; otherwise they won't be downloaded and the build may
fail if incompatible versions were installed.
- If the CMake-based build script cannot find and download the OpenCV package
that is supported on your platform, or if you want to use a custom build of
the OpenCV library, see: [Use Custom OpenCV Builds](#use-custom-opencv-builds-for-inference-engine)
for details.
- To build Python API wrapper, install `libpython3-dev:armhf` and `python3-pip`
packages using `apt-get`; then install `numpy` and `cython` python modules
via `pip3`, adding the following options:
```sh
-DENABLE_PYTHON=ON \
-DPYTHON_EXECUTABLE=/usr/bin/python3.5 \
-DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.5m.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.5
```
- nGraph-specific compilation options:
`-DNGRAPH_ONNX_IMPORT_ENABLE=ON` enables the building of the nGraph ONNX importer.
`-DNGRAPH_JSON_ENABLE=ON` enables nGraph JSON-based serialization.
`-DNGRAPH_DEBUG_ENABLE=ON` enables additional debug prints.
## Build on Windows* Systems
The software was validated on:
- Microsoft\* Windows\* 10 (64-bit) with Visual Studio 2017 and Intel® C++
Compiler 2018 Update 3
### Software Requirements
- [CMake]\*3.11 or higher
- Microsoft\* Visual Studio 2017, 2019 or [Intel® C++ Compiler] 18.0
- (Optional) Intel® Graphics Driver for Windows* (26.20) [driver package].
- Python 3.5 or higher for Inference Engine Python API wrapper
### Build Steps
1. Clone submodules:
```sh
git submodule update --init --recursive
```
2. By default, the build enables the Inference Engine GPU plugin to infer models
on your Intel® Processor Graphics. This requires you to [download and install
the Intel® Graphics Driver for Windows (26.20) [driver package] before
running the build. If you don't want to use the GPU plugin, use the
`-DENABLE_CLDNN=OFF` CMake build option and skip the installation of the
Intel® Graphics Driver.
3. Create build directory:
```sh
mkdir build
```
4. In the `build` directory, run `cmake` to fetch project dependencies and
generate a Visual Studio solution.
For Microsoft\* Visual Studio 2017:
```sh
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release ..
```
For Microsoft\* Visual Studio 2019:
```sh
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release ..
```
For Intel® C++ Compiler 18:
```sh
cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 18.0" ^
-DCMAKE_BUILD_TYPE=Release ^
-DICCLIB="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib" ..
```
5. Build generated solution in Visual Studio or run
`cmake --build . --config Release` to build from the command line.
6. Before running the samples, add paths to the TBB and OpenCV binaries used for
the build to the `%PATH%` environment variable. By default, TBB binaries are
downloaded by the CMake-based script to the `<openvino_repo>/inference-engine/temp/tbb/bin`
folder, OpenCV binaries to the `<openvino_repo>/inference-engine/temp/opencv_4.3.0/opencv/bin`
folder.
### Additional Build Options
- Internal JIT GEMM implementation is used by default.
- To switch to OpenBLAS GEMM implementation, use the `-DGEMM=OPENBLAS` CMake
option and specify path to OpenBLAS using the `-DBLAS_INCLUDE_DIRS=<OPENBLAS_DIR>\include`
and `-DBLAS_LIBRARIES=<OPENBLAS_DIR>\lib\libopenblas.dll.a` options. Download
a prebuilt OpenBLAS\* package via the [OpenBLAS] link. mingw64* runtime
dependencies can be downloaded via the [mingw64\* runtime dependencies] link.
- To switch to the optimized MKL-ML\* GEMM implementation, use the
`-DGEMM=MKL` and `-DMKLROOT=<path_to_MKL>` CMake options to specify a path to
unpacked MKL-ML with the `include` and `lib` folders. MKL-ML\* package can be
downloaded from the Intel&reg; [MKL-DNN repository for Windows].
- Threading Building Blocks (TBB) is used by default. To build the Inference
Engine with OpenMP* threading, set the `-DTHREADING=OMP` option.
- Required versions of TBB and OpenCV packages are downloaded automatically by
the CMake-based script. If you want to use the automatically-downloaded
packages but you already have installed TBB or OpenCV packages configured in
your environment, you may need to clean the `TBBROOT` and `OpenCV_DIR`
environment variables before running the `cmake` command; otherwise they won't
be downloaded and the build may fail if incompatible versions were installed.
- If the CMake-based build script can not find and download the OpenCV package
that is supported on your platform, or if you want to use a custom build of
the OpenCV library, refer to the [Use Custom OpenCV Builds](#use-custom-opencv-builds-for-inference-engine)
section for details.
- To switch off/on the CPU and GPU plugins, use the `cmake` options
`-DENABLE_MKL_DNN=ON/OFF` and `-DENABLE_CLDNN=ON/OFF` respectively.
- To build the Python API wrapper, use the `-DENABLE_PYTHON=ON` option. To
specify an exact Python version, use the following options:
```sh
-DPYTHON_EXECUTABLE="C:\Program Files\Python37\python.exe" ^
-DPYTHON_LIBRARY="C:\Program Files\Python37\libs\python37.lib" ^
-DPYTHON_INCLUDE_DIR="C:\Program Files\Python37\include"
```
- nGraph-specific compilation options:
`-DNGRAPH_ONNX_IMPORT_ENABLE=ON` enables the building of the nGraph ONNX importer.
`-DNGRAPH_JSON_ENABLE=ON` enables nGraph JSON-based serialization.
`-DNGRAPH_DEBUG_ENABLE=ON` enables additional debug prints.
### Building Inference Engine with Ninja* Build System
```sh
call "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\bin\ipsxe-comp-vars.bat" intel64 vs2017
set CXX=icl
set CC=icl
:: clean TBBROOT value set by ipsxe-comp-vars.bat, required TBB package will be downloaded by openvino cmake script
set TBBROOT=
cmake -G Ninja -Wno-dev -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release
```
## Build on macOS* Systems
> **NOTE**: The current version of the OpenVINO™ toolkit for macOS* supports
inference on Intel CPUs only.
The software was validated on:
- macOS\* 10.14, 64-bit
### Software Requirements
- [CMake]\* 3.11 or higher
- Clang\* compiler from Xcode\* 10.1 or higher
- Python\* 3.5 or higher for the Inference Engine Python API wrapper
### Build Steps
1. Clone submodules:
```sh
cd openvino
git submodule update --init --recursive
```
2. Install build dependencies using the `install_dependencies.sh` script in the
project root folder:
```sh
chmod +x install_dependencies.sh
```
```sh
./install_dependencies.sh
```
3. Create a build folder:
```sh
mkdir build
```
4. Inference Engine uses a CMake-based build system. In the created `build`
directory, run `cmake` to fetch project dependencies and create Unix makefiles,
then run `make` to build the project:
```sh
cmake -DCMAKE_BUILD_TYPE=Release ..
make --jobs=$(nproc --all)
```
### Additional Build Options
You can use the following additional build options:
- Internal JIT GEMM implementation is used by default.
- To switch to the optimized MKL-ML\* GEMM implementation, use `-DGEMM=MKL` and
`-DMKLROOT=<path_to_MKL>` cmake options to specify a path to unpacked MKL-ML
with the `include` and `lib` folders. MKL-ML\* [package for Mac] can be downloaded
[here](https://github.com/intel/mkl-dnn/releases/download/v0.19/mklml_mac_2019.0.5.20190502.tgz)
- Threading Building Blocks (TBB) is used by default. To build the Inference
Engine with OpenMP* threading, set the `-DTHREADING=OMP` option.
- Required versions of TBB and OpenCV packages are downloaded automatically by
the CMake-based script. If you want to use the automatically downloaded
packages but you already have installed TBB or OpenCV packages configured in
your environment, you may need to clean the `TBBROOT` and `OpenCV_DIR`
environment variables before running the `cmake` command, otherwise they won't
be downloaded and the build may fail if incompatible versions were installed.
- If the CMake-based build script can not find and download the OpenCV package
that is supported on your platform, or if you want to use a custom build of
the OpenCV library, refer to the
[Use Custom OpenCV Builds](#use-custom-opencv-builds-for-inference-engine)
section for details.
- To build the Python API wrapper, use the `-DENABLE_PYTHON=ON` option. To
specify an exact Python version, use the following options:
```sh
-DPYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 \
-DPYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib \
-DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m
```
- nGraph-specific compilation options:
`-DNGRAPH_ONNX_IMPORT_ENABLE=ON` enables the building of the nGraph ONNX importer.
`-DNGRAPH_JSON_ENABLE=ON` enables nGraph JSON-based serialization.
`-DNGRAPH_DEBUG_ENABLE=ON` enables additional debug prints.
## Build on Android* Systems
This section describes how to build Inference Engine for Android x86 (64-bit) operating systems.
### Software Requirements
- [CMake]\* 3.11 or higher
- Android NDK (this guide has been validated with r20 release)
### Build Steps
1. Download and unpack Android NDK: https://developer.android.com/ndk/downloads. Let's assume that `~/Downloads` is used as a working folder.
```sh
cd ~/Downloads
wget https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip
unzip android-ndk-r20-linux-x86_64.zip
mv android-ndk-r20 android-ndk
```
2. Clone submodules
```sh
cd openvino
git submodule update --init --recursive
```
3. Create a build folder:
```sh
mkdir build
```
4. Change working directory to `build` and run `cmake` to create makefiles. Then run `make`.
```sh
cd build
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=~/Downloads/android-ndk/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=x86_64 \
-DANDROID_PLATFORM=21 \
-DANDROID_STL=c++_shared \
-DENABLE_OPENCV=OFF
make --jobs=$(nproc --all)
```
* `ANDROID_ABI` specifies target architecture (`x86_64`)
* `ANDROID_PLATFORM` - Android API version
* `ANDROID_STL` specifies that shared C++ runtime is used. Copy `~/Downloads/android-ndk/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so` from Android NDK along with built binaries
## Use Custom OpenCV Builds for Inference Engine
> **NOTE**: The recommended and tested version of OpenCV is 4.4.0.
Required versions of OpenCV packages are downloaded automatically during the
building Inference Engine library. If the build script can not find and download
the OpenCV package that is supported on your platform, you can use one of the
following options:
* Download the most suitable version from the list of available pre-build
packages from [https://download.01.org/opencv/2020/openvinotoolkit] from the
`<release_version>/inference_engine` directory.
* Use a system-provided OpenCV package (e.g with running the
`apt install libopencv-dev` command). The following modules must be enabled:
`imgcodecs`, `videoio`, `highgui`.
* Get the OpenCV package using a package manager: pip, conda, conan etc. The
package must have the development components included (header files and CMake
scripts).
* Build OpenCV from source using the [build instructions](https://docs.opencv.org/master/df/d65/tutorial_table_of_content_introduction.html) on the OpenCV site.
After you got the built OpenCV library, perform the following preparation steps
before running the Inference Engine build:
1. Set the `OpenCV_DIR` environment variable to the directory where the
`OpenCVConfig.cmake` file of you custom OpenCV build is located.
2. Disable the package automatic downloading with using the `-DENABLE_OPENCV=OFF`
option for CMake-based build script for Inference Engine.
## Add Inference Engine to Your Project
For CMake projects, set the `InferenceEngine_DIR` environment variable:
```sh
export InferenceEngine_DIR=/path/to/openvino/build/
```
Then you can find Inference Engine by `find_package`:
```cmake
find_package(InferenceEngine)
include_directories(${InferenceEngine_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${InferenceEngine_LIBRARIES} dl)
```
## (Optional) Additional Installation Steps for the Intel® Movidius™ Neural Compute Stick and Neural Compute Stick 2
> **NOTE**: These steps are only required if you want to perform inference on
Intel® Movidius™ Neural Compute Stick or the Intel® Neural Compute Stick 2 using
the Inference Engine MYRIAD Plugin. See also [Intel® Neural Compute Stick 2 Get Started].
### For Linux, Raspbian\* Stretch OS
1. Add the current Linux user to the `users` group; you will need to log out and
log in for it to take effect:
```sh
sudo usermod -a -G users "$(whoami)"
```
2. To perform inference on Intel® Movidius™ Neural Compute Stick and Intel®
Neural Compute Stick 2, install the USB rules as follows:
```sh
cat <<EOF > 97-myriad-usbboot.rules
SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
EOF
```
```sh
sudo cp 97-myriad-usbboot.rules /etc/udev/rules.d/
```
```sh
sudo udevadm control --reload-rules
```
```sh
sudo udevadm trigger
```
```sh
sudo ldconfig
```
```sh
rm 97-myriad-usbboot.rules
```
## Next Steps
Congratulations, you have built the Inference Engine. To get started with the
OpenVINO™, proceed to the Get Started guides:
* [Get Started with Deep Learning Deployment Toolkit on Linux*](get-started-linux.md)
## Notice
To enable some additional nGraph features and use your custom nGraph library with the OpenVINO™ binary package,
make sure the following:
- nGraph library was built with the same version which is used in the Inference Engine.
- nGraph library and the Inference Engine were built with the same compilers. Otherwise you might face application binary interface (ABI) problems.
To prepare your custom nGraph library for distribution, which includes collecting all headers, copy
binaries, and so on, use the `install` CMake target.
This target collects all dependencies, prepares the nGraph package and copies it to a separate directory.
## Additional Resources
* [OpenVINO™ Release Notes](https://software.intel.com/en-us/articles/OpenVINO-RelNotes)
* [Introduction to Intel® Deep Learning Deployment Toolkit](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Introduction.html)
* [Inference Engine Samples Overview](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Samples_Overview.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)
---
\* Other names and brands may be claimed as the property of others.
[Intel® Distribution of OpenVINO™]:https://software.intel.com/en-us/openvino-toolkit
[CMake]:https://cmake.org/download/
[Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 19.41.14441]:https://github.com/intel/compute-runtime/releases/tag/19.41.14441
[MKL-DNN repository]:https://github.com/intel/mkl-dnn/releases/download/v0.19/mklml_lnx_2019.0.5.20190502.tgz
[MKL-DNN repository for Windows]:(https://github.com/intel/mkl-dnn/releases/download/v0.19/mklml_win_2019.0.5.20190502.zip)
[OpenBLAS]:https://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int64.zip/download
[mingw64\* runtime dependencies]:https://sourceforge.net/projects/openblas/files/v0.2.14/mingw64_dll.zip/download
[https://download.01.org/opencv/2020/openvinotoolkit]:https://download.01.org/opencv/2020/openvinotoolkit
[build instructions]:https://docs.opencv.org/master/df/d65/tutorial_table_of_content_introduction.html
[driver package]:https://downloadcenter.intel.com/download/29335/Intel-Graphics-Windows-10-DCH-Drivers
[Intel® Neural Compute Stick 2 Get Started]:https://software.intel.com/en-us/neural-compute-stick/get-started
[Intel® C++ Compiler]:https://software.intel.com/en-us/intel-parallel-studio-xe
[OpenBLAS]:https://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int64.zip/download

73
cmake/arm.toolchain.cmake Normal file
View File

@@ -0,0 +1,73 @@
# Copyright (C) 2018-2020 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()

View File

@@ -0,0 +1,73 @@
# Copyright (C) 2018-2020 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()

View File

@@ -0,0 +1,39 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if (VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "" FORCE)
endif()
#64 bits platform
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
message(STATUS "Detected 64 bit architecture")
SET(ARCH_64 ON)
else()
message(STATUS "Detected 32 bit architecture")
SET(ARCH_64 OFF)
endif()
if (NOT ENABLE_MKL_DNN)
set(ENABLE_MKL OFF)
endif()
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()
print_enabled_features()

View File

@@ -0,0 +1,211 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
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 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/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()

View File

@@ -0,0 +1,30 @@
# Copyright (C) 2018-2020 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()

View File

@@ -0,0 +1,22 @@
# Copyright (C) 2018-2020 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})

View File

@@ -0,0 +1,105 @@
# Copyright (C) 2020 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. space 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_SET "${XARCH_SET}")
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()

View File

@@ -0,0 +1,16 @@
# 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@

View File

@@ -0,0 +1,227 @@
# Copyright (C) 2020 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 "-DHAVE_SSE42" ${_DEFINE_ANY})
set(_DEFINE_AVX "-DHAVE_AVX" ${_DEFINE_SSE42})
set(_DEFINE_AVX2 "-DHAVE_AVX2" ${_DEFINE_AVX})
set(_DEFINE_AVX512F "-DHAVE_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}
)
set(_ARCH_SPECIFIC_FLAGS
${_DEFINE_${_arch}}
${_FLAGS_${_arch}}
"-DXARCH=${_arch}" ## to replace XARCH with direct ARCH name
"-I${CMAKE_CURRENT_SOURCE_DIR}/${ARCH_INCLUDE_DIR}" ## To make valid #include "some.hpp"
)
_add_source_compile_flags(${ARCH_SOURCE} ${_ARCH_SPECIFIC_FLAGS})
list(APPEND _ARCH_SOURCES ${ARCH_SOURCE})
endforeach()
_add_source_to_target(${TARGET} ${_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")
set(_GEN_ARGS_LIST
-DXARCH_FUNC_NAME="${X_NAME}"
-DXARCH_NAMESPACES="${NAMESPACE}"
-DXARCH_API_HEADER="${CMAKE_CURRENT_SOURCE_DIR}/${HEADER}"
-DXARCH_DISP_FILE="${CMAKE_CURRENT_BINARY_DIR}/${DISPATCHER_SOURCE}"
-DXARCH_SET="${ARCH_SET}"
)
configure_file(${DISPATCHER_GEN_OPTIONS_HOLDER} ${DISPATCHER_OPT_HOLDER})
add_custom_command(
OUTPUT ${DISPATCHER_SOURCE}
COMMAND ${CMAKE_COMMAND} ${_GEN_ARGS_LIST}
-P ${DISPATCHER_GEN_SCRIPT}
DEPENDS ${HEADER}
${DISPATCHER_GEN_SCRIPT}
${CMAKE_CURRENT_BINARY_DIR}/${DISPATCHER_OPT_HOLDER} ## Just to make run dependency on args value
)
_add_source_compile_flags(${DISPATCHER_SOURCE} "-I${DISPATCHER_INCLUDE_DIR}")
_add_source_to_target(${TARGET} ${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()
function(_add_source_to_target TARGET)
get_target_property(ORIGINAL_SOURCES ${TARGET} SOURCES)
list(APPEND ORIGINAL_SOURCES ${ARGN})
set_target_properties(${TARGET}
PROPERTIES
SOURCES "${ORIGINAL_SOURCES}")
endfunction()
function(_add_source_compile_flags SOURCE)
get_source_file_property(ORIGINAL_FLAGS ${SOURCE} COMPILE_FLAGS)
## Empty list of COMPILE_FLAGS represented as NOTFOUND
if(NOT ORIGINAL_FLAGS)
set(ORIGINAL_FLAGS "")
endif()
string(REPLACE ";" " " NEW_FLAGS "${ARGN}")
string(APPEND ORIGINAL_FLAGS " " ${NEW_FLAGS})
set_source_files_properties(${SOURCE}
PROPERTIES
COMPILE_FLAGS "${ORIGINAL_FLAGS}")
endfunction()

73
cmake/debug.cmake Normal file
View File

@@ -0,0 +1,73 @@
# Copyright (C) 2018-2020 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()
file(REMOVE ${CMAKE_BINARY_DIR}/ld_library_rpath_64.txt)
# log relative path to shared library that has to be used in LD_LIBRARY_PATH
function (log_rpath_remove_top component component_remove_top lib lib_remove_top)
set(top_lib_dir ${${component}})
set(lib_dir ${lib})
# debug_message(STATUS "LIB-IN=${lib} ")
# debug_message(STATUS "TOPLIB-IN=${top_lib_dir} ")
get_filename_component(top_lib_dir "${${component}}" DIRECTORY)
if (${component_remove_top} AND ${component})
else()
get_filename_component(add_name "${${component}}" NAME)
set(top_lib_dir "${top_lib_dir}/${add_name}")
endif()
if (${lib_remove_top} AND lib)
get_filename_component(lib_dir ${lib} DIRECTORY)
endif()
string (REPLACE "//" "/" top_lib_dir "${top_lib_dir}")
string (REPLACE "//" "/" lib_dir "${lib_dir}")
string (REPLACE "\\\\" "/" top_lib_dir "${top_lib_dir}")
string (REPLACE "\\\\" "/" lib_dir "${lib_dir}")
# debug_message(STATUS "LIB-OUT=${lib_dir}")
# debug_message(STATUS "TOPLIB-OUT=${top_lib_dir}")
if (WIN32)
string (TOLOWER "${top_lib_dir}" top_lib_dir)
string (TOLOWER "${lib_dir}" lib_dir)
endif()
string (REPLACE "${top_lib_dir}" "" component_dir "${lib_dir}")
set(RPATH_INFO "${component}=${component_dir}")
debug_message(STATUS "LD_LIBRARY_RPATH: ${RPATH_INFO}")
file(APPEND ${CMAKE_BINARY_DIR}/ld_library_rpath_64.txt "${RPATH_INFO}\n")
endfunction()
function (log_rpath_from_dir component lib_dir)
log_rpath_remove_top("${component}" TRUE "${lib_dir}" FALSE)
endfunction()
function (log_rpath component lib_path)
log_rpath_remove_top(${component} TRUE ${lib_path} TRUE)
endfunction()
# Just wrapping of the original message() function to make this macro known during IE build.
# This macro is redefined (with additional checks) within the InferenceEngineConfig.cmake file.
macro(ext_message TRACE_LEVEL)
message(${TRACE_LEVEL} "${ARGN}")
endmacro()

37
cmake/dependencies.cmake Normal file
View File

@@ -0,0 +1,37 @@
# Copyright (C) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set_temp_directory(TEMP "${IE_MAIN_SOURCE_DIR}")
include(dependency_solver)
if(CMAKE_CROSSCOMPILING)
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(HOST_X86_64 ON)
endif()
set(protoc_version "3.7.1")
if(CMAKE_HOST_SYSTEM_NAME MATCHES Linux)
RESOLVE_DEPENDENCY(SYSTEM_PROTOC_ROOT
ARCHIVE_LIN "protoc-${protoc_version}-linux-x86_64.tar.gz"
TARGET_PATH "${TEMP}/protoc-${protoc_version}-linux-x86_64")
debug_message(STATUS "host protoc-${protoc_version} root path = " ${SYSTEM_PROTOC_ROOT})
else()
message(FATAL_ERROR "Unsupported host system (${CMAKE_HOST_SYSTEM_NAME}) and arch (${CMAKE_HOST_SYSTEM_PROCESSOR}) for cross-compilation")
endif()
reset_deps_cache(SYSTEM_PROTOC)
message("${SYSTEM_PROTOC_ROOT}/bin")
find_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()

View File

@@ -0,0 +1,226 @@
# Copyright (C) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
list(APPEND CMAKE_MODULE_PATH
"${OpenVINO_MAIN_SOURCE_DIR}/cmake/download"
"${OpenVINO_MAIN_SOURCE_DIR}/cmake/cross_compile"
)
include(CPackComponent)
unset(IE_CPACK_COMPONENTS_ALL CACHE)
set(IE_CPACK_IE_DIR deployment_tools/inference_engine)
# 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()
#
# ie_cpack_set_library_dir()
#
# Set library directory for cpack
#
function(ie_cpack_set_library_dir)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH)
if(ARCH STREQUAL "x86_64" OR ARCH STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64
set(ARCH intel64)
elseif(ARCH STREQUAL "i386")
set(ARCH ia32)
endif()
if(WIN32)
set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/bin/${ARCH}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
else()
set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH} PARENT_SCOPE)
set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH} PARENT_SCOPE)
set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH} PARENT_SCOPE)
endif()
endfunction()
ie_cpack_set_library_dir()
#
# ie_cpack_add_component(NAME ...)
#
# Wraps original `cpack_add_component` and adds component to internal IE list
#
macro(ie_cpack_add_component NAME)
list(APPEND IE_CPACK_COMPONENTS_ALL ${NAME})
set(IE_CPACK_COMPONENTS_ALL "${IE_CPACK_COMPONENTS_ALL}" CACHE STRING "" FORCE)
cpack_add_component(${NAME} ${ARGN})
endmacro()
macro(ie_cpack)
set(CPACK_GENERATOR "TGZ")
string(REPLACE "/" "_" CPACK_PACKAGE_VERSION "${CI_BUILD_NUMBER}")
if(WIN32)
set(CPACK_PACKAGE_NAME inference-engine_${CMAKE_BUILD_TYPE})
else()
set(CPACK_PACKAGE_NAME inference-engine)
endif()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_VENDOR "Intel")
set(CPACK_COMPONENTS_ALL ${ARGN})
set(CPACK_STRIP_FILES ON)
if(OS_FOLDER)
set(CPACK_SYSTEM_NAME "${OS_FOLDER}")
endif()
include(CPack)
endmacro()
# prepare temporary folder
function(set_temp_directory temp_variable source_tree_dir)
if (DEFINED ENV{DL_SDK_TEMP} AND NOT $ENV{DL_SDK_TEMP} STREQUAL "")
message(STATUS "DL_SDK_TEMP environment is set : $ENV{DL_SDK_TEMP}")
if (WIN32)
string(REPLACE "\\" "\\\\" temp $ENV{DL_SDK_TEMP})
else()
set(temp $ENV{DL_SDK_TEMP})
endif()
if (ENABLE_ALTERNATIVE_TEMP)
set(ALTERNATIVE_PATH ${source_tree_dir}/temp)
endif()
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()
include(coverage/coverage)
# External dependencies
find_package(Threads)
# Detect target
include(target_flags)
# printing debug messages
include(debug)
# linking libraries without discarding symbols
include(whole_archive)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH_FOLDER)
if(ARCH_FOLDER STREQUAL "x86_64" OR ARCH_FOLDER STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64
set(ARCH_FOLDER intel64)
elseif(ARCH_FOLDER STREQUAL "i386")
set(ARCH_FOLDER ia32)
endif()
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()
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
debug_message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used")
set(CMAKE_BUILD_TYPE "Release")
endif()
# allow to override default OUTPUT_ROOT root
if(NOT DEFINED OUTPUT_ROOT)
set(OUTPUT_ROOT ${OpenVINO_MAIN_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 "d")
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})
if (WIN32 OR CMAKE_GENERATOR STREQUAL "Xcode")
# Support CMake multiconfiguration for Visual Studio or Xcode build
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()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
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})
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})
else()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE}/lib)
set(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE})
set(CMAKE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE})
endif()
if(APPLE)
# 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)
set(CMAKE_MACOSX_RPATH ON)
endif()
# Use solution folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_POLICY_DEFAULT_CMP0054 NEW)
include(sdl)
include(os_flags)
include(sanitizer)
include(cross_compiled_func)
function(set_ci_build_number)
set(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
include(version)
set(CI_BUILD_NUMBER "${CI_BUILD_NUMBER}" PARENT_SCOPE)
endfunction()
set_ci_build_number()

View File

@@ -0,0 +1,195 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
include ("download")
function (resolve_archive_dependency VAR COMPONENT ARCHIVE ARCHIVE_UNIFIED ARCHIVE_WIN ARCHIVE_LIN ARCHIVE_MAC ARCHIVE_ANDROID TARGET_PATH FOLDER ENVIRONMENT)
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})
else()
DownloadAndExtractPlatformSpecific(${COMPONENT} ${ARCHIVE_UNIFIED} ${ARCHIVE_WIN} ${ARCHIVE_LIN} ${ARCHIVE_MAC} ${ARCHIVE_ANDROID} ${TARGET_PATH} result_path ${FOLDER})
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(resolve_pull_request GITHUB_PULL_REQUEST TARGET_PATH)
get_filename_component(FILE_NAME ${GITHUB_PULL_REQUEST} NAME)
set (PATCH_URL "")
DownloadAndApply("${PATCH_URL}/${GITHUB_PULL_REQUEST}" "${IE_MAIN_SOURCE_DIR}/${TARGET_PATH}/${FILE_NAME}")
endfunction(resolve_pull_request)
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 GITHUB_PULL_REQUEST VERSION_REGEX)
#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()
#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})
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()
elseif (DEFINED GITHUB_PULL_REQUEST)
resolve_pull_request(${GITHUB_PULL_REQUEST} ${TARGET_PATH})
else()
message(FATAL_ERROR "Dependency of unknowntype, SHOULD set one of ARCHIVE_WIN, ARCHIVE, ARCHIVE_LIN, ARCHIVE_MAC, ARCHIVE_ANDROID, GITHUB_PULL_REQUEST")
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()

View File

@@ -1,10 +1,7 @@
# Copyright (C) 2018 Intel Corporation
#
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required (VERSION 2.8)
function (Download from to fatal result output)
if((NOT EXISTS "${to}"))
@@ -24,4 +21,4 @@ function (Download from to fatal result output)
endfunction(Download)
include ("download_and_apply")
include ("download_and_extract")
include ("download_and_extract")

View File

@@ -1,10 +1,7 @@
# Copyright (C) 2018 Intel Corporation
#
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required (VERSION 2.8)
function (DownloadAndApply URL apply_to)
if (EXISTS ${apply_to})

View File

@@ -0,0 +1,58 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
include (FindWget)
function (DownloadAndCheck from to fatal result)
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)
list(GET output 0 status_code)
else()
message(STATUS "${WGET_EXECUTABLE} --no-cache ${from}")
execute_process(COMMAND ${WGET_EXECUTABLE} "--no-cache" "--no-check-certificate" "${from}" "-O" "${to}"
TIMEOUT 2000
RESULT_VARIABLE status_code)
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)

View File

@@ -1,55 +1,49 @@
# Copyright (C) 2018 Intel Corporation
#
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required (VERSION 2.8)
include ("extract")
include ("download_and_check")
function (GetNameAndUrlToDownload name url archive_name_unified archive_name_win archive_name_lin archive_name_mac)
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} "${archive_name_unified}" PARENT_SCOPE)
set (${url} "thirdparty/unified/${archive_name_unified}" PARENT_SCOPE)
set (${name} ${archive_name_unified} PARENT_SCOPE)
else()
if (LINUX OR (APPLE AND NOT archive_name_mac))
if (NOT archive_name_lin)
return()
endif()
if(archive_name_lin)
set (PLATFORM_FOLDER linux)
set (archive_name ${archive_name_lin})
elseif(APPLE)
if (NOT archive_name_mac)
return()
endif()
elseif(archive_name_mac)
set (PLATFORM_FOLDER mac)
set (archive_name ${archive_name_mac})
else()
#if no dependency for target platfrom skip it
if (NOT archive_name_win)
return()
endif()
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} "${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
unpacked_path
function (DownloadAndExtractPlatformSpecific
component
archive_name_unified
archive_name_win
archive_name_lin
archive_name_mac
archive_name_android
unpacked_path
result_path
folder)
GetNameAndUrlToDownload(archive_name RELATIVE_URL ${archive_name_unified} ${archive_name_win} ${archive_name_lin} ${archive_name_mac} )
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()
@@ -63,35 +57,35 @@ function (DownloadAndExtract component archive_name unpacked_path result_path fo
set (RELATIVE_URL "${archive_name}")
set(fattal TRUE)
CheckOrDownloadAndExtract(${component} ${RELATIVE_URL} ${archive_name} ${unpacked_path} result_path2 ${folder} ${fattal} result TRUE)
if (NOT ${result})
DownloadAndExtractPlatformSpecific(${component} ${archive_name} ${archive_name} ${archive_name} ${unpacked_path} ${result_path2} ${folder})
endif()
endif()
set (${result_path} ${result_path2} PARENT_SCOPE)
endfunction(DownloadAndExtract)
function (DownloadAndExtractInternal URL archive_path unpacked_path folder fattal result123)
function (DownloadAndExtractInternal URL archive_path unpacked_path folder fattal resultExt)
set (status "ON")
DownloadAndCheck(${URL} ${archive_path} ${fattal} result1)
if ("${result1}" STREQUAL "ARCHIVE_DOWNLOAD_FAIL")
#check alternative url as well
set (status "OFF")
file(REMOVE_RECURSE "${archive_path}")
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}")
file(REMOVE_RECURSE "${archive_path}")
endif()
if("${status}" STREQUAL "ON")
ExtractWithVersion(${URL} ${archive_path} ${unpacked_path} ${folder} result)
endif()
set (result123 ${status} PARENT_SCOPE)
set (${resultExt} ${status} PARENT_SCOPE)
endfunction(DownloadAndExtractInternal)
@@ -100,36 +94,49 @@ function (ExtractWithVersion URL archive_path unpacked_path folder result)
debug_message("ExtractWithVersion : ${archive_path} : ${unpacked_path}")
extract(${archive_path} ${unpacked_path} ${folder} status)
#dont need archive actually after unpacking
file(REMOVE_RECURSE "${archive_path}")
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)
set (${result} ${status} PARENT_SCOPE)
endfunction (ExtractWithVersion)
function (DownloadOrExtractInternal URL archive_path unpacked_path folder fattal result123)
function (DownloadOrExtractInternal URL archive_path unpacked_path folder fattal resultExt)
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)
if (${result})
set (downloadStatus "OK")
endif()
else()
if (ENABLE_UNSAFE_LOCATIONS)
ExtractWithVersion(${URL} ${archive_path} ${unpacked_path} ${folder} result)
if(NOT ${result})
DownloadAndExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} result)
DownloadAndExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} result)
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)
endif()
DownloadAndExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} result)
if (${result})
set (downloadStatus "OK")
endif()
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")
@@ -139,12 +146,18 @@ endfunction(DownloadOrExtractInternal)
file(REMOVE ${CMAKE_BINARY_DIR}/dependencies_64.txt)
function (CheckOrDownloadAndExtract component RELATIVE_URL archive_name unpacked_path result_path folder fattal result123 use_alternatives)
function (CheckOrDownloadAndExtract component RELATIVE_URL archive_name unpacked_path result_path folder fattal resultExt use_alternatives)
set (archive_path ${TEMP}/download/${archive_name})
set (status "ON")
set (on_master FALSE)
set (URL "https://download.01.org/openvinotoolkit/2018_R3/dldt/inference_engine/${RELATIVE_URL}")
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})
@@ -157,7 +170,7 @@ function (CheckOrDownloadAndExtract component RELATIVE_URL archive_name unpacked
if (NOT EXISTS ${unpacked_path})
DownloadOrExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} status)
else(NOT EXISTS ${unpacked_path})
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)
@@ -174,7 +187,7 @@ function (CheckOrDownloadAndExtract component RELATIVE_URL archive_name unpacked
"\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}")
# file(REMOVE_RECURSE "${unpacked_path}")
# DownloadOrExtractInternal(${URL} ${archive_path} ${unpacked_path} ${fattal} status)
else()
if (EXISTS ${version_file})
@@ -194,11 +207,11 @@ function (CheckOrDownloadAndExtract component RELATIVE_URL archive_name unpacked
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} ${result123} FALSE)
CheckOrDownloadAndExtract(${component} ${RELATIVE_URL} ${archive_name} ${unpacked_path} ${result_path} ${folder} ${fattal} ${resultExt} FALSE)
else()
debug_message("dependency updated: download it again")
file(REMOVE_RECURSE "${unpacked_path}")
file(REMOVE_RECURSE "${unpacked_path}")
DownloadOrExtractInternal(${URL} ${archive_path} ${unpacked_path} ${folder} ${fattal} status)
endif()
endif ()
@@ -206,11 +219,10 @@ function (CheckOrDownloadAndExtract component RELATIVE_URL archive_name unpacked
endif()
if (${use_alternatives} OR ${on_master})
set (${result123} "${status}" PARENT_SCOPE)
set (${resultExt} "${status}" PARENT_SCOPE)
set (${result_path} ${unpacked_path} PARENT_SCOPE)
endif()
endfunction(CheckOrDownloadAndExtract)
endfunction(CheckOrDownloadAndExtract)

View File

@@ -1,17 +1,13 @@
# Copyright (C) 2018 Intel Corporation
#
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required (VERSION 2.8)
function (extract archive_path unpacked_path folder result)
# Slurped from a generated extract-TARGET.cmake file.
if (NOT EXISTS ${unpacked_path})
get_filename_component(unpacked_dir ${unpacked_path} DIRECTORY)
file(MAKE_DIRECTORY ${unpacked_path})
message(STATUS "extracting...
src='${archive_path}'
dst='${unpacked_path}'")
@@ -43,6 +39,5 @@ function (extract archive_path unpacked_path folder result)
else()
set(${result} 1 PARENT_SCOPE)
endif()
endif()
endfunction (extract)
endfunction (extract)

43
cmake/features.cmake Normal file
View File

@@ -0,0 +1,43 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
include (target_flags)
include (options)
# these options are aimed to optimize build time on development system
if(X86_64)
set(ENABLE_MKL_DNN_DEFAULT ON)
else()
set(ENABLE_MKL_DNN_DEFAULT OFF)
endif()
ie_option (ENABLE_TESTS "unit, behavior and functional tests" OFF)
ie_option (ENABLE_MKL_DNN "MKL-DNN plugin for inference engine" ${ENABLE_MKL_DNN_DEFAULT})
ie_dependent_option (ENABLE_CLDNN "clDnn based plugin for inference engine" ON "WIN32 OR X86_64;NOT APPLE;NOT MINGW" OFF)
# 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 OR WIN32;NOT CMAKE_CROSSCOMPILING" OFF)
ie_option (OS_FOLDER "create OS dedicated folder in output" OFF)
# 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_option (ENABLE_SANITIZER "enable checking memory errors via AddressSanitizer" OFF)
ie_option (ENABLE_THREAD_SANITIZER "enable checking data races via ThreadSanitizer" OFF)
ie_dependent_option (COVERAGE "enable code coverage" OFF "CMAKE_CXX_COMPILER_ID STREQUAL GNU" OFF)
# Define 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)

30
cmake/fuzzing.cmake Normal file
View File

@@ -0,0 +1,30 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
function(enable_fuzzing)
# Enable (libFuzzer)[https://llvm.org/docs/LibFuzzer.html] if supported.
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$" AND NOT WIN32)
# Communicate libfuzzer is enabled
set(WITH_LIBFUZZER ON PARENT_SCOPE)
add_compile_definitions(WITH_LIBFUZZER)
# Enable libfuzzer and code coverage
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}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FUZZING_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FUZZING_LINKER_FLAGS}" PARENT_SCOPE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FUZZING_LINKER_FLAGS}")
endif()
endfunction(enable_fuzzing)
function(add_fuzzer FUZZER_EXE_NAME FUZZER_SOURCES)
add_executable(${FUZZER_EXE_NAME} ${FUZZER_SOURCES})
if(WITH_LIBFUZZER)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=fuzzer" PARENT_SCOPE)
endif()
target_link_libraries(${FUZZER_EXE_NAME} PRIVATE fuzz-testhelper)
endfunction(add_fuzzer)

27
cmake/options.cmake Normal file
View File

@@ -0,0 +1,27 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Usage: ie_option(<option_variable> "description" <initial value or boolean expression> [IF <condition>])
include (CMakeDependentOption)
include (version)
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()
function (print_enabled_features)
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()

297
cmake/os_flags.cmake Normal file
View File

@@ -0,0 +1,297 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
include(ProcessorCount)
#
# 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 "${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 "/Qdiag-warning: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_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 "${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} "/arch:SSE4.2 /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} "-msse4.2 -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} "-march=core-avx2 -xCORE-AVX2 -mtune=core-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()
#
# Enables Link Time Optimization compilation
#
macro(ie_enable_lto)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND OFF)
ProcessorCount(N)
if(UNIX)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ipo")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ipo")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -ipo-jobs${N}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -ipo-jobs${N}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -ipo-jobs${N}")
else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Qipo")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Qipo")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /Qipo-jobs:${N}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /Qipo-jobs:${N}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /Qipo-jobs:${N}")
endif()
elseif(UNIX)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
# LTO causes issues with gcc 4.8.5 during cmake pthread check
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
endif()
# modify linker and ar
if(LINUX)
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
endif()
elseif(MSVC AND OFF)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG:STATUS")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG:STATUS")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG:STATUS")
endif()
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()
#
# Compilation and linker flags
#
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(THREADS_PREFER_PTHREAD_FLAG 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)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char")
endif()
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
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)
# 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
# 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,2586,2651,3180,11075,15335)
endif()
# Debug information flags
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Z7")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7")
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)
# Disable noisy warnings
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(-Wno-error=switch)
else()
ie_add_compiler_flags(-Wmaybe-uninitialized)
endif()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
ie_add_compiler_flags(-diag-disable=remark)
# noisy warnings from Intel Compiler 19.1.1.217 20200306
ie_add_compiler_flags(-diag-disable=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")
endif()
endif()

43
cmake/sanitizer.cmake Normal file
View File

@@ -0,0 +1,43 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
include(CheckCXXCompilerFlag)
if (ENABLE_SANITIZER)
set(SANITIZER_COMPILER_FLAGS "-g -fsanitize=address -fno-omit-frame-pointer")
CHECK_CXX_COMPILER_FLAG("-fsanitize-recover=address" SANITIZE_RECOVER_SUPPORTED)
if (SANITIZE_RECOVER_SUPPORTED)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize-recover=address")
endif()
set(SANITIZER_LINKER_FLAGS "-fsanitize=address")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=gold")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$" AND NOT WIN32)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
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()
if (ENABLE_THREAD_SANITIZER)
set(SANITIZER_COMPILER_FLAGS "-g -fsanitize=thread -fno-omit-frame-pointer")
set(SANITIZER_LINKER_FLAGS "-fsanitize=thread")
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$" AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
else()
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -static-libsan")
endif()
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()

45
cmake/sdl.cmake Normal file
View File

@@ -0,0 +1,45 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if (CMAKE_BUILD_TYPE STREQUAL "Release")
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(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -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(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?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(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /sdl /guard:cf")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IE_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IE_C_CXX_FLAGS}")
endif()

35
cmake/target_flags.cmake Normal file
View File

@@ -0,0 +1,35 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Target system specific flags
if(CMAKE_CL_64)
set(MSVC64 ON)
endif()
if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE OPENVINO_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(OPENVINO_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
set(MINGW64 ON)
endif()
endif()
if(MSVC64 OR MINGW64)
set(X86_64 ON)
elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING))
set(X86 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(X86_64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
set(X86 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(ARM ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
set(AARCH64 ON)
endif()
if(UNIX AND NOT APPLE)
set(LINUX ON)
endif()

View File

@@ -1,14 +1,11 @@
# Copyright (C) 2018 Intel Corporation
#
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required(VERSION 2.8)
function (branchName VAR)
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${IE_MAIN_SOURCE_DIR}
WORKING_DIRECTORY ${OpenVINO_MAIN_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
set (${VAR} ${GIT_BRANCH} PARENT_SCOPE)
@@ -17,7 +14,7 @@ endfunction()
function (commitHash VAR)
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${IE_MAIN_SOURCE_DIR}
WORKING_DIRECTORY ${OpenVINO_MAIN_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
set (${VAR} ${GIT_COMMIT_HASH} PARENT_SCOPE)

53
cmake/whole_archive.cmake Normal file
View File

@@ -0,0 +1,53 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
#[[
function links static library without removing any symbol from it.
ieTargetLinkWholeArchive(<target name> <lib1> [<lib2> ...])
Example:
ieTargetLinkWholeArchive("MyriadFunctionalTests" "CommonLib" "AnotherLib")
#]]
function(ieTargetLinkWholeArchive targetName)
set(libs)
foreach(staticLib ${ARGN})
if (MSVC)
# CMake does not support generator expression in LINK_FLAGS, so we workaround it a little bit:
# passing same static library as normal link (to get build deps working, and includes too), than using WHOLEARCHIVE option
# it's important here to not use slash '/' for option !
if (CMAKE_GENERATOR MATCHES "Visual Studio")
# MSBuild is unhappy when parsing double quotes in combination with WHOLEARCHIVE flag.
# remove quotes from path - so build path with spaces not supported, but it's better than nothing.
list(APPEND libs ${staticLib}
"-WHOLEARCHIVE:$<TARGET_FILE:${staticLib}>"
)
if (CMAKE_CURRENT_BINARY_DIR MATCHES " ")
message(WARNING "Visual Studio CMake generator may cause problems if your build directory contains spaces. "
"Remove spaces from path or select different generator.")
endif()
else()
list(APPEND libs ${staticLib}
"-WHOLEARCHIVE:\"$<TARGET_FILE:${staticLib}>\""
)
endif()
elseif(APPLE)
list(APPEND libs
"-Wl,-all_load"
${staticLib}
"-Wl,-noall_load"
)
else()
list(APPEND libs
"-Wl,--whole-archive"
${staticLib}
"-Wl,--no-whole-archive"
)
endif()
endforeach()
if (libs)
target_link_libraries(${targetName} PRIVATE ${libs})
endif()
endfunction()

60
docs/CMakeLists.txt Normal file
View File

@@ -0,0 +1,60 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
add_subdirectory(examples)
# Detect nGraph
find_package(ngraph QUIET)
if(NOT ngraph_FOUND)
set(ngraph_DIR ${CMAKE_BINARY_DIR}/ngraph)
endif()
# Detect InferenceEngine
find_package(InferenceEngine QUIET)
if(NOT InferenceEngine_FOUND)
set(InferenceEngine_DIR ${CMAKE_BINARY_DIR})
endif()
add_subdirectory(template_extension)
set(all_docs_targets
ie_docs_examples
template_extension
templatePlugin TemplateBehaviorTests TemplateFunctionalTests)
foreach(target_name IN LISTS all_docs_targets)
if (TARGET ${target_name})
set_target_properties(${target_name} PROPERTIES FOLDER docs)
endif()
endforeach()
# OpenVINO docs
set(OPENVINO_DOCS_PATH "" CACHE PATH "Path to openvino-documentation local repository")
set(args "")
if(OPENVINO_DOCS_PATH)
set(args "${args} ovinodoc_path:${OPENVINO_DOCS_PATH}")
endif()
file(GLOB_RECURSE docs_files "${OpenVINO_MAIN_SOURCE_DIR}/docs")
file(GLOB_RECURSE include_files "${OpenVINO_MAIN_SOURCE_DIR}/inference-engine/include")
file(GLOB_RECURSE ovino_files "${OPENVINO_DOCS_PATH}")
add_custom_target(ie_docs
COMMAND ./build_docs.sh ${args}
WORKING_DIRECTORY "${OpenVINO_MAIN_SOURCE_DIR}/docs/build_documentation"
COMMENT "Generating OpenVINO documentation"
SOURCES ${docs_files} ${include_files} ${ovino_files}
VERBATIM)
set_target_properties(ie_docs PROPERTIES FOLDER docs)
find_program(browser NAMES xdg-open)
if(browser)
add_custom_target(ie_docs_open
COMMAND ${browser} "${OpenVINO_MAIN_SOURCE_DIR}/doc/html/index.html"
DEPENDS ie_docs
COMMENT "Open OpenVINO documentation"
VERBATIM)
set_target_properties(ie_docs_open PROPERTIES FOLDER docs)
endif()

View File

@@ -0,0 +1,13 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set(TARGET_NAME ie_docs_examples)
file(GLOB SOURCES *.cpp)
add_library(ie_docs_examples STATIC ${SOURCES})
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_plugin_api)
#add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})

View File

@@ -0,0 +1,68 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <threading/ie_itask_executor.hpp>
#include <cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp>
#include <memory>
using namespace InferenceEngine;
class AcceleratorSyncRequest : public InferRequestInternal {
public:
using Ptr = std::shared_ptr<AcceleratorSyncRequest>;
void Preprocess();
void WriteToDevice();
void RunOnDevice();
void ReadFromDevice();
void PostProcess();
};
// ! [async_infer_request:define_pipeline]
// Inherits from AsyncInferRequestThreadSafeDefault
class AcceleratorAsyncInferRequest : public AsyncInferRequestThreadSafeDefault {
// Store the pointer to the synchronous request and five executors
AcceleratorAsyncInferRequest(const AcceleratorSyncRequest::Ptr& syncRequest,
const ITaskExecutor::Ptr& preprocessExecutor,
const ITaskExecutor::Ptr& writeToDeviceExecutor,
const ITaskExecutor::Ptr& runOnDeviceExecutor,
const ITaskExecutor::Ptr& readFromDeviceExecutor,
const ITaskExecutor::Ptr& postProcessExecutor) :
AsyncInferRequestThreadSafeDefault(syncRequest, nullptr, nullptr),
_accSyncRequest{syncRequest},
_preprocessExecutor{preprocessExecutor},
_writeToDeviceExecutor{writeToDeviceExecutor},
_runOnDeviceExecutor{runOnDeviceExecutor},
_readFromDeviceExecutor{readFromDeviceExecutor},
_postProcessExecutor{postProcessExecutor}
{
// Five pipeline stages of synchronous infer request are run by different executors
_pipeline = {
{ _preprocessExecutor , [this] {
_accSyncRequest->Preprocess();
}},
{ _writeToDeviceExecutor , [this] {
_accSyncRequest->WriteToDevice();
}},
{ _runOnDeviceExecutor , [this] {
_accSyncRequest->RunOnDevice();
}},
{ _readFromDeviceExecutor , [this] {
_accSyncRequest->ReadFromDevice();
}},
{ _postProcessExecutor , [this] {
_accSyncRequest->PostProcess();
}},
};
}
// As all stages use _accSyncRequest member we should wait for all stages tasks before the destructor destroy this member.
~AcceleratorAsyncInferRequest() {
StopAndWait();
}
AcceleratorSyncRequest::Ptr _accSyncRequest;
ITaskExecutor::Ptr _preprocessExecutor, _writeToDeviceExecutor, _runOnDeviceExecutor, _readFromDeviceExecutor, _postProcessExecutor;
};
// ! [async_infer_request:define_pipeline]

View File

@@ -0,0 +1,53 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <threading/ie_cpu_streams_executor.hpp>
#include <memory>
#include <future>
#include <iostream>
void example1() {
// ! [itask_executor:define_pipeline]
// std::promise is move only object so to satisfy copy callable constraint we use std::shared_ptr
auto promise = std::make_shared<std::promise<void>>();
// When the promise is created we can get std::future to wait the result
auto future = promise->get_future();
// Rather simple task
InferenceEngine::Task task = [] {std::cout << "Some Output" << std::endl; };
// Create an executor
InferenceEngine::ITaskExecutor::Ptr taskExecutor = std::make_shared<InferenceEngine::CPUStreamsExecutor>();
if (taskExecutor == nullptr) {
// ProcessError(e);
return;
}
// We capture the task and the promise. When the task is executed in the task executor context
// we munually call std::promise::set_value() method
taskExecutor->run([task, promise] {
std::exception_ptr currentException;
try {
task();
} catch(...) {
// If there is some exceptions store the pointer to current exception
currentException = std::current_exception();
}
if (nullptr == currentException) {
promise->set_value(); // <-- If there is no problems just call std::promise::set_value()
} else {
promise->set_exception(currentException); // <-- If there is an exception forward it to std::future object
}
});
// To wait the task completion we call std::future::wait method
future.wait(); // The current thread will be blocked here and wait when std::promise::set_value()
// or std::promise::set_exception() method will be called.
// If the future store the exception it will be rethrown in std::future::get method
try {
future.get();
} catch(std::exception& /*e*/) {
// ProcessError(e);
}
// ! [itask_executor:define_pipeline]
}

View File

@@ -0,0 +1,18 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# [cmake:extension]
set(TARGET_NAME "template_extension")
find_package(ngraph REQUIRED)
find_package(InferenceEngine REQUIRED)
file(GLOB_RECURSE SRC *.cpp)
add_library(${TARGET_NAME} SHARED ${SRC})
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_EXTENSION_API)
target_link_libraries(${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES}
${NGRAPH_LIBRARIES})
# [cmake:extension]

View File

@@ -0,0 +1,124 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "cpu_kernel.hpp"
#include "op.hpp"
#include <details/ie_exception.hpp>
#include <ie_layouts.h>
using namespace TemplateExtension;
//! [cpu_implementation:ctor]
OpImplementation::OpImplementation(const std::shared_ptr<ngraph::Node> &node) {
try {
auto castedNode = std::dynamic_pointer_cast<Operation>(node);
if (!castedNode)
THROW_IE_EXCEPTION << "Cannot create implementation for unknown operation!";
if (castedNode->inputs().size() != 1 || castedNode->outputs().size() != 1)
THROW_IE_EXCEPTION << "Cannot create implementation for operation with incorrect number of inputs or outputs!";
if (castedNode->get_input_partial_shape(0).is_dynamic() || castedNode->get_output_partial_shape(0).is_dynamic())
THROW_IE_EXCEPTION << "Cannot create implementation for op with dynamic shapes!";
if (castedNode->get_input_shape(0).size() != 4 || castedNode->get_output_shape(0).size() != 4)
THROW_IE_EXCEPTION << "Operation supports only 4d tensors for input and output.";
if (castedNode->get_input_element_type(0) != ngraph::element::f32 || castedNode->get_output_element_type(0) != ngraph::element::f32)
THROW_IE_EXCEPTION << "Operation supports only FP32 tensors.";
add = castedNode->getAddAttr();
} catch (InferenceEngine::details::InferenceEngineException& ex) {
error = ex.what();
}
}
//! [cpu_implementation:ctor]
//! [cpu_implementation:getSupportedConfigurations]
InferenceEngine::StatusCode OpImplementation::getSupportedConfigurations(std::vector<InferenceEngine::LayerConfig> &conf,
InferenceEngine::ResponseDesc *resp) noexcept {
auto createConfig = [](const InferenceEngine::SizeVector inShape, const InferenceEngine::SizeVector& outShape, bool planar) {
InferenceEngine::LayerConfig config;
config.dynBatchSupport = false;
InferenceEngine::DataConfig inData;
InferenceEngine::DataConfig outData;
InferenceEngine::SizeVector order = {0, 1, 2, 3};
// Allow any offset before data
size_t offset((std::numeric_limits<size_t>::max)());
if (planar) {
inData.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32, inShape, {inShape, order, offset});
config.inConfs.push_back(inData);
outData.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32, outShape, {outShape, order, offset});
config.outConfs.push_back(outData);
} else {
// Add blocked (nChw8c) format
auto div_up = [](const int a, const int b) -> int {
if (!b)
return 0;
return (a + b - 1) / b;
};
order.push_back(1);
InferenceEngine::SizeVector inBlkDims = inShape;
inBlkDims[1] = div_up(inBlkDims[1], 8);
inBlkDims.push_back(8);
InferenceEngine::SizeVector outBlkDims = outShape;
outBlkDims[1] = div_up(outBlkDims[1], 8);
outBlkDims.push_back(8);
inData.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32, inShape, {inBlkDims, order, offset});
config.inConfs.push_back(inData);
outData.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32, outShape, {outBlkDims, order, offset});
config.outConfs.push_back(outData);
}
return config;
};
if (!error.empty()) {
if (resp) {
strncpy(resp->msg, error.c_str(), sizeof(resp->msg) - 1);
resp->msg[sizeof(resp->msg)-1] = 0;
}
return InferenceEngine::GENERAL_ERROR;
}
// Add planar format
conf.emplace_back(createConfig(inShape, outShape, true));
// Add blocked format nChw8c
conf.emplace_back(createConfig(inShape, outShape, false));
return InferenceEngine::OK;
}
//! [cpu_implementation:getSupportedConfigurations]
//! [cpu_implementation:init]
InferenceEngine::StatusCode OpImplementation::init(InferenceEngine::LayerConfig &config, InferenceEngine::ResponseDesc *resp) noexcept {
try {
if (config.inConfs.size() != 1 || config.outConfs.size() != 1) {
THROW_IE_EXCEPTION << "Operation cannot be initialized with incorrect number of inputs/outputs!";
}
if (config.inConfs[0].desc.getDims().size() != 4 || config.outConfs[0].desc.getDims().size() != 4) {
THROW_IE_EXCEPTION << "Operation can be initialized only with 4d input/output tensors!";
}
if (config.outConfs[0].desc.getPrecision() != InferenceEngine::Precision::FP32 ||
config.inConfs[0].desc.getPrecision() != InferenceEngine::Precision::FP32) {
THROW_IE_EXCEPTION << "Operation supports only FP32 precisions!";
}
} catch (InferenceEngine::details::InferenceEngineException& ex) {
if (resp) {
strncpy(resp->msg, error.c_str(), sizeof(resp->msg) - 1);
resp->msg[sizeof(resp->msg)-1] = 0;
}
return InferenceEngine::GENERAL_ERROR;
}
return InferenceEngine::OK;
}
//! [cpu_implementation:init]
//! [cpu_implementation:execute]
InferenceEngine::StatusCode OpImplementation::execute(std::vector<InferenceEngine::Blob::Ptr> &inputs,
std::vector<InferenceEngine::Blob::Ptr> &outputs,
InferenceEngine::ResponseDesc *resp) noexcept {
const float* src_data = inputs[0]->cbuffer().as<const float *>() + inputs[0]->getTensorDesc().getBlockingDesc().getOffsetPadding();
float *dst_data = outputs[0]->buffer().as<float *>() + outputs[0]->getTensorDesc().getBlockingDesc().getOffsetPadding();
for (size_t i = 0; i < inputs[0]->size(); i++) {
dst_data[i] = src_data[i] + add;
}
return InferenceEngine::OK;
}
//! [cpu_implementation:execute]

View File

@@ -0,0 +1,31 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <ie_iextension.h>
#include <ngraph/ngraph.hpp>
namespace TemplateExtension {
//! [cpu_implementation:header]
class OpImplementation : public InferenceEngine::ILayerExecImpl {
public:
explicit OpImplementation(const std::shared_ptr<ngraph::Node>& node);
InferenceEngine::StatusCode getSupportedConfigurations(std::vector<InferenceEngine::LayerConfig> &conf,
InferenceEngine::ResponseDesc *resp) noexcept override;
InferenceEngine::StatusCode init(InferenceEngine::LayerConfig &config,
InferenceEngine::ResponseDesc *resp) noexcept override;
InferenceEngine::StatusCode execute(std::vector<InferenceEngine::Blob::Ptr> &inputs,
std::vector<InferenceEngine::Blob::Ptr> &outputs,
InferenceEngine::ResponseDesc *resp) noexcept override;
private:
int64_t add;
ngraph::Shape inShape;
ngraph::Shape outShape;
std::string error;
};
//! [cpu_implementation:header]
} // namespace TemplateExtension

View File

@@ -0,0 +1,73 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "extension.hpp"
#include "cpu_kernel.hpp"
#include "op.hpp"
#include <ngraph/factory.hpp>
#include <ngraph/opsets/opset.hpp>
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
using namespace TemplateExtension;
//! [extension:GetVersion]
void Extension::GetVersion(const InferenceEngine::Version *&versionInfo) const noexcept {
static InferenceEngine::Version ExtensionDescription = {
{1, 0}, // extension API version
"1.0",
"template_ext" // extension description message
};
versionInfo = &ExtensionDescription;
}
//! [extension:GetVersion]
//! [extension:getOpSets]
std::map<std::string, ngraph::OpSet> Extension::getOpSets() {
std::map<std::string, ngraph::OpSet> opsets;
ngraph::OpSet opset;
opset.insert<Operation>();
opsets["custom_opset"] = opset;
return opsets;
}
//! [extension:getOpSets]
//! [extension:getImplTypes]
std::vector<std::string> Extension::getImplTypes(const std::shared_ptr<ngraph::Node> &node) {
if (std::dynamic_pointer_cast<Operation>(node)) {
return {"CPU"};
}
return {};
}
//! [extension:getImplTypes]
//! [extension:getImplementation]
InferenceEngine::ILayerImpl::Ptr Extension::getImplementation(const std::shared_ptr<ngraph::Node> &node, const std::string &implType) {
if (std::dynamic_pointer_cast<Operation>(node) && implType == "CPU") {
return std::make_shared<OpImplementation>(node);
}
return nullptr;
}
//! [extension:getImplementation]
//! [extension:CreateExtension]
// Exported function
INFERENCE_EXTENSION_API(InferenceEngine::StatusCode) InferenceEngine::CreateExtension(InferenceEngine::IExtension *&ext,
InferenceEngine::ResponseDesc *resp) noexcept {
try {
ext = new Extension();
return OK;
} catch (std::exception &ex) {
if (resp) {
std::string err = ((std::string) "Couldn't create extension: ") + ex.what();
err.copy(resp->msg, 255);
}
return InferenceEngine::GENERAL_ERROR;
}
}
//! [extension:CreateExtension]

View File

@@ -0,0 +1,31 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <ie_iextension.h>
#include <ie_api.h>
#include <ngraph/ngraph.hpp>
#include <memory>
#include <vector>
#include <string>
#include <map>
//! [extension:header]
namespace TemplateExtension {
class Extension : public InferenceEngine::IExtension {
public:
Extension() = default;
void GetVersion(const InferenceEngine::Version*& versionInfo) const noexcept override;
void Unload() noexcept override {}
void Release() noexcept override { delete this; }
std::map<std::string, ngraph::OpSet> getOpSets() override;
std::vector<std::string> getImplTypes(const std::shared_ptr<ngraph::Node>& node) override;
InferenceEngine::ILayerImpl::Ptr getImplementation(const std::shared_ptr<ngraph::Node>& node, const std::string& implType) override;
};
} // namespace TemplateExtension
//! [extension:header]

View File

@@ -0,0 +1,38 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "op.hpp"
using namespace TemplateExtension;
constexpr ngraph::NodeTypeInfo Operation::type_info;
//! [op:ctor]
Operation::Operation(const ngraph::Output<ngraph::Node> &arg, int64_t add) : Op({arg}), add(add) {
constructor_validate_and_infer_types();
}
//! [op:ctor]
//! [op:validate]
void Operation::validate_and_infer_types() {
// Operation doesn't change shapes end element type
set_output_type(0, get_input_element_type(0), get_input_partial_shape(0));
}
//! [op:validate]
//! [op:copy]
std::shared_ptr<ngraph::Node> Operation::copy_with_new_args(const ngraph::NodeVector &new_args) const {
if (new_args.size() != 1) {
throw ngraph::ngraph_error("Incorrect number of new arguments");
}
return std::make_shared<Operation>(new_args.at(0), add);
}
//! [op:copy]
//! [op:visit_attributes]
bool Operation::visit_attributes(ngraph::AttributeVisitor &visitor) {
visitor.on_attribute("add", add);
return true;
}
//! [op:visit_attributes]

View File

@@ -0,0 +1,29 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <ngraph/ngraph.hpp>
//! [op:header]
namespace TemplateExtension {
class Operation : public ngraph::op::Op {
public:
static constexpr ngraph::NodeTypeInfo type_info{"Template", 0};
const ngraph::NodeTypeInfo& get_type_info() const override { return type_info; }
Operation() = default;
Operation(const ngraph::Output<ngraph::Node>& arg, int64_t add);
void validate_and_infer_types() override;
std::shared_ptr<ngraph::Node> copy_with_new_args(const ngraph::NodeVector& new_args) const override;
bool visit_attributes(ngraph::AttributeVisitor& visitor) override;
int64_t getAddAttr() { return add; }
private:
int64_t add;
};
//! [op:header]
} // namespace TemplateExtension

View File

@@ -0,0 +1,39 @@
# Copyright (C) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# [cmake:main]
if (APPLE)
# due to https://cmake.org/cmake/help/v3.12/policy/CMP0068.html
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
else()
cmake_minimum_required(VERSION 3.7.2 FATAL_ERROR)
endif()
project(InferenceEngineTemplatePlugin)
set(IE_MAIN_TEMPLATE_PLUGIN_SOURCE_DIR ${InferenceEngineTemplatePlugin_SOURCE_DIR})
find_package(InferenceEngineDeveloperPackage REQUIRED)
add_subdirectory(src)
if(ENABLE_TESTS)
include(CTest)
enable_testing()
if(ENABLE_FUNCTIONAL_TESTS)
add_subdirectory(tests_deprecated/functional)
add_subdirectory(tests/functional)
endif()
if(ENABLE_BEH_TESTS)
add_subdirectory(tests_deprecated/behavior)
endif()
endif()
# [cmake:main]
# install
# ATTENTION: uncomment to install component
# ie_cpack(template)

View File

@@ -0,0 +1,18 @@
# template-plugin
Template Plugin for Inference Engine which demonstrates basics of how Inference Engine plugin can be built and implemented on top of Inference Engine Developer Package and Plugin API.
## How to build
```bash
$ cd $DLDT_HOME
$ mkdir $DLDT_HOME/build
$ cd $DLDT_HOME/build
$ cmake -DENABLE_TESTS=ON -DENABLE_BEH_TESTS=ON -DENABLE_FUNCTIONAL_TESTS=ON ..
$ make -j8
$ cd $TEMPLATE_PLUGIN_HOME
$ mkdir $TEMPLATE_PLUGIN_HOME/build
$ cd $TEMPLATE_PLUGIN_HOME/build
$ cmake -DInferenceEngineDeveloperPackage_DIR=$DLDT_HOME/build ..
$ make -j8
```

View File

@@ -0,0 +1,59 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief A header that defines advanced related properties for DLIA plugins.
* These properties should be used in SetConfig() and LoadNetwork() methods of plugins
*
* @file dlia_config.hpp
*/
#pragma once
#include <string>
#include "ie_plugin_config.hpp"
namespace InferenceEngine {
namespace TemplateMetrics {
/**
* @def TEMPLATE_METRIC_VALUE(name)
* @brief Shortcut for defining Template metric values
*/
#define TEMPLATE_METRIC_VALUE(name) InferenceEngine::TemplateMetrics::name
#define DECLARE_TEMPLATE_METRIC_VALUE(name) static constexpr auto name = #name
// ! [public_header:metrics]
/**
* @brief Defines whether current Template device instance supports hardware blocks for fast convolution computations.
*/
DECLARE_TEMPLATE_METRIC_VALUE(HARDWARE_CONVOLUTION);
// ! [public_header:metrics]
} // namespace TemplateMetrics
namespace TemplateConfigParams {
/**
* @def TEMPLATE_CONFIG_KEY(name)
* @brief Shortcut for defining Template device configuration keys
*/
#define TEMPLATE_CONFIG_KEY(name) InferenceEngine::TemplateConfigParams::_CONFIG_KEY(TEMPLATE_##name)
#define DECLARE_TEMPLATE_CONFIG_KEY(name) DECLARE_CONFIG_KEY(TEMPLATE_##name)
#define DECLARE_TEMPLATE_CONFIG_VALUE(name) DECLARE_CONFIG_VALUE(TEMPLATE_##name)
/**
* @brief The key to define the type of transformations for TEMPLATE inputs and outputs.
* TEMPLATE use custom data layout for input and output blobs. IE TEMPLATE Plugin provides custom
* optimized version of transformation functions that do not use OpenMP and much more faster
* than native TEMPLATE functions. Values: "NO" - optimized plugin transformations
* are used, "YES" - native TEMPLATE transformations are used.
*/
DECLARE_TEMPLATE_CONFIG_KEY(ANY_CONFIG_KEY);
} // namespace TemplateConfigParams
} // namespace InferenceEngine

View File

@@ -0,0 +1,43 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# [cmake:plugin]
set(TARGET_NAME "templatePlugin")
if(ENABLE_LTO)
ie_enable_lto()
endif()
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
# adds a shared library with plugin
ie_add_plugin(NAME ${TARGET_NAME}
DEVICE_NAME "TEMPLATE"
SOURCES ${SOURCES} ${HEADERS}
SKIP_INSTALL # ATTENTION: uncomment to install component
VERSION_DEFINES_FOR template_plugin.cpp)
target_include_directories(${TARGET_NAME} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}"
"${IE_MAIN_TEMPLATE_PLUGIN_SOURCE_DIR}/include")
target_link_libraries(${TARGET_NAME} PRIVATE IE::inference_engine IE::inference_engine_transformations ${NGRAPH_LIBRARIES} ${INTEL_ITT_LIBS})
# ATTENTION: uncomment to register a plugin in the plugins.xml file
# ie_register_plugins(MAIN_TARGET ${TARGET_NAME}
# POSSIBLE_PLUGINS ${TARGET_NAME})
# [cmake:plugin]
# ATTENTION: uncomment to install component
# install
# set(component_name template)
# ie_cpack_add_component(${component_name} REQUIRED)
# install(TARGETS ${TARGET_NAME}
# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH}
# ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH}
# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH}
# COMPONENT ${component_name})

View File

@@ -0,0 +1,44 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <utility>
#include <ie_profiling.hpp>
#include "template_async_infer_request.hpp"
#include "template_executable_network.hpp"
using namespace TemplatePlugin;
// ! [async_infer_request:ctor]
TemplateAsyncInferRequest::TemplateAsyncInferRequest(
const TemplateInferRequest::Ptr& inferRequest,
const InferenceEngine::ITaskExecutor::Ptr& cpuTaskExecutor,
const InferenceEngine::ITaskExecutor::Ptr& waitExecutor,
const InferenceEngine::ITaskExecutor::Ptr& callbackExecutor) :
AsyncInferRequestThreadSafeDefault(inferRequest, cpuTaskExecutor, callbackExecutor),
_inferRequest(inferRequest), _waitExecutor(waitExecutor) {
_pipeline = {
{cpuTaskExecutor, [this] {
IE_PROFILING_AUTO_SCOPE(PreprocessingAndStartPipeline)
_inferRequest->inferPreprocess();
_inferRequest->startPipeline();
}},
{_waitExecutor, [this] {
IE_PROFILING_AUTO_SCOPE(WaitPipeline)
_inferRequest->waitPipeline();
}},
{cpuTaskExecutor, [this] {
IE_PROFILING_AUTO_SCOPE(Postprocessing)
_inferRequest->inferPostprocess();
}}
};
}
// ! [async_infer_request:ctor]
// ! [async_infer_request:dtor]
TemplateAsyncInferRequest::~TemplateAsyncInferRequest() {
InferenceEngine::AsyncInferRequestThreadSafeDefault::StopAndWait();
}
// ! [async_infer_request:dtor]

View File

@@ -0,0 +1,30 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp>
#include "template_infer_request.hpp"
namespace TemplatePlugin {
// ! [async_infer_request:header]
class TemplateAsyncInferRequest : public InferenceEngine::AsyncInferRequestThreadSafeDefault {
public:
TemplateAsyncInferRequest(const TemplateInferRequest::Ptr& inferRequest,
const InferenceEngine::ITaskExecutor::Ptr& taskExecutor,
const InferenceEngine::ITaskExecutor::Ptr& waitExecutor,
const InferenceEngine::ITaskExecutor::Ptr& callbackExecutor);
~TemplateAsyncInferRequest() override;
private:
TemplateInferRequest::Ptr _inferRequest;
InferenceEngine::ITaskExecutor::Ptr _waitExecutor;
};
// ! [async_infer_request:header]
} // namespace TemplatePlugin

View File

@@ -0,0 +1,45 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <string>
#include <vector>
#include <algorithm>
#include <ie_util_internal.hpp>
#include <ie_plugin_config.hpp>
#include <file_utils.h>
#include <cpp_interfaces/exception2status.hpp>
#include "template_config.hpp"
using namespace TemplatePlugin;
Configuration::Configuration() { }
Configuration::Configuration(const ConfigMap& config, const Configuration & defaultCfg, bool throwOnUnsupported) {
*this = defaultCfg;
for (auto&& c : config) {
const auto& key = c.first;
const auto& value = c.second;
if (CONFIG_KEY(DEVICE_ID) == key) {
deviceId = std::stoi(value);
} else if (CONFIG_KEY(PERF_COUNT) == key) {
perfCount = (CONFIG_VALUE(YES) == value);
} else if (throwOnUnsupported) {
THROW_IE_EXCEPTION << NOT_FOUND_str << ": " << key;
}
}
}
InferenceEngine::Parameter Configuration::Get(const std::string& name) const {
if (name == CONFIG_KEY(DEVICE_ID)) {
return {std::to_string(deviceId)};
} else if (name == CONFIG_KEY(PERF_COUNT)) {
return {perfCount};
} else {
THROW_IE_EXCEPTION << NOT_FOUND_str << ": " << name;
}
}

View File

@@ -0,0 +1,40 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <ie_parameter.hpp>
namespace TemplatePlugin {
template<typename T>
using IOMap = std::unordered_map<std::string, T>;
// ! [configuration:header]
using ConfigMap = std::map<std::string, std::string>;
struct Configuration {
Configuration();
Configuration(const Configuration&) = default;
Configuration(Configuration&&) = default;
Configuration& operator=(const Configuration&) = default;
Configuration& operator=(Configuration&&) = default;
explicit Configuration(const ConfigMap& config, const Configuration & defaultCfg = {}, const bool throwOnUnsupported = true);
InferenceEngine::Parameter Get(const std::string& name) const;
// Plugin configuration parameters
int deviceId = 0;
bool perfCount = true;
};
// ! [configuration:header]
} // namespace TemplatePlugin

View File

@@ -0,0 +1,167 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <atomic>
#include <set>
#include <utility>
#include <algorithm>
#include <memory>
#include <string>
#include <vector>
#include <ie_metric_helpers.hpp>
#include <ie_util_internal.hpp>
#include <ie_plugin_config.hpp>
#include <network_serializer.h>
#include <threading/ie_executor_manager.hpp>
#include <details/ie_cnn_network_tools.h>
#include <ngraph/specialize_function.hpp>
#include <ngraph/pass/manager.hpp>
#include <ngraph/pass/constant_folding.hpp>
#include <transformations/convert_divide.hpp>
#include "template_plugin.hpp"
#include "template_executable_network.hpp"
using namespace TemplatePlugin;
// ! [executable_network:ctor_cnnnetwork]
TemplatePlugin::ExecutableNetwork::ExecutableNetwork(InferenceEngine::ICNNNetwork& network,
const Configuration& cfg):
_name(network.getName()),
_cfg(cfg),
_waitExecutor(InferenceEngine::ExecutorManager::getInstance()->getExecutor("Template")) {
// TODO: if your plugin supports device ID (more that single instance of device can be on host machine)
// you should select proper device based on KEY_DEVICE_ID or automatic behavior
// In this case, _waitExecutor should also be created per device.
try {
if (std::shared_ptr<const ngraph::Function> ngraphFunction = network.getFunction()) {
CompileGraph(ngraphFunction);
} else {
THROW_IE_EXCEPTION << "TEMPLATE plugin can compile only IR v10 networks";
}
}
catch (const InferenceEngineException & e) {
throw e;
}
catch (const std::exception & e) {
THROW_IE_EXCEPTION << "Standard exception from compilation library: " << e.what();
}
catch (...) {
THROW_IE_EXCEPTION << "Generic exception is thrown";
}
}
// ! [executable_network:ctor_cnnnetwork]
// ! [executable_network:ctor_import_stream]
TemplatePlugin::ExecutableNetwork::ExecutableNetwork(std::istream & model,
const Configuration& cfg) :
_cfg(cfg) {
// TODO: since Import network is not a mandatory functionality, this ctor can just be removed
}
// ! [executable_network:ctor_import_stream]
// ! [executable_network:compile_graph]
void TemplatePlugin::ExecutableNetwork::CompileGraph(const std::shared_ptr<const ngraph::Function> & ngraphFunction) {
// TODO: perform actual graph compilation taking `_cfg` into account
// 1.Copy ngraph::Function first to apply some transformations later in
// ExecutableNetwork::CompileGraph, which modify original ngraph::Function
const bool shareConsts = false, constFolding = false;
std::vector<::ngraph::element::Type> new_types;
std::vector<::ngraph::PartialShape> new_shapes;
for (const auto &parameter : ngraphFunction->get_parameters()) {
new_shapes.emplace_back(parameter->get_partial_shape());
new_types.emplace_back(parameter->get_element_type());
}
auto copyFunction = ngraph::specialize_function(std::const_pointer_cast<ngraph::Function>(ngraphFunction),
new_types, new_shapes, std::vector<void *>(new_types.size(), nullptr), constFolding, shareConsts);
// 2. Perform common and device-specific transformations
ngraph::pass::Manager passManager;
// Example: register standard ngraph transformation from ngraph::ngraph
passManager.register_pass<ngraph::pass::ConstantFolding>();
// Example: register inference engine optimization transformation for IE::inference_engine_transformations
passManager.register_pass<ngraph::pass::ConvertDivide>();
// Register any other transformations
// ..
// After `run_passes`, we have the transformed function, where operations match device operations,
// and we can create device hardware-dependent graph
passManager.run_passes(copyFunction);
// 3. Iterate over operations and create hardware-specific ngraph
for (const auto& op : copyFunction->get_ordered_ops()) {
// TODO: map ngraph `op` to device operation
}
// 4. Perform any other steps like allocation and filling device buffers, and so on
}
// ! [executable_network:compile_graph]
// ! [executable_network:create_infer_request_impl]
InferenceEngine::InferRequestInternal::Ptr TemplatePlugin::ExecutableNetwork::CreateInferRequestImpl(InferenceEngine::InputsDataMap networkInputs,
InferenceEngine::OutputsDataMap networkOutputs) {
return std::make_shared<TemplateInferRequest>(networkInputs, networkOutputs, std::static_pointer_cast<ExecutableNetwork>(shared_from_this()));
}
// ! [executable_network:create_infer_request_impl]
// ! [executable_network:create_infer_request]
void TemplatePlugin::ExecutableNetwork::CreateInferRequest(IInferRequest::Ptr& asyncRequest) {
auto internalRequest = CreateInferRequestImpl(_networkInputs, _networkOutputs);
auto asyncThreadSafeImpl = std::make_shared<TemplateAsyncInferRequest>(std::static_pointer_cast<TemplateInferRequest>(internalRequest),
_taskExecutor, _waitExecutor, _callbackExecutor);
asyncRequest.reset(new InferenceEngine::InferRequestBase<TemplateAsyncInferRequest>(asyncThreadSafeImpl),
[](InferenceEngine::IInferRequest *p) { p->Release(); });
asyncThreadSafeImpl->SetPointerToPublicInterface(asyncRequest);
}
// ! [executable_network:create_infer_request]
// ! [executable_network:get_config]
void TemplatePlugin::ExecutableNetwork::GetConfig(const std::string &name, Parameter &result, ResponseDesc *resp) const {
// TODO: return more supported values for config keys
if (name == CONFIG_KEY(DEVICE_ID) ||
name == CONFIG_KEY(PERF_COUNT)) {
result = _cfg.Get(name);
} else {
THROW_IE_EXCEPTION << "Unsupported ExecutableNetwork config key: " << name;
}
}
// ! [executable_network:get_config]
// ! [executable_network:get_metric]
void TemplatePlugin::ExecutableNetwork::GetMetric(const std::string &name, InferenceEngine::Parameter &result, InferenceEngine::ResponseDesc *) const {
// TODO: return more supported values for metrics
if (METRIC_KEY(SUPPORTED_METRICS) == name) {
result = IE_SET_METRIC(SUPPORTED_METRICS, std::vector<std::string>{
METRIC_KEY(NETWORK_NAME),
METRIC_KEY(SUPPORTED_METRICS),
METRIC_KEY(SUPPORTED_CONFIG_KEYS),
METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS)});
} else if (METRIC_KEY(SUPPORTED_CONFIG_KEYS) == name) {
result = IE_SET_METRIC(SUPPORTED_CONFIG_KEYS, std::vector<std::string>{
CONFIG_KEY(DEVICE_ID),
CONFIG_KEY(PERF_COUNT)});
} else if (METRIC_KEY(NETWORK_NAME) == name) {
result = IE_SET_METRIC(NETWORK_NAME, _name);
} else if (METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS) == name) {
// TODO: fill with actual number
unsigned int value = 1;
result = IE_SET_METRIC(OPTIMAL_NUMBER_OF_INFER_REQUESTS, value);
} else {
THROW_IE_EXCEPTION << "Unsupported ExecutableNetwork metric: " << name;
}
}
// ! [executable_network:get_metric]
// ! [executable_network:export_impl]
void TemplatePlugin::ExecutableNetwork::ExportImpl(std::ostream& dlaModel) {
// TODO: Code which exports graph from std::ostream
}
// ! [executable_network:export_impl]

View File

@@ -0,0 +1,68 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <utility>
#include <tuple>
#include <memory>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <ie_common.h>
#include <cpp_interfaces/impl/ie_executable_network_thread_safe_default.hpp>
#include <cnn_network_impl.hpp>
#include <threading/ie_itask_executor.hpp>
#include <ngraph/function.hpp>
#include "template_config.hpp"
#include "template_infer_request.hpp"
#include "template_async_infer_request.hpp"
namespace TemplatePlugin {
class Engine;
/**
* @class ExecutableNetwork
* @brief Interface of executable network
*/
// ! [executable_network:header]
class ExecutableNetwork : public InferenceEngine::ExecutableNetworkThreadSafeDefault {
public:
ExecutableNetwork(InferenceEngine::ICNNNetwork& network,
const Configuration& cfg);
ExecutableNetwork(std::istream & model,
const Configuration& cfg);
~ExecutableNetwork() override = default;
// Methods from a base class ExecutableNetworkThreadSafeDefault
void ExportImpl(std::ostream& model) override;
InferenceEngine::InferRequestInternal::Ptr CreateInferRequestImpl(InferenceEngine::InputsDataMap networkInputs,
InferenceEngine::OutputsDataMap networkOutputs) override;
void CreateInferRequest(InferenceEngine::IInferRequest::Ptr &asyncRequest) override;
void GetMetric(const std::string &name, InferenceEngine::Parameter &result, InferenceEngine::ResponseDesc *resp) const override;
void GetConfig(const std::string &name, InferenceEngine::Parameter &result, InferenceEngine::ResponseDesc *resp) const override;
std::atomic<std::size_t> _requestId = {0};
std::string _name;
Configuration _cfg;
private:
void CompileGraph(const std::shared_ptr<const ngraph::Function> & ngraphFunction);
std::shared_ptr<Engine> _plugin;
InferenceEngine::ITaskExecutor::Ptr _waitExecutor;
};
// ! [executable_network:header]
} // namespace TemplatePlugin

View File

@@ -0,0 +1,224 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <utility>
#include <algorithm>
#include <memory>
#include <string>
#include <map>
#include <ie_blob.h>
#include <ie_plugin.hpp>
#include <description_buffer.hpp>
#include <debug.h>
#include <ie_layouts.h>
#include <threading/ie_executor_manager.hpp>
#include <blob_transform.hpp>
#include <ie_parallel.hpp>
#include <ie_memcpy.h>
#include <precision_utils.h>
#include <template/template_config.hpp>
#include "template_infer_request.hpp"
#include "template_executable_network.hpp"
#include "template_plugin.hpp"
using namespace TemplatePlugin;
using Time = std::chrono::high_resolution_clock;
using ns = std::chrono::nanoseconds;
using fsec = std::chrono::duration<float>;
// ! [infer_request:ctor]
TemplateInferRequest::TemplateInferRequest(const InferenceEngine::InputsDataMap& networkInputs,
const InferenceEngine::OutputsDataMap& networkOutputs,
const std::shared_ptr<TemplatePlugin::ExecutableNetwork>& executableNetwork) :
InferRequestInternal(networkInputs, networkOutputs),
_executableNetwork(executableNetwork) {
// TODO: allocate infer request device and host buffers if needed, fill actual list of profiling tasks
auto requestID = std::to_string(_executableNetwork->_requestId);
_executableNetwork->_requestId++;
std::string name = _executableNetwork->_name + "_Req" + requestID;
_profilingTask = { {
{ ProfilingTask("Template" + std::to_string(_executableNetwork->_cfg.deviceId) + "_" + name + "_Preprocess") },
{ ProfilingTask("Template" + std::to_string(_executableNetwork->_cfg.deviceId) + "_" + name + "_Postprocess") },
{ ProfilingTask("Template" + std::to_string(_executableNetwork->_cfg.deviceId) + "_" + name + "_StartPipline") },
{ ProfilingTask("Template" + std::to_string(_executableNetwork->_cfg.deviceId) + "_" + name + "_WaitPipline") },
} };
allocateDeviceBuffers();
allocateInputBlobs();
allocateOutputBlobs();
}
// ! [infer_request:ctor]
// ! [infer_request:dtor]
TemplateInferRequest::~TemplateInferRequest() {
_executableNetwork->_requestId--;
}
// ! [infer_request:dtor]
void TemplateInferRequest::allocateDeviceBuffers() {
// TODO: allocate device buffers if Template device is a remote one
}
void TemplateInferRequest::allocateInputBlobs() {
for (auto &networkInput : _networkInputs) {
SizeVector dims = networkInput.second->getTensorDesc().getDims();
Precision precision = networkInput.second->getTensorDesc().getPrecision();
Layout input_layout = networkInput.second->getInputData()->getLayout();
Blob::Ptr inputBlob;
Blob::Ptr inputBlobNCHW;
switch (precision) {
case Precision::FP32 :
inputBlobNCHW = inputBlob = InferenceEngine::make_shared_blob<float>({ precision, dims, input_layout });
if (input_layout == Layout::NHWC) {
inputBlobNCHW = InferenceEngine::make_shared_blob<float>({ precision, dims, Layout::NCHW });
}
break;
case Precision::FP16 :
case Precision::I16 :
inputBlobNCHW = inputBlob = InferenceEngine::make_shared_blob<int16_t>({ precision, dims, input_layout });
if (input_layout == Layout::NHWC) {
inputBlobNCHW = InferenceEngine::make_shared_blob<int16_t>({ precision, dims, Layout::NCHW });
}
break;
case Precision::U8 :
inputBlobNCHW = inputBlob = InferenceEngine::make_shared_blob<uint8_t>({ precision, dims, input_layout });
if (input_layout == Layout::NHWC) {
inputBlobNCHW = InferenceEngine::make_shared_blob<uint8_t>({ precision, dims, Layout::NCHW });
}
break;
default:
THROW_IE_EXCEPTION << "Unsupported network precision: " << precision
<< precision << "! Supported precisions are: FP32, FP16, I16, U8";
}
// allocate the input blob
inputBlob->allocate();
_inputs[networkInput.first] = inputBlob;
if (inputBlobNCHW != inputBlob) {
inputBlobNCHW->allocate();
}
_inputsNCHW[networkInput.first] = inputBlobNCHW;
}
}
void TemplateInferRequest::allocateOutputBlobs() {
for (auto &networkOutput : _networkOutputs) {
SizeVector dims = networkOutput.second->getTensorDesc().getDims();
Precision precision = networkOutput.second->getPrecision();
Blob::Ptr outputBlob;
// allocate the output blob
Blob::Ptr outputBlobNCHW;
switch (precision) {
case Precision::FP32 :
outputBlobNCHW = outputBlob = InferenceEngine::make_shared_blob<float>({ precision, dims, networkOutput.second->getLayout() });
if (networkOutput.second->getLayout() == Layout::NHWC) {
outputBlobNCHW = InferenceEngine::make_shared_blob<float>({ precision, dims, Layout::NCHW });
}
break;
case Precision::FP16 :
outputBlobNCHW = outputBlob = InferenceEngine::make_shared_blob<int16_t>({ precision, dims, networkOutput.second->getLayout() });
if (networkOutput.second->getLayout() == Layout::NHWC) {
outputBlobNCHW = InferenceEngine::make_shared_blob<int16_t>({ precision, dims, Layout::NCHW });
}
break;
default:
THROW_IE_EXCEPTION << PARAMETER_MISMATCH_str << "Unsupported output precision: "
<< precision << "! Supported precisions are: FP32, FP16";
}
// allocate the output blob
outputBlob->allocate();
_outputs[networkOutput.first] = outputBlob;
if (outputBlobNCHW != outputBlob) {
outputBlobNCHW->allocate();
}
_outputsNCHW[networkOutput.first] = outputBlobNCHW;
}
if (_networkOutputs.empty() || _networkInputs.empty()) {
THROW_IE_EXCEPTION << "Internal error: no information about network's output/input";
}
}
// ! [infer_request:infer_impl]
void TemplateInferRequest::InferImpl() {
// TODO: fill with actual list of pipeline stages, which are executed syncronously for sync infer requests
inferPreprocess();
startPipeline();
waitPipeline();
inferPostprocess();
}
// ! [infer_request:infer_impl]
// ! [infer_request:infer_preprocess]
void TemplateInferRequest::inferPreprocess() {
auto prev = Time::now();
// execute input pre-processing.
InferRequestInternal::execDataPreprocessing(_inputs);
for (auto &input : InferRequestInternal::_inputs) {
auto& src = input.second;
auto& dst = _inputsNCHW[input.first];
if (src != dst) {
if (src->getTensorDesc().getPrecision() == dst->getTensorDesc().getPrecision()
&& src->getTensorDesc().getDims() == dst->getTensorDesc().getDims()
&& src->getTensorDesc().getLayout() == dst->getTensorDesc().getLayout()) {
_inputsNCHW[input.first] = input.second;
} else { // Convert Layout to NCHW
InferenceEngine::blob_copy(src, dst);
}
}
}
// TODO: Preprocessing on inputs if needed: work _inputsNCHW
_inputPreprocessTime = static_cast<double>(std::chrono::duration_cast<ns>(Time::now() - prev).count());
}
// ! [infer_request:infer_preprocess]
void TemplateInferRequest::startPipeline() {
IE_PROFILING_AUTO_SCOPE_TASK(_profilingTask[StartPipeline])
// TODO: Start pipeline and fill _inputTransferTime, _executeTime, _outputTransferTime
}
void TemplateInferRequest::waitPipeline() {
IE_PROFILING_AUTO_SCOPE_TASK(_profilingTask[WaitPipeline])
auto prev = Time::now();
// TODO: Wait pipeline using driver API or other synronizations methods
_inputPreprocessTime = static_cast<double>(std::chrono::duration_cast<ns>(Time::now() - prev).count());
}
void TemplateInferRequest::inferPostprocess() {
IE_PROFILING_AUTO_SCOPE_TASK(_profilingTask[Postprocess])
auto prev = Time::now();
// TODO: perform post-processing and convert to NHWC layout
_outputPostProcessTime = static_cast<double>(std::chrono::duration_cast<ns>(Time::now() - prev).count());
}
// ! [infer_request:get_performance_counts]
void TemplateInferRequest::GetPerformanceCounts(std::map<std::string, InferenceEngineProfileInfo> &perfMap) const {
InferenceEngineProfileInfo info;
info.execution_index = 0;
info.status = InferenceEngineProfileInfo::EXECUTED;
info.cpu_uSec = info.realTime_uSec = _inputPreprocessTime / 1000;
perfMap["1. input preprocessing"] = info;
info.cpu_uSec = 0;
info.realTime_uSec = _inputTransferTime / 1000;
perfMap["2. input transfer to a device"] = info;
info.cpu_uSec = 0;
info.realTime_uSec = _executeTime / 1000;
perfMap["3. execution time"] = info;
info.cpu_uSec = 0;
info.realTime_uSec = _outputTransferTime / 1000;
perfMap["4. output transfer from a device"] = info;
info.cpu_uSec = info.realTime_uSec = _outputPostProcessTime / 1000;
perfMap["5. output postprocessing"] = info;
}
// ! [infer_request:get_performance_counts]

View File

@@ -0,0 +1,74 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <map>
#include <string>
#include <vector>
#include <memory>
#include <unordered_map>
#include <ie_common.h>
#include <ie_profiling.hpp>
#include <cpp_interfaces/impl/ie_infer_request_internal.hpp>
#include <cpp_interfaces/impl/ie_executable_network_internal.hpp>
#include <threading/ie_itask_executor.hpp>
#include "template_config.hpp"
namespace TemplatePlugin {
class ExecutableNetwork;
// ! [infer_request:header]
class TemplateInferRequest : public InferenceEngine::InferRequestInternal {
public:
typedef std::shared_ptr<TemplateInferRequest> Ptr;
TemplateInferRequest(const InferenceEngine::InputsDataMap& networkInputs,
const InferenceEngine::OutputsDataMap& networkOutputs,
const std::shared_ptr<ExecutableNetwork>& executableNetwork);
~TemplateInferRequest() override;
void InferImpl() override;
void GetPerformanceCounts(std::map<std::string, InferenceEngine::InferenceEngineProfileInfo>& perfMap) const override;
// pipeline methods-stages which are used in async infer request implementation and assigned to particular executor
void inferPreprocess();
void startPipeline();
void waitPipeline();
void inferPostprocess();
std::shared_ptr<ExecutableNetwork> _executableNetwork;
private:
void allocateDeviceBuffers();
void allocateInputBlobs();
void allocateOutputBlobs();
enum {
Preprocess,
Postprocess,
StartPipeline,
WaitPipeline,
numOfStages
};
std::array<InferenceEngine::ProfilingTask, numOfStages> _profilingTask;
InferenceEngine::BlobMap _inputsNCHW;
InferenceEngine::BlobMap _outputsNCHW;
// for performance counts
double _inputPreprocessTime = 0.0;
double _inputTransferTime = 0.0;
double _executeTime = 0.0;
double _outputTransferTime = 0.0;
double _outputPostProcessTime = 0.0;
};
// ! [infer_request:header]
} // namespace TemplatePlugin

View File

@@ -0,0 +1,193 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <utility>
#include <memory>
#include <vector>
#include <sstream>
#include <regex>
#include <string>
#include <map>
#include <ie_metric_helpers.hpp>
#include <details/ie_cnn_network_tools.h>
#include <ie_plugin_config.hpp>
#include <ie_util_internal.hpp>
#include <inference_engine.hpp>
#include <file_utils.h>
#include <cpp_interfaces/base/ie_plugin_base.hpp>
#include <cpp_interfaces/interface/ie_internal_plugin_config.hpp>
#include <threading/ie_executor_manager.hpp>
#include <graph_tools.hpp>
#include <ie_input_info.hpp>
#include <ie_layouts.h>
#include <hetero/hetero_plugin_config.hpp>
#include <template/template_config.hpp>
#include "template_plugin.hpp"
#include "template_executable_network.hpp"
#include "template_infer_request.hpp"
using namespace TemplatePlugin;
// ! [plugin:ctor]
Plugin::Plugin() {
// TODO: fill with actual device name
_pluginName = "TEMPLATE";
}
// ! [plugin:ctor]
// ! [plugin:load_exe_network_impl]
InferenceEngine::ExecutableNetworkInternal::Ptr Plugin::LoadExeNetworkImpl(const InferenceEngine::ICNNNetwork & network,
const ConfigMap &config) {
auto cfg = Configuration{ config, _cfg };
InferenceEngine::InputsDataMap networkInputs;
InferenceEngine::OutputsDataMap networkOutputs;
network.getInputsInfo(networkInputs);
network.getOutputsInfo(networkOutputs);
// TODO: check with precisions supported by Template device
for (auto networkOutput : networkOutputs) {
auto output_precision = networkOutput.second->getPrecision();
if (output_precision != Precision::FP32 &&
output_precision != Precision::FP16) {
THROW_IE_EXCEPTION << "Template device supports only FP16 and FP32 output precision.";
}
}
for (auto networkInput : networkInputs) {
auto input_precision = networkInput.second->getTensorDesc().getPrecision();
if (input_precision != InferenceEngine::Precision::FP32 &&
input_precision != InferenceEngine::Precision::FP16 &&
input_precision != InferenceEngine::Precision::I16 &&
input_precision != InferenceEngine::Precision::U8) {
THROW_IE_EXCEPTION << "Input image format " << input_precision << " is not supported yet.\n"
<< "Supported formats are: FP32, FP16, I16 and U8.";
}
}
auto clonedNetwork = cloneNet(network);
ConstTransformer transformator(clonedNetwork.get());
transformator.fullTrim();
return std::make_shared<ExecutableNetwork>(*clonedNetwork, cfg);
}
// ! [plugin:load_exe_network_impl]
// ! [plugin:import_network_impl]
InferenceEngine::ExecutableNetwork Plugin::ImportNetworkImpl(std::istream& model, const std::map<std::string, std::string>& config) {
// TODO: Import network from stream is not mandatory functionality;
// Can just throw an exception and remove the code below
Configuration exportedCfg;
// some code below which reads exportedCfg from `model` stream
// ..
auto cfg = Configuration(config, exportedCfg);
IExecutableNetwork::Ptr executableNetwork;
auto exec_network_impl = std::make_shared<ExecutableNetwork>(model, cfg);
executableNetwork.reset(new ExecutableNetworkBase<ExecutableNetworkInternal>(exec_network_impl),
[](InferenceEngine::details::IRelease *p) {p->Release(); });
return InferenceEngine::ExecutableNetwork{ executableNetwork };
}
// ! [plugin:import_network_impl]
// ! [plugin:query_network]
void Plugin::QueryNetwork(const ICNNNetwork &network, const ConfigMap& config, QueryNetworkResult &res) const {
Configuration cfg{config, _cfg, false};
res.rc = StatusCode::OK;
if (std::shared_ptr<const ngraph::Function> ngraphFunction = network.getFunction()) {
auto ops = ngraphFunction->get_ordered_ops();
for (auto&& op : ops) {
// TODO: investigate if an op is actually supported by Template device
bool supported = true;
if (supported) {
res.supportedLayersMap.insert({ op->get_friendly_name(), GetName() });
}
}
} else {
THROW_IE_EXCEPTION << "TEMPLATE plugin can query only IR v10 networks";
}
}
// ! [plugin:query_network]
// ! [plugin:add_extension]
void Plugin::AddExtension(InferenceEngine::IExtensionPtr /*extension*/) {
// TODO: add extensions if plugin supports extensions
}
// ! [plugin:add_extension]
// ! [plugin:set_config]
void Plugin::SetConfig(const ConfigMap &config) {
_cfg = Configuration{config, _cfg};
}
// ! [plugin:set_config]
// ! [plugin:get_config]
InferenceEngine::Parameter Plugin::GetConfig(const std::string& name, const std::map<std::string, InferenceEngine::Parameter> & /*options*/) const {
return _cfg.Get(name);
}
// ! [plugin:get_config]
// ! [plugin:get_metric]
InferenceEngine::Parameter Plugin::GetMetric(const std::string& name, const std::map<std::string, InferenceEngine::Parameter> & options) const {
if (METRIC_KEY(SUPPORTED_METRICS) == name) {
std::vector<std::string> supportedMetrics = {
METRIC_KEY(AVAILABLE_DEVICES),
METRIC_KEY(SUPPORTED_METRICS),
METRIC_KEY(SUPPORTED_CONFIG_KEYS),
METRIC_KEY(FULL_DEVICE_NAME),
METRIC_KEY(OPTIMIZATION_CAPABILITIES),
METRIC_KEY(RANGE_FOR_ASYNC_INFER_REQUESTS) };
IE_SET_METRIC_RETURN(SUPPORTED_METRICS, supportedMetrics);
} else if (METRIC_KEY(SUPPORTED_CONFIG_KEYS) == name) {
std::vector<std::string> confiKeys = {
CONFIG_KEY(DEVICE_ID),
CONFIG_KEY(PERF_COUNT) };
IE_SET_METRIC_RETURN(SUPPORTED_CONFIG_KEYS, confiKeys);
} else if (METRIC_KEY(AVAILABLE_DEVICES) == name) {
// TODO: fill list of available devices
std::vector<std::string> availableDevices = { "" };
IE_SET_METRIC_RETURN(AVAILABLE_DEVICES, availableDevices);
} else if (METRIC_KEY(FULL_DEVICE_NAME) == name) {
std::string name = "Template Device Full Name";
IE_SET_METRIC_RETURN(FULL_DEVICE_NAME, name);
} else if (METRIC_KEY(OPTIMIZATION_CAPABILITIES) == name) {
// TODO: fill actual list of supported capabilities: e.g. Template device supports only FP32
std::vector<std::string> capabilities = { METRIC_VALUE(FP32), TEMPLATE_METRIC_VALUE(HARDWARE_CONVOLUTION) };
IE_SET_METRIC_RETURN(OPTIMIZATION_CAPABILITIES, capabilities);
} else if (METRIC_KEY(RANGE_FOR_ASYNC_INFER_REQUESTS) == name) {
// TODO: fill with actual values
using uint = unsigned int;
IE_SET_METRIC_RETURN(RANGE_FOR_ASYNC_INFER_REQUESTS, std::make_tuple(uint{1}, uint{1}, uint{1}));
} else {
THROW_IE_EXCEPTION << "Unsupported device metric: " << name;
}
}
// ! [plugin:get_metric]
IE_SUPPRESS_DEPRECATED_START
// ! [plugin:create_plugin_engine]
INFERENCE_PLUGIN_API(StatusCode) CreatePluginEngine(IInferencePlugin *&plugin, ResponseDesc *resp) noexcept {
try {
plugin = make_ie_compatible_plugin({2, 1, CI_BUILD_NUMBER, "templatePlugin"},
std::make_shared<Plugin>());
return OK;
}
catch (std::exception &ex) {
return DescriptionBuffer(GENERAL_ERROR, resp) << ex.what();
}
}
// ! [plugin:create_plugin_engine]
IE_SUPPRESS_DEPRECATED_END

View File

@@ -0,0 +1,47 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <inference_engine.hpp>
#include <description_buffer.hpp>
#include <cpp_interfaces/impl/ie_plugin_internal.hpp>
#include <memory>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include "template_executable_network.hpp"
#include "template_config.hpp"
//! [plugin:header]
namespace TemplatePlugin {
class Plugin : public InferenceEngine::InferencePluginInternal {
public:
using Ptr = std::shared_ptr<Plugin>;
Plugin();
~Plugin() override = default;
void SetConfig(const std::map<std::string, std::string> &config) override;
void QueryNetwork(const InferenceEngine::ICNNNetwork &network,
const std::map<std::string, std::string>& config,
InferenceEngine::QueryNetworkResult &res) const override;
InferenceEngine::ExecutableNetworkInternal::Ptr
LoadExeNetworkImpl(const InferenceEngine::ICNNNetwork &network,
const std::map<std::string, std::string> &config) override;
void AddExtension(InferenceEngine::IExtensionPtr extension) override;
InferenceEngine::Parameter GetConfig(const std::string& name, const std::map<std::string, InferenceEngine::Parameter> & options) const override;
InferenceEngine::Parameter GetMetric(const std::string& name, const std::map<std::string, InferenceEngine::Parameter> & options) const override;
InferenceEngine::ExecutableNetwork ImportNetworkImpl(std::istream& model, const std::map<std::string, std::string>& config) override;
private:
Configuration _cfg;
};
} // namespace TemplatePlugin
//! [plugin:header]

View File

@@ -0,0 +1,18 @@
# Copyright (C) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
set(TARGET_NAME TemplateFuncTests)
addIeTargetTest(
NAME ${TARGET_NAME}
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDENCIES
templatePlugin
LINK_LIBRARIES
IE::funcSharedTests
ADD_CPPLINT
LABELS
TEMPLATE
)

View File

@@ -0,0 +1,49 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "multi-device/multi_device_config.hpp"
#include "behavior/config.hpp"
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
IncorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
IncorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
CorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, CorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
CorrectConfigAPITests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/exec_graph_info.hpp"
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, ExecGraphTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
ExecGraphTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,24 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/infer_request.hpp"
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferRequestTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
InferRequestTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/infer_request_callback.hpp"
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CallbackTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
CallbackTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/infer_request_config.hpp"
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
InferConfigTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "multi-device/multi_device_config.hpp"
#include "behavior/infer_request_input.hpp"
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferRequestInputTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
InferRequestInputTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "multi-device/multi_device_config.hpp"
#include "behavior/infer_request_output.hpp"
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferRequestOutputTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
InferRequestOutputTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,26 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "multi-device/multi_device_config.hpp"
#include "behavior/set_preprocess.hpp"
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, PreprocessTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values("TEMPLATE"),
::testing::ValuesIn(configs)),
PreprocessTest::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,13 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include <string>
#include "functional_test_utils/skip_tests_config.hpp"
std::vector<std::string> disabledTestPatterns() {
return {
};
}

View File

@@ -0,0 +1,33 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
disable_deprecated_warnings()
set(TARGET_NAME TemplateBehaviorTests)
file(GLOB_RECURSE TEST_INCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
file(GLOB_RECURSE TEST_SRC
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
)
list(APPEND DEPENDENCIES
templatePlugin)
source_group("src" FILES ${TEST_SRC})
source_group("include" FILES ${TEST_INCLUDE})
add_executable(${TARGET_NAME}
${TEST_SRC}
${TEST_INCLUDE})
target_link_libraries(${TARGET_NAME} PRIVATE IE::IEBehaviorSharedTests)
add_test(NAME ${TARGET_NAME}
COMMAND ${TARGET_NAME})
add_dependencies(${TARGET_NAME} ${DEPENDENCIES})
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})

View File

@@ -0,0 +1,19 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "holders_tests.hpp"
#include <vector>
INSTANTIATE_TEST_CASE_P(ReleaseOrderTests, CPP_HoldersTests, testing::Combine(testing::ValuesIn(std::vector<std::vector<int>> {
// 0 - plugin
// 1 - executable_network
// 2 - infer_request
{0, 1, 2},
{0, 2, 1},
{1, 0, 2},
{1, 2, 0},
{2, 0, 1},
{2, 1, 0},
}), testing::Values("TEMPLATE")));

View File

@@ -0,0 +1,93 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior_test_plugin_layers.hpp"
conv_test_params deconv_test_cases[] = {
conv_test_params("TEMPLATE", conv_case),
};
conv_test_params conv_test_cases[] = {
conv_test_params("TEMPLATE", conv_dw_case),
};
INSTANTIATE_TEST_CASE_P(BehaviorTest, DeconvolutionLayerTest,
::testing::ValuesIn(deconv_test_cases),
getTestName<conv_test_params>);
INSTANTIATE_TEST_CASE_P(BehaviorTest, ConvolutionLayerTest,
::testing::ValuesIn(conv_test_cases),
getTestName<conv_test_params>);
pool_test_params roi_pool_test_cases[] = {
pool_test_params("TEMPLATE", "FP32", pool_case),
};
INSTANTIATE_TEST_CASE_P(BehaviorTest, ROIPoolingLayerTest,
::testing::ValuesIn(roi_pool_test_cases),
getTestName<pool_test_params>);
activ_test_params activ_test_cases[] = {
activ_test_params("TEMPLATE", "FP16", activation_case),
};
activ_test_params clamp_test_cases[] = {
activ_test_params("TEMPLATE", "FP16", clamp_case),
};
INSTANTIATE_TEST_CASE_P(BehaviorTest, ActivationLayerTest,
::testing::ValuesIn(activ_test_cases),
getTestName<activ_test_params>);
INSTANTIATE_TEST_CASE_P(BehaviorTest, ReLULayerTest,
::testing::Values(activ_test_params("TEMPLATE", "FP32", activation_case)),
getTestName<activ_test_params>);
INSTANTIATE_TEST_CASE_P(BehaviorTest, ClampLayerTest,
::testing::ValuesIn(clamp_test_cases),
getTestName<activ_test_params>);
norm_test_params norm_test_cases[] = {
norm_test_params("TEMPLATE", "FP32", norm_case),
};
INSTANTIATE_TEST_CASE_P(BehaviorTest, NormalizeLayerTest,
::testing::ValuesIn(norm_test_cases),
getTestName<norm_test_params>);
scale_test_params scale_test_cases[] = {
scale_test_params("TEMPLATE", "FP32", scale_case),
};
INSTANTIATE_TEST_CASE_P(BehaviorTest, ScalingLayerTest,
::testing::ValuesIn(scale_test_cases),
getTestName<scale_test_params>);
INSTANTIATE_TEST_CASE_P(BehaviorTest, ShapingLayerTest,
::testing::Values(shaping_test_params("TEMPLATE", "FP32", shape_case)),
getTestName<shaping_test_params>);
INSTANTIATE_TEST_CASE_P(BehaviorTest, ElementWiseLayerTest,
::testing::Values(element_test_params("TEMPLATE", "FP32", shape_case)),
getTestName<element_test_params>);
object_test_params object_test_cases[] = {
object_test_params("TEMPLATE", "FP32", object_case),
};
INSTANTIATE_TEST_CASE_P(BehaviorTest, ObjectDetectionLayerTest,
::testing::ValuesIn(object_test_cases),
getTestName<object_test_params>);
memory_test_params memory_test_cases[] = {
memory_test_params("TEMPLATE", "FP32", memory_case),
};
// FIXME
// #if (defined INSTANTIATE_TESTS)
// INSTANTIATE_TEST_CASE_P(BehaviorTest, MemoryLayerTest,
// ::testing::ValuesIn(memory_test_cases),
// getTestName<memory_test_params>);
// #endif

View File

@@ -0,0 +1,36 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior_test_plugin_layout.hpp"
layout_test_params power_test_cases[] = {
layout_test_params("TEMPLATE", "FP16", Layout::NCHW, power_params({ { 1, 3, 16, 16 } }, 1, 2, 2)),
};
layout_test_params conv_test_cases_1[] = {
layout_test_params("TEMPLATE", "FP16", Layout::NCHW, power_params({ { 1, 3, 16, 16 } }, 1, 2, 2)),
};
layout_test_params power_neg_test_cases[] = {
// Graph Error Description: Error: Tensor size should not be 0.
layout_test_params("TEMPLATE", "FP16", Layout::NC, power_params({ { 1, 3 } }, 1, 2, 2)),
layout_test_params("TEMPLATE", "FP16", Layout::CHW, power_params({ { 3, 32, 16 } }, 1, 2, 2)),
};
layout_test_params conv_neg_test_cases[] = {
// LoadNetwork hangs if Network has 1 dims format: CVS-8508
layout_test_params("TEMPLATE", "FP16", Layout::C, power_params({ { 3 } }, 1, 2, 2)),
layout_test_params("TEMPLATE", "FP16", Layout::NC, power_params({ { 1, 3 } }, 1, 2, 2)),
layout_test_params("TEMPLATE", "FP16", Layout::CHW, power_params({ { 3, 32, 16 } }, 1, 2, 2)),
};
INSTANTIATE_TEST_CASE_P(BehaviorTest, LayoutTestCanLoadPower,
::testing::ValuesIn(power_test_cases), getTestName);
INSTANTIATE_TEST_CASE_P(BehaviorTest, LayoutTestCanLoadConv,
::testing::ValuesIn(conv_test_cases_1), getTestName);
INSTANTIATE_TEST_CASE_P(BehaviorTest, LayoutTestCanNotLoadPower,
::testing::ValuesIn(power_neg_test_cases), getTestName);
INSTANTIATE_TEST_CASE_P(BehaviorTest, LayoutTestCanNotLoadConv,
::testing::ValuesIn(conv_neg_test_cases), getTestName);

View File

@@ -0,0 +1,14 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior_test_plugin_unsupported.hpp"
#include "template_test_data.hpp"
// INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginTestAllUnsupported, ValuesIn(allUnSupportedValues),
// getTestCaseName);
INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginTestTypeUnsupported, ValuesIn(typeUnSupportedValues),
getTestCaseName);
INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginTestBatchUnsupported, ValuesIn(batchUnSupportedValues),
getTestCaseName);

View File

@@ -0,0 +1,8 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior_test_plugin_version.hpp"
#include "template_test_data.hpp"
INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginTestVersion, ValuesIn(add_element_into_array(supportedValues, BEH_HETERO)), getTestCaseName);

View File

@@ -0,0 +1,12 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior_test_plugin.h"
#include "behavior_test_plugins.hpp"
#include "template_test_data.hpp"
INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginTestInput, ValuesIn(allInputSupportedValues),
getTestCaseName);
INSTANTIATE_TEST_CASE_P(BehaviorTest, BehaviorPluginTestOutput, ValuesIn(allOutputSupportedValues),
getOutputTestCaseName);

View File

@@ -0,0 +1,71 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior_test_plugin.h"
// correct params
#define BEH_HETERO BehTestParams("HETERO", \
FuncTestUtils::TestModel::convReluNormPoolFcModelFP32.model_xml_str, \
FuncTestUtils::TestModel::convReluNormPoolFcModelFP32.weights_blob, \
Precision::FP32)
#define BEH_TEMPLATE BehTestParams("TEMPLATE", \
FuncTestUtils::TestModel::convReluNormPoolFcModelFP16.model_xml_str, \
FuncTestUtils::TestModel::convReluNormPoolFcModelFP16.weights_blob, \
Precision::FP32)
// all parameters are unsupported - reversed
#define BEH_US_ALL_TEMPLATE BehTestParams("TEMPLATE", \
FuncTestUtils::TestModel::convReluNormPoolFcModelQ78.model_xml_str, \
FuncTestUtils::TestModel::convReluNormPoolFcModelQ78.weights_blob, \
Precision::Q78)
const BehTestParams supportedValues[] = {
BEH_TEMPLATE,
};
const BehTestParams requestsSupportedValues[] = {
BEH_TEMPLATE,
};
const BehTestParams allInputSupportedValues[] = {
BEH_TEMPLATE,
BEH_TEMPLATE.withIn(Precision::FP16),
BEH_TEMPLATE.withIn(Precision::U8),
BEH_TEMPLATE.withIn(Precision::I16),
};
const BehTestParams allOutputSupportedValues[] = {
BEH_TEMPLATE,
BEH_TEMPLATE.withOut(Precision::FP16),
};
const BehTestParams typeUnSupportedValues[] = {
BEH_TEMPLATE.withIn(Precision::Q78),
BEH_TEMPLATE.withIn(Precision::U16),
BEH_TEMPLATE.withIn(Precision::I8),
BEH_TEMPLATE.withIn(Precision::I32),
};
const BehTestParams batchUnSupportedValues[] = {
BEH_TEMPLATE.withBatchSize(0),
};
const BehTestParams allUnSupportedValues[] = {
BEH_US_ALL_TEMPLATE,
};
const std::vector<BehTestParams> withCorrectConfValuesNetworkOnly = {
BEH_TEMPLATE.withConfig({ { KEY_DEVICE_ID, "0" } }),
};
const BehTestParams withIncorrectConfValues[] = {
BEH_TEMPLATE.withConfig({ { KEY_CPU_BIND_THREAD, "ON" } }),
};
const std::vector<BehTestParams> withCorrectConfValues = {
BEH_TEMPLATE.withConfig({}),
};

View File

@@ -0,0 +1,13 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include <string>
#include "functional_test_utils/skip_tests_config.hpp"
std::vector<std::string> disabledTestPatterns() {
return {
};
}

View File

@@ -0,0 +1,21 @@
# Copyright (C) 2019 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
disable_deprecated_warnings()
# [cmake:functional_tests]
set(TARGET_NAME TemplateFunctionalTests)
file(GLOB_RECURSE TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
add_executable(${TARGET_NAME} ${TEST_SOURCES})
# link a library with common Inference Engine tests
target_link_libraries(${TARGET_NAME} PRIVATE IE::IESharedTests)
# make sure plugin is built before tests are run
add_dependencies(${TARGET_NAME} templatePlugin)
# [cmake:functional_tests]
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})

View File

@@ -0,0 +1,205 @@
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <utility>
#include <string>
#include <vector>
#include "ie_class.hpp"
//
// IE Class Common tests with <pluginName, deviceName params>
//
INSTANTIATE_TEST_CASE_P(
nightly_IEClassBasicTestP, IEClassBasicTestP,
::testing::Values(std::make_pair("templatePlugin", "TEMPLATE")));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassNetworkTestP, IEClassNetworkTestP,
::testing::Values("TEMPLATE"));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_AVAILABLE_DEVICES,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_ThrowUnsupported,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetConfigTest, IEClassGetConfigTest_ThrowUnsupported,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetAvailableDevices, IEClassGetAvailableDevices,
::testing::Values("TEMPLATE"));
//
// IE Class SetConfig
//
using IEClassSetConfigTestHETERO = IEClassNetworkTest;
TEST_F(IEClassSetConfigTestHETERO, nightly_SetConfigNoThrow) {
{
Core ie;
Parameter p;
ASSERT_NO_THROW(ie.SetConfig({ { HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), CONFIG_VALUE(YES) } }, "HETERO"));
ASSERT_NO_THROW(p = ie.GetConfig("HETERO", HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)));
bool dump = p.as<bool>();
ASSERT_TRUE(dump);
}
{
Core ie;
Parameter p;
ASSERT_NO_THROW(ie.SetConfig({ { HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), CONFIG_VALUE(NO) } }, "HETERO"));
ASSERT_NO_THROW(p = ie.GetConfig("HETERO", HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)));
bool dump = p.as<bool>();
ASSERT_FALSE(dump);
}
{
Core ie;
Parameter p;
ASSERT_NO_THROW(ie.GetMetric("HETERO", METRIC_KEY(SUPPORTED_CONFIG_KEYS)));
ASSERT_NO_THROW(ie.SetConfig({ { HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), CONFIG_VALUE(YES) } }, "HETERO"));
ASSERT_NO_THROW(p = ie.GetConfig("HETERO", HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)));
bool dump = p.as<bool>();
ASSERT_TRUE(dump);
}
}
//
// IE Class GetConfig
//
INSTANTIATE_TEST_CASE_P(
nightly_IEClassGetConfigTest, IEClassGetConfigTest,
::testing::Values("TEMPLATE"));
using IEClassGetConfigTestTEMPLATE = IEClassNetworkTest;
TEST_F(IEClassGetConfigTestTEMPLATE, nightly_GetConfigNoThrow) {
Core ie;
Parameter p;
std::string deviceName = "TEMPLATE";
ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS)));
std::vector<std::string> configValues = p;
for (auto && confKey : configValues) {
if (CONFIG_KEY(DEVICE_ID) == confKey) {
std::string defaultDeviceID = ie.GetConfig(deviceName, CONFIG_KEY(DEVICE_ID));
std::cout << CONFIG_KEY(DEVICE_ID) << " : " << defaultDeviceID << std::endl;
} else if (CONFIG_KEY(PERF_COUNT) == confKey) {
bool defaultPerfCount = ie.GetConfig(deviceName, CONFIG_KEY(PERF_COUNT));
std::cout << CONFIG_KEY(PERF_COUNT) << " : " << defaultPerfCount << std::endl;
} else if (CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS) == confKey) {
bool defaultExclusive = ie.GetConfig(deviceName, CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS));
std::cout << CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS) << " : " << defaultExclusive << std::endl;
}
}
}
//
// Executable Network GetMetric
//
INSTANTIATE_TEST_CASE_P(
nightly_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("TEMPLATE", "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("TEMPLATE", "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("TEMPLATE", "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values("TEMPLATE", "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassExecutableNetworkGetMetricTest_ThrowsUnsupported, IEClassExecutableNetworkGetMetricTest,
::testing::Values("TEMPLATE", "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
//
// Executable Network GetConfig / SetConfig
//
INSTANTIATE_TEST_CASE_P(
nightly_IEClassExecutableNetworkGetConfigTest, IEClassExecutableNetworkGetConfigTest,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassExecutableNetworkSetConfigTest, IEClassExecutableNetworkSetConfigTest,
::testing::Values("TEMPLATE"));
// IE Class Query network
INSTANTIATE_TEST_CASE_P(
nightly_IEClassQueryNetworkTest, IEClassQueryNetworkTest,
::testing::Values("TEMPLATE"));
// IE Class Load network
INSTANTIATE_TEST_CASE_P(
nightly_IEClassLoadNetworkTest, IEClassLoadNetworkTest,
::testing::Values("TEMPLATE"));
//
// Hetero Executable Network GetMetric
//
#ifdef ENABLE_MKL_DNN
INSTANTIATE_TEST_CASE_P(
nightly_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("TEMPLATE"));
INSTANTIATE_TEST_CASE_P(
nightly_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
::testing::Values("TEMPLATE"));
#endif // ENABLE_MKL_DNN

View File

@@ -0,0 +1,17 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "test_model_repo.hpp"
std::string get_model_repo() {
return ":";
}
const char* TestDataHelpers::getModelPathNonFatal() noexcept {
return TestDataHelpers::getModelPathNonFatalDefault();
}
std::string TestDataHelpers::get_data_path() {
return TestDataHelpers::get_data_path_default();
}

262
get-started-linux.md Normal file
View File

@@ -0,0 +1,262 @@
# Get Started with OpenVINO™ Toolkit on Linux*
This guide provides you with the information that will help you to start using
the OpenVINO™ Toolkit on Linux\*. With this guide, you will learn how to:
1. [Configure the Model Optimizer](#configure-the-model-optimizer)
2. [Prepare a model for sample inference](#prepare-a-model-for-sample-inference)
1. [Download a pre-trained model](#download-a-trained-model)
2. [Convert the model to an Intermediate Representation (IR) with the Model Optimizer](#convert-the-model-to-an-intermediate-representation-with-the-model-optimizer)
3. [Run the Image Classification Sample Application with the model](#run-the-image-classification-sample-application)
## Prerequisites
1. This guide assumes that you have already cloned the `openvino` repo and
successfully built the Inference Engine and Samples using the
[build instructions](inference-engine/README.md).
2. The original structure of the repository directories remains unchanged.
> **NOTE**: Below, the directory to which the `openvino` repository is cloned is
referred to as `<OPENVINO_DIR>`.
## Configure the Model Optimizer
The Model Optimizer is a Python\*-based command line tool for importing trained
models from popular deep learning frameworks such as Caffe\*, TensorFlow\*,
Apache MXNet\*, ONNX\* and Kaldi\*.
You cannot perform inference on your trained model without having first run the
model through the Model Optimizer. When you run a pre-trained model through the
Model Optimizer, it outputs an *Intermediate Representation*, or *(IR)* of
the network, a pair of files that describes the whole model:
- `.xml`: Describes the network topology
- `.bin`: Contains the weights and biases binary data
For more information about the Model Optimizer, refer to the
[Model Optimizer Developer Guide].
### Model Optimizer Configuration Steps
You can choose to either configure all supported frameworks at once **OR**
configure one framework at a time. Choose the option that best suits your needs.
If you see error messages, check for any missing dependencies.
> **NOTE**: The TensorFlow\* framework is not officially supported on CentOS\*,
so the Model Optimizer for TensorFlow cannot be configured on, or run with
CentOS.
> **IMPORTANT**: Internet access is required to execute the following steps
successfully. If you access the Internet via proxy server only, please make
sure that it is configured in your OS environment as well.
**Option 1: Configure all supported frameworks at the same time**
1. Go to the Model Optimizer prerequisites directory:
```sh
cd <OPENVINO_DIR>/model_optimizer/install_prerequisites
```
2. Run the script to configure the Model Optimizer for Caffe,
TensorFlow, MXNet, Kaldi\*, and ONNX:
```sh
sudo ./install_prerequisites.sh
```
**Option 2: Configure each framework separately**
Configure individual frameworks separately **ONLY** if you did not select
**Option 1** above.
1. Go to the Model Optimizer prerequisites directory:
```sh
cd <OPENVINO_DIR>/model_optimizer/install_prerequisites
```
2. Run the script for your model framework. You can run more than one script:
- For **Caffe**:
```sh
sudo ./install_prerequisites_caffe.sh
```
- For **TensorFlow**:
```sh
sudo ./install_prerequisites_tf.sh
```
- For **MXNet**:
```sh
sudo ./install_prerequisites_mxnet.sh
```
- For **ONNX**:
```sh
sudo ./install_prerequisites_onnx.sh
```
- For **Kaldi**:
```sh
sudo ./install_prerequisites_kaldi.sh
```
The Model Optimizer is configured for one or more frameworks. Continue to the
next session to download and prepare a model for running a sample inference.
## Prepare a Model for Sample Inference
This section describes how to get a pre-trained model for sample inference
and how to prepare the optimized Intermediate Representation (IR) that
Inference Inference Engine uses.
### Download a Trained Model
To run the Image Classification Sample, you need a pre-trained model to run
the inference on. This guide uses the public SqueezeNet 1.1 Caffe\* model.
You can find and download this model manually or use the OpenVINO™
[Model Downloader].
With the Model Downloader, you can download other popular public deep learning
topologies and [OpenVINO™ pre-trained models], which are already prepared for
running inference upon a wide list of inference scenarios:
* object detection,
* object recognition,
* object re-identification,
* human pose estimation,
* action recognition, and others.
To download the SqueezeNet 1.1 Caffe* model to a `models` folder (referred to
as `<models_dir>` below) with the Model Downloader:
1. Install the [prerequisites].
2. Run the `downloader.py` script, specifying the topology name and the path
to your `<models_dir>`. For example, to download the model to a directory
named `~/public_models`, run:
```sh
./downloader.py --name squeezenet1.1 --output_dir ~/public_models
```
When the model files are successfully downloaded, output similar to the
following is printed:
```sh
###############|| Downloading topologies ||###############
========= Downloading /home/username/public_models/classification/squeezenet/1.1/caffe/squeezenet1.1.prototxt
========= Downloading /home/username/public_models/classification/squeezenet/1.1/caffe/squeezenet1.1.caffemodel
... 100%, 4834 KB, 3157 KB/s, 1 seconds passed
###############|| Post processing ||###############
========= Changing input dimensions in squeezenet1.1.prototxt =========
```
### Convert the model to an Intermediate Representation with the Model Optimizer
> **NOTE**: This section assumes that you have configured the Model Optimizer using the instructions from the [Configure the Model Optimizer](#configure-the-model-optimizer) section.
1. Create a `<ir_dir>` directory that will contains the Intermediate Representation (IR) of the model.
2. Inference Engine can perform inference on a [list of supported devices]
using specific device plugins. Different plugins support models of
[different precision formats], such as `FP32`, `FP16`, `INT8`. To prepare an
IR to run inference on particular hardware, run the Model Optimizer with the
appropriate `--data_type` options:
**For CPU (FP32):**
```sh
python3 <OPENVINO_DIR>/model_optimizer/mo.py --input_model <models_dir>/classification/squeezenet/1.1/caffe/squeezenet1.1.caffemodel --data_type FP32 --output_dir <ir_dir>
```
**For GPU and MYRIAD (FP16):**
```sh
python3 <OPENVINO_DIR>/model_optimizer/mo.py --input_model <models_dir>/classification/squeezenet/1.1/caffe/squeezenet1.1.caffemodel --data_type FP16 --output_dir <ir_dir>
```
After the Model Optimizer script is completed, the produced IR files (`squeezenet1.1.xml`, `squeezenet1.1.bin`) are in the specified `<ir_dir>` directory.
3. Copy the `squeezenet1.1.labels` file from the `<OPENVINO_DIR>/scripts/demo/`
folder to the model IR directory. This file contains the classes that ImageNet
uses so that the inference results show text instead of classification numbers:
```sh
cp <OPENVINO_DIR>/scripts/demo/squeezenet1.1.labels <ir_dir>
```
Now you are ready to run the Image Classification Sample Application.
## Run the Image Classification Sample Application
The Inference Engine sample applications are automatically compiled when you
built the Inference Engine using the [build instructions](inference-engine/README.md).
The binary files are located in the `<OPENVINO_DIR>/inference-engine/bin/intel64/Release`
directory.
To run the Image Classification sample application with an input image on the prepared IR:
1. Go to the samples build directory:
```sh
cd <OPENVINO_DIR>/inference-engine/bin/intel64/Release
2. Run the sample executable with specifying the `car.png` file from the
`<OPENVINO_DIR>/scripts/demo/` directory as an input
image, the IR of your model and a plugin for a hardware device to perform
inference on:
**For CPU:**
```sh
./classification_sample -i <OPENVINO_DIR>/scripts/demo/car.png -m <ir_dir>/squeezenet1.1.xml -d CPU
```
**For GPU:**
```sh
./classification_sample -i <OPENVINO_DIR>/scripts/demo/car.png -m <ir_dir>/squeezenet1.1.xml -d GPU
```
**For MYRIAD:**
>**NOTE**: Running inference on VPU devices (Intel® Movidius™ Neural Compute
Stick or Intel® Neural Compute Stick 2) with the MYRIAD plugin requires
performing [additional hardware configuration steps](inference-engine/README.md#optional-additional-installation-steps-for-the-intel-movidius-neural-compute-stick-and-neural-compute-stick-2).
```sh
./classification_sample -i <OPENVINO_DIR>/scripts/demo/car.png -m <ir_dir>/squeezenet1.1.xml -d MYRIAD
```
When the Sample Application completes, you will have the label and confidence for the top-10 categories printed on the screen. Below is a sample output with inference results on CPU:
```sh
Top 10 results:
Image /home/user/openvino/scripts/demo/car.png
classid probability label
------- ----------- -----
817 0.8363345 sports car, sport car
511 0.0946488 convertible
479 0.0419131 car wheel
751 0.0091071 racer, race car, racing car
436 0.0068161 beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon
656 0.0037564 minivan
586 0.0025741 half track
717 0.0016069 pickup, pickup truck
864 0.0012027 tow truck, tow car, wrecker
581 0.0005882 grille, radiator grille
total inference time: 2.6642941
Average running time of one iteration: 2.6642941 ms
Throughput: 375.3339402 FPS
[ INFO ] Execution successful
```
## Additional Resources
* [OpenVINO™ Release Notes](https://software.intel.com/en-us/articles/OpenVINO-RelNotes)
* [Inference Engine build instructions](inference-engine/README.md)
* [Introduction to Intel® 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]
* [Inference Engine Samples Overview](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Samples_Overview.html).
[Model Optimizer Developer Guide]:https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html
[Model Downloader]:https://github.com/opencv/open_model_zoo/tree/master/tools/downloader
[OpenVINO™ pre-trained models]:https://github.com/opencv/open_model_zoo/tree/master/models/intel
[prerequisites]:https://github.com/opencv/open_model_zoo/tree/master/tools/downloader#prerequisites
[list of supported devices]:https://docs.openvinotoolkit.org/latest/_docs_IE_DG_supported_plugins_Supported_Devices.html
[different precision formats]:https://docs.openvinotoolkit.org/latest/_docs_IE_DG_supported_plugins_Supported_Devices.html#supported_model_formats

View File

@@ -1,136 +1,229 @@
# Copyright (C) 2018 Intel Corporation
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required (VERSION 3.3)
project(InferenceEngine)
set(DEV_BUILD TRUE)
set(CMAKE_MODULE_PATH "${IE_MAIN_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
## WA for problem with gtest submodule. It cannot detect uint32 type.
## remove Gtest submodule and this two lines together
include (CheckTypeSize)
check_type_size (uint32_t uint32_t LANGUAGE CXX)
include(features_ie)
if (UNIX AND NOT APPLE)
set(LINUX TRUE)
# include developer package
include(developer_package_ie)
# These options are shared with 3rdparty plugins
# by means of developer package
include(check_features_ie)
# resolving dependencies for the project
include(dependencies)
# Fuzz tests also building without ENABLE_FUZZING
include(fuzzing)
if (ENABLE_FUZZING)
enable_fuzzing()
endif()
option (OS_FOLDER "create OS dedicated folder in output" OFF)
find_package(Threads REQUIRED)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set (ARCH_FOLDER intel64)
else()
set (ARCH_FOLDER ia32)
endif()
unset(IEDeveloperPackageTargets CACHE)
function(ie_developer_export_targets)
set(IEDeveloperPackageTargets "${IEDeveloperPackageTargets};${ARGV}")
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()
# to allow exporting of aliased targets with the original names
foreach(target_name ${IEDeveloperPackageTargets})
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 IEDeveloperPackageTargets ${target_name})
list(APPEND IEDeveloperPackageTargets ${original_name})
endif()
endif()
endforeach()
set (IE_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set (CMAKE_MODULE_PATH "${IE_MAIN_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
list(REMOVE_DUPLICATES IEDeveloperPackageTargets)
set(IEDeveloperPackageTargets "${IEDeveloperPackageTargets}" CACHE INTERNAL
"Paths to extra Inference Engine plugins" FORCE)
endfunction()
#printing debug messages
include (debug)
function(ie_developer_export)
export(TARGETS ${IEDeveloperPackageTargets} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/targets_developer.cmake")
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
debug_message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used")
set(CMAKE_BUILD_TYPE "Release")
endif()
# Custom target to build only Inference Engine Developer Package targets
add_custom_target(ie_dev_targets ALL DEPENDS ${IEDeveloperPackageTargets} gflags)
endfunction()
message(STATUS "BUILD_CONFIGURATION: ${CMAKE_BUILD_TYPE}")
if(COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O0")
endif()
if (UNIX)
SET(LIB_DL ${CMAKE_DL_LIBS})
else()
endif()
set (OUTPUT_ROOT ${IE_MAIN_SOURCE_DIR})
if(NOT(UNIX))
if (WIN32)
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif()
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
set (CMAKE_LIBRARY_PATH ${OUTPUT_ROOT}/${BIN_FOLDER})
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
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})
set (LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
set (LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_DIRECTORY}) # compatibility issue: linux uses LIBRARY_OUTPUT_PATH, windows uses LIBRARY_OUTPUT_DIRECTORY
else ()
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE}/lib)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE}/lib)
set (CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE})
set (CMAKE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE})
set (LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE}/lib)
set (LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_DIRECTORY}/lib)
endif()
include(os_flags)
#resolving rependencies for the project
include (dependencies)
if (APPLE)
set(CMAKE_MACOSX_RPATH 1)
endif(APPLE)
#rpath fully disabled
if (NOT ENABLE_PLUGIN_RPATH)
SET (CMAKE_SKIP_RPATH TRUE)
endif()
#Use solution folders.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#message("=====================> ${CMAKE_BUILD_TYPE} <=====================")
message (STATUS "PROJECT ............................... " ${PROJECT_NAME})
message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
message (STATUS "IE_MAIN_SOURCE_DIR .................... " ${IE_MAIN_SOURCE_DIR})
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID})
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
include(sdl)
endif()
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
include (sanitizer)
include(CheckCXXCompilerFlag)
if(UNIX)
CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" COMPILER_SUPPORTS_VISIBILITY)
if (COMPILER_SUPPORTS_VISIBILITY)
#add_definitions(-fvisibility=hidden) todo: should be hidden? if so define default visibiliti explicite for each funtion
add_definitions(-fvisibility=default)
endif(COMPILER_SUPPORTS_VISIBILITY)
endif(UNIX)
add_subdirectory(thirdparty)
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(thirdparty)
if (ENABLE_SAMPLES_CORE)
set(InferenceEngine_DIR "${CMAKE_BINARY_DIR}")
#to be able to link
set (LIB_FOLDER ${IE_MAIN_SOURCE_DIR}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE}/lib)
add_subdirectory(samples)
if(ENABLE_TESTS)
add_subdirectory(tests_deprecated)
add_subdirectory(tests)
endif()
add_subdirectory(tools)
function(ie_build_samples)
# samples should be build with the same flags as from OpenVINO package,
# so unset all flags
foreach(var CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_CXX_STANDARD
CMAKE_EXE_LINKER_FLAGS CMAKE_POLICY_DEFAULT_CMP0063
CMAKE_CXX_VISIBILITY_PRESET CMAKE_C_VISIBILITY_PRESET
CMAKE_VISIBILITY_INLINES_HIDDEN CMAKE_POSITION_INDEPENDENT_CODE
THREADS_PREFER_PTHREAD_FLAG X86_64 X86 ARM AARCH64 LINUX
MINGW64 CMAKE_BUILD_TYPE CMAKE_MACOSX_RPATH)
unset(${var})
endforeach()
include(sanitizer)
add_subdirectory(samples)
endfunction()
# gflags and format_reader targets are kept inside of samples directory and
# they must be built even if samples build is disabled (required for tests and tools).
ie_build_samples()
file(GLOB_RECURSE SAMPLES_SOURCES samples/*.cpp samples/*.hpp samples/*.h)
add_cpplint_target(sample_cpplint
FOR_SOURCES ${SAMPLES_SOURCES}
EXCLUDE_PATTERNS "thirdparty/*" "pugixml/*")
if (ENABLE_PYTHON)
add_subdirectory(ie_bridges/python)
endif()
if (ENABLE_C)
add_subdirectory(ie_bridges/c)
endif()
add_cpplint_report_target()
#
# Install
#
# install C++ samples
ie_cpack_add_component(cpp_samples REQUIRED DEPENDS core)
if(UNIX)
install(DIRECTORY samples/
DESTINATION ${IE_CPACK_IE_DIR}/samples/cpp
COMPONENT cpp_samples
USE_SOURCE_PERMISSIONS
PATTERN *.bat EXCLUDE
PATTERN speech_libs_and_demos EXCLUDE)
elseif(WIN32)
install(DIRECTORY samples/
DESTINATION ${IE_CPACK_IE_DIR}/samples/cpp
COMPONENT cpp_samples
USE_SOURCE_PERMISSIONS
PATTERN *.sh EXCLUDE
PATTERN speech_libs_and_demos EXCLUDE)
endif()
# install C samples
ie_cpack_add_component(c_samples REQUIRED DEPENDS core)
if(UNIX)
install(PROGRAMS samples/build_samples.sh
DESTINATION ${IE_CPACK_IE_DIR}/samples/c
COMPONENT c_samples)
elseif(WIN32)
install(PROGRAMS samples/build_samples_msvc.bat
DESTINATION ${IE_CPACK_IE_DIR}/samples/c
COMPONENT c_samples)
endif()
install(DIRECTORY ie_bridges/c/samples/
DESTINATION ${IE_CPACK_IE_DIR}/samples/c
COMPONENT c_samples
PATTERN ie_bridges/c/samples/CMakeLists.txt EXCLUDE)
install(FILES samples/CMakeLists.txt
DESTINATION ${IE_CPACK_IE_DIR}/samples/c
COMPONENT c_samples)
# install Python samples
if(ENABLE_PYTHON)
ie_cpack_add_component(python_samples REQUIRED DEPENDS core)
install(DIRECTORY ${ie_python_api_SOURCE_DIR}/sample/
DESTINATION ${IE_CPACK_IE_DIR}/samples/python
COMPONENT python_samples)
endif()
# install speech demo files
if(SPEECH_LIBS_AND_DEMOS)
ie_cpack_add_component(speech_demo_files REQUIRED)
install(DIRECTORY ${TEMP}/deployment_tools
${TEMP}/data_processing
DESTINATION .
COMPONENT speech_demo_files)
endif()
#
# Developer package
#
ie_developer_export_targets(format_reader)
ie_developer_export_targets(${NGRAPH_LIBRARIES})
ie_developer_export()
configure_file(
"${IE_MAIN_SOURCE_DIR}/cmake/developer_package_config.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig.cmake"
@ONLY)
configure_file(
"${IE_MAIN_SOURCE_DIR}/cmake/share/InferenceEngineConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig-version.cmake"
COPYONLY)
#
# Coverage
#
if(ENABLE_COVERAGE)
include(coverage_ie)
endif()
#
# Add plugins
#
function(register_extra_plugins)
set(InferenceEngineDeveloperPackage_DIR "${CMAKE_CURRENT_BINARY_DIR}/build-plugins")
set(iedevconfig_file "${InferenceEngineDeveloperPackage_DIR}/InferenceEngineDeveloperPackageConfig.cmake")
file(REMOVE "${iedevconfig_file}")
file(WRITE "${iedevconfig_file}" "\# !! AUTOGENERATED: DON'T EDIT !!\n\n")
file(APPEND "${iedevconfig_file}" "ie_deprecated_no_errors()\n")
foreach(target IN LISTS IEDeveloperPackageTargets)
if(target)
file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n")
endif()
endforeach()
# automatically import plugins from the 'plugins' folder
file(GLOB local_extra_plugins "plugins/*")
list(APPEND local_extra_plugins "${OpenVINO_MAIN_SOURCE_DIR}/docs/template_plugin")
foreach(plugin_path IN LISTS IE_EXTRA_PLUGINS local_extra_plugins)
get_filename_component(plugin_dir "${plugin_path}" NAME)
message(STATUS "Register ${plugin_dir} to be built in build-plugins/${plugin_dir}")
add_subdirectory("${plugin_path}" "build-plugins/${plugin_dir}")
endforeach()
endfunction()
register_extra_plugins()

View File

@@ -1,63 +0,0 @@
## Build on Linux\* Systems
The software was validated on:
- Ubuntu\* 16.04 with default GCC\* 5.4.0
- CentOS\* 7.4 with default GCC\* 4.8.5 (using clDNN library built separately with GCC\* 5.2)
- [Intel® Graphics Compute Runtime for OpenCL™ Driver package 18.28.11080](https://github.com/intel/compute-runtime/releases/tag/18.28.11080).
### Software Requirements
- [CMake\*](https://cmake.org/download/) 3.9 or higher
- GCC\* 4.8 or higher to build the Inference Engine
- GCC\* 5.2 or higher to build the Compute Library for Deep Neural Networks (clDNN library)
- OpenBLAS\*
### Build Steps
1. Install OpenBLAS and other dependencies using the `install_dependencies.sh` script in the project root folder.
2. Create a build folder:
```sh
mkdir build
```
3. Inference Engine uses a CMake-based build system. In the created `build` directory, run `cmake` to fetch project dependencies and create Unix makefiles, then run `make` to build the project:
```sh
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j16
```
You can use the following additional build options:
- Use `BLAS_INCLUDE_DIRS` and `BLAS_LIBRARIES` cmake options to specify path to OpenBLAS headers and library, for example use the following options on CentOS\*: `-DBLAS_INCLUDE_DIRS=/usr/include/openblas -DBLAS_LIBRARIES=/usr/lib64/libopenblas.so.0`
- To build clDNN from sources, please specify the `-DENABLE_CLDNN_BUILD=ON` option for `cmake`. By default pre-built version of the clDNN library is used.
- To switch on/off the CPU and GPU plugins, use `cmake` options `-DENABLE_MKL_DNN=ON/OFF` and `-DENABLE_CLDNN=ON/OFF`.
## Build on Windows\* Systems:
The software was validated on:
- Microsoft\* Windows\* 10 with Visual Studio 2017 and Intel® C++ Compiler 2018 Update 3
- [Intel® Graphics Driver for Windows* [24.20] driver package](https://downloadcenter.intel.com/download/27803/Graphics-Intel-Graphics-Driver-for-Windows-10?v=t).
### Software Requirements
- [CMake\*](https://cmake.org/download/) 3.9 or higher
- [OpenBLAS\*](https://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int64.zip/download) or
- [Intel® C++ Compiler](https://software.intel.com/en-us/intel-parallel-studio-xe) 18.0 to build the Inference Engine on Windows.
### Build Steps
1. Download and install [Intel® C++ Compiler](https://software.intel.com/en-us/intel-parallel-studio-xe) 18.0
2. Install OpenBLAS:
1. Download [OpenBLAS\*](https://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int64.zip/download)
2. Unzip the downloaded package to a directory on your machine. In this document, this directory is referred to as `<OPENBLAS_DIR>`.
3. Create build directory:
```sh
mkdir build
```
4. In the `build` directory, run `cmake` to fetch project dependencies and generate a Visual Studio solution:
```sh
cd build
cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 18.0" -DOS_FOLDER=ON ^
-DBLAS_INCLUDE_DIRS=<OPENBLAS_DIR>\include ^
-DBLAS_LIBRARIES=<OPENBLAS_DIR>\lib\libopenblas.dll.a ^
-DCMAKE_BUILD_TYPE=Release ^
-DICCLIB="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib" ..
```
5. Build generated solution in Visual Studio 2017 or run `cmake --build .` to build from the command line.
---
\* Other names and brands may be claimed as the property of others.

View File

@@ -0,0 +1,55 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
unset(ITT_INCLUDE_DIR CACHE)
unset(ITT_LIB CACHE)
if(NOT DEFINED INTEL_VTUNE_DIR AND DEFINED ENV{INTEL_VTUNE_DIR})
set(INTEL_VTUNE_DIR "$ENV{INTEL_VTUNE_DIR}")
endif()
if(NOT DEFINED INTEL_VTUNE_DIR)
if(EXISTS "/opt/intel/vtune_amplifier_xe/include")
set(INTEL_VTUNE_DIR "/opt/intel/vtune_amplifier_xe")
elseif(EXISTS "/opt/intel/vtune_amplifier/include")
set(INTEL_VTUNE_DIR "/opt/intel/vtune_amplifier")
elseif (EXISTS "C:/Program Files (x86)/IntelSWTools/VTune Amplifier XE")
set(INTEL_VTUNE_DIR "C:/Program Files (x86)/IntelSWTools/VTune Amplifier XE")
elseif (EXISTS "C:/Program Files (x86)/IntelSWTools/VTune Amplifier")
set(INTEL_VTUNE_DIR "C:/Program Files (x86)/IntelSWTools/VTune Amplifier")
elseif (EXISTS "$ENV{HOME}/intel/vtune_amplifier_2019")
set(INTEL_VTUNE_DIR "$ENV{HOME}/intel/vtune_amplifier_2019")
endif()
endif()
if(DEFINED INTEL_VTUNE_DIR)
message(STATUS "INTEL_VTUNE_DIR = ${INTEL_VTUNE_DIR}")
find_path(ITT_INCLUDE_DIR ittnotify.h
PATHS "${INTEL_VTUNE_DIR}/include/")
find_library(ITT_LIB
"libittnotify${CMAKE_STATIC_LIBRARY_SUFFIX}"
PATHS ${INTEL_VTUNE_DIR}/lib64)
set(Located_ITT_LIBS ${ITT_LIB})
set(Located_ITT_INCLUDE_DIRS ${ITT_INCLUDE_DIR})
else()
message(STATUS "INTEL_VTUNE_DIR is not defined")
endif()
# Handle find_package() arguments, and set INTEL_ITT_FOUND
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(INTEL_ITT
REQUIRED_VARS
Located_ITT_INCLUDE_DIRS
Located_ITT_LIBS)
if(INTEL_ITT_FOUND)
add_library(ittnotify STATIC IMPORTED GLOBAL)
set_target_properties(ittnotify PROPERTIES IMPORTED_LOCATION "${Located_ITT_LIBS}"
INTERFACE_INCLUDE_DIRECTORIES ${Located_ITT_INCLUDE_DIRS}
INTERFACE_COMPILE_DEFINITIONS ENABLE_PROFILING_ITT)
set(INTEL_ITT_LIBS ittnotify ${CMAKE_DL_LIBS})
endif()

View File

@@ -0,0 +1,80 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# module to locate GNA libraries
if (WIN32)
set(GNA_PLATFORM_DIR win64 CACHE STRING "" FORCE)
elseif (UNIX)
set(GNA_PLATFORM_DIR linux CACHE STRING "" FORCE)
else ()
message(FATAL_ERROR "GNA not supported on this platform, only linux, and windows")
endif ()
set(libGNA_FOUND TRUE)
set(GNA_KERNEL_LIB_NAME gna CACHE STRING "" FORCE)
set(GNA_LIBS_LIST
"libGNA::API"
"libGNA::KERNEL")
if (GNA_LIBRARY_VERSION STREQUAL "GNA1")
# use old version of GNA Library from gna_20181120
if (WIN32)
set(GNA_LIB_DIR x64 CACHE STRING "" FORCE)
else ()
list(APPEND GNA_LIBS_LIST
"libGNA::OLD_API_LIB")
set(GNA_LIB_DIR lib CACHE STRING "" FORCE)
set(GNA_KERNEL_LIB_NAME gna_kernel CACHE STRING "" FORCE)
endif()
set(libGNA_INCLUDE_DIRS "${GNA}/${GNA_PLATFORM_DIR}/include" CACHE STRING "" FORCE)
else()
# use current version of GNA library
set(GNA_LIB_DIR x64 CACHE STRING "" FORCE)
set(libGNA_INCLUDE_DIRS "${GNA}/include" CACHE STRING "" FORCE)
endif()
set(libGNA_LIBRARIES_BASE_PATH ${GNA}/${GNA_PLATFORM_DIR}/${GNA_LIB_DIR} CACHE STRING "" FORCE)
add_library(libGNA::KERNEL SHARED IMPORTED)
find_library(GNA_KERNEL_LIBRARY
${GNA_KERNEL_LIB_NAME}
HINTS
${libGNA_LIBRARIES_BASE_PATH})
set_target_properties(libGNA::KERNEL PROPERTIES IMPORTED_LOCATION ${GNA_KERNEL_LIBRARY})
if ((GNA_LIBRARY_VERSION STREQUAL "GNA1") AND (NOT WIN32))
add_library(libGNA::OLD_API_LIB SHARED IMPORTED)
find_library(GNA_API_LIBRARY
gna_api
HINTS
${libGNA_LIBRARIES_BASE_PATH})
set_target_properties(libGNA::OLD_API_LIB PROPERTIES IMPORTED_LOCATION ${GNA_API_LIBRARY})
target_link_libraries(libGNA::OLD_API_LIB INTERFACE libGNA::KERNEL)
set_target_properties(libGNA::OLD_API_LIB PROPERTIES IMPORTED_NO_SONAME TRUE)
set_target_properties(libGNA::KERNEL PROPERTIES IMPORTED_NO_SONAME TRUE)
endif()
add_library(libGNA::API INTERFACE IMPORTED)
set_property(TARGET libGNA::API PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${libGNA_INCLUDE_DIRS})
add_library(libGNA INTERFACE IMPORTED)
foreach(_lib_name ${GNA_LIBS_LIST})
set_property(TARGET libGNA APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${_lib_name})
get_target_property(_target_type ${_lib_name} TYPE)
if (${_target_type} STREQUAL "INTERFACE_LIBRARY")
get_target_property(_target_location ${_lib_name} INTERFACE_INCLUDE_DIRECTORIES)
else()
get_target_property(_target_location ${_lib_name} IMPORTED_LOCATION)
endif ()
message(STATUS "${_lib_name} ${_target_type} : ${_target_location}")
endforeach(_lib_name)
if (WIN32)
set_target_properties(libGNA::KERNEL PROPERTIES
IMPORTED_IMPLIB ${GNA_KERNEL_LIBRARY})
elseif(NOT GNA_LIBRARY_VERSION STREQUAL "GNA1")
set_target_properties(libGNA PROPERTIES INTERFACE_LINK_OPTIONS "-Wl,-rpath-link,${libGNA_LIBRARIES_BASE_PATH}")
endif ()

View File

@@ -0,0 +1,155 @@
# Copyright (C) 2018-2020 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
TYPE SHARED
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
ADDITIONAL_SOURCE_DIRS
/some/additional/sources
EXCLUDED_SOURCE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/unnecessary_sources/
INCLUDES
${SDL_INCLUDES}
/some/specific/path
LINK_LIBRARIES
ie::important_plugin
EXPORT_DEPENDENCIES
dependency_lib_to_export
DEPENDENCIES
dependencies
OBJECT_FILES
object libraries
)
#]]
function(addIeTarget)
set(options
ADD_CPPLINT # Enables code style checks for the target
DEVELOPER_PACKAGE # Enables exporting of the target through the developer package
)
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
)
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_DIRS # list of directories 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
EXPORT_DEPENDENCIES # list of the dependencies to be exported with the target through the developer package
)
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
if (ARG_EXCLUDED_SOURCE_DIRS)
list(FILTER includes EXCLUDE REGEX "${ARG_EXCLUDED_SOURCE_DIRS}/*")
list(FILTER sources EXCLUDE REGEX "${ARG_EXCLUDED_SOURCE_DIRS}/*")
endif()
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} ${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_DEVELOPER_PACKAGE)
# developer package
ie_developer_export_targets(${ARG_NAME})
if (ARG_EXPORT_DEPENDENCIES)
ie_developer_export_targets(${ARG_NAME} ${ARG_EXPORT_DEPENDENCIES})
endif()
endif()
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})
endfunction()

View File

@@ -1,134 +0,0 @@
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
include ("features")
include("mode")
include("omp")
include("itt")
#64 bits platform
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
message(STATUS "Detected 64 bit architecture")
SET(ARCH_64 ON)
SET(ARCH_32 OFF)
else()
message(STATUS "Detected 32 bit architecture")
SET(ARCH_64 OFF)
SET(ARCH_32 ON)
endif()
if (ARCH_64)
else()
if (UNIX OR APPLE)
SET(ENABLE_CLDNN OFF)
endif()
SET(ENABLE_MKL_DNN OFF)
endif()
#apple specific
if (APPLE)
set(ENABLE_CLDNN OFF)
endif()
#minGW specific - under wine no support for downloading file and applying them using git
if (WIN32)
enable_omp()
if (MINGW)
SET(ENABLE_CLDNN OFF) # dont have mingw dll for linking
set(ENABLE_SAMPLES_CORE OFF)
endif()
endif()
# Linux specific - not all OS'es are supported
if (LINUX)
include("linux_name")
get_linux_name(LINUX_OS_NAME)
if (LINUX_OS_NAME)
if (NOT(
${LINUX_OS_NAME} STREQUAL "Ubuntu 14.04" OR
${LINUX_OS_NAME} STREQUAL "Ubuntu 16.04" OR
${LINUX_OS_NAME} STREQUAL "CentOS 7"))
endif()
else ()
message(WARNING "Cannot detect Linux OS via reading /etc/*-release:\n ${release_data}")
endif ()
endif ()
if (NOT ENABLE_MKL_DNN)
set(GEMM OPENBLAS)
endif()
if (NOT ENABLE_VPU)
set(ENABLE_MYRIAD OFF)
endif()
if (NOT ENABLE_MYRIAD)
set(ENABLE_VPU OFF)
endif()
#next section set defines to be accesible in c++/c code for certain feature
if (ENABLE_PROFILING_RAW)
add_definitions(-DENABLE_PROFILING_RAW=1)
endif()
if (ENABLE_GTEST_PATCHES)
add_definitions(-DENABLE_GTEST_PATCHES=1)
endif()
if (ENABLE_CLDNN)
add_definitions(-DENABLE_CLDNN=1)
endif()
if (ENABLE_MKL_DNN)
add_definitions(-DENABLE_MKL_DNN=1)
endif()
if (ENABLE_STRESS_UNIT_TESTS)
add_definitions(-DENABLE_STRESS_UNIT_TESTS=1)
endif()
if (ENABLE_SEGMENTATION_TESTS)
add_definitions(-DENABLE_SEGMENTATION_TESTS=1)
endif()
if (ENABLE_OBJECT_DETECTION_TESTS)
add_definitions(-DENABLE_OBJECT_DETECTION_TESTS=1)
endif()
#models dependend tests
if (DEVELOPMENT_PLUGIN_MODE)
message (STATUS "Enabled development plugin mode")
set (ENABLE_MKL_DNN OFF)
set (ENABLE_TESTS OFF)
message (STATUS "Initialising submodules")
execute_process (COMMAND git submodule update --init ${IE_MAIN_SOURCE_DIR}/thirdparty/pugixml
RESULT_VARIABLE git_res)
if (NOT ${git_res})
message (STATUS "Initialising submodules - done")
endif()
endif()
if (VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
if (NOT ENABLE_OMP)
set(ENABLE_INTEL_OMP OFF)
endif()
if (NOT GEMM STREQUAL "MKL" AND NOT GEMM STREQUAL "OPENBLAS")
message("FATAL_ERROR" "GEMM should be set to MKL|OPENBLAS")
endif()
print_enabled_features()
message(STATUS "GEMM = ${GEMM}")

View File

@@ -0,0 +1,39 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
#next section set defines to be accesible in c++/c code for certain feature
if (ENABLE_PROFILING_RAW)
add_definitions(-DENABLE_PROFILING_RAW=1)
endif()
if (ENABLE_MYRIAD)
add_definitions(-DENABLE_MYRIAD=1)
endif()
if (ENABLE_MYRIAD_NO_BOOT AND ENABLE_MYRIAD )
add_definitions(-DENABLE_MYRIAD_NO_BOOT=1)
endif()
if (ENABLE_CLDNN)
add_definitions(-DENABLE_CLDNN=1)
endif()
if (ENABLE_MKL_DNN)
add_definitions(-DENABLE_MKL_DNN=1)
endif()
if (ENABLE_GNA)
add_definitions(-DENABLE_GNA)
if (UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4)
message(WARNING "${GNA_LIBRARY_VERSION} is not supported on GCC version ${CMAKE_CXX_COMPILER_VERSION}. Fallback to GNA1")
set(GNA_LIBRARY_VERSION GNA1)
endif()
endif()
if (ENABLE_SPEECH_DEMO)
add_definitions(-DENABLE_SPEECH_DEMO)
endif()
print_enabled_features()

View File

@@ -0,0 +1,124 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if (ENABLE_CLANG_FORMAT)
set(CLANG_FORMAT_FILENAME clang-format-9 clang-format)
find_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()
endif()
endif()
if(ENABLE_CLANG_FORMAT)
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 "${IE_MAIN_SOURCE_DIR}/cmake/clang_format_check.cmake"
DEPENDS
"${source_file}"
"${IE_MAIN_SOURCE_DIR}/cmake/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 "${IE_MAIN_SOURCE_DIR}/cmake/clang_format_fix.cmake"
DEPENDS
"${CLANG_FORMAT_FOR_SOURCES}"
"${IE_MAIN_SOURCE_DIR}/cmake/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()

View File

@@ -0,0 +1,18 @@
# Copyright (C) 2018-2020 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
)
# Display the cpplint output to console (to parse it form IDE)
message("${output}")
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()

View File

@@ -0,0 +1,24 @@
# Copyright (C) 2018-2020 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()

View File

@@ -1,11 +1,34 @@
# Copyright (C) 2018 Intel Corporation
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if(DEFINED IE_MAIN_SOURCE_DIR AND TARGET inference_engine)
set(InferenceEngine_INCLUDE_DIRS ${IE_MAIN_SOURCE_DIR}/include)
set(InferenceEngine_LIBRARIES inference_engine)
set(InferenceEngine_LIBRARIES inference_engine_legacy inference_engine
inference_engine_c_api)
else()
include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake")
if(NOT WIN32)
set_target_properties(IE::inference_engine PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-error=deprecated-declarations")
endif()
file(TO_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}" cache_path)
set (ie_options THREADING)
load_cache("${cache_path}" READ_WITH_PREFIX "" ${ie_options})
message(STATUS "The following CMake options are exported from the Inference Engine build")
message("")
foreach(option IN LISTS ie_options)
message(" ${option}: ${${option}}")
endforeach()
message("")
# inherit TBB from main IE project if enabled
if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
load_cache("${cache_path}" READ_WITH_PREFIX "" TBB_DIR;ENABLE_TBB_RELEASE_ONLY)
set(TBB_FIND_RELEASE_ONLY ${ENABLE_TBB_RELEASE_ONLY})
find_package(TBB)
endif()
get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES)
set(InferenceEngine_LIBRARIES IE::inference_engine)
set(InferenceEngine_LIBRARIES IE::inference_engine_legacy IE::inference_engine
IE::inference_engine_c_api)
endif()

View File

@@ -0,0 +1,76 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set(DLDT_COVERAGE_GCDA_DATA_DIRECTORY "${CMAKE_BINARY_DIR}/inference-engine/src")
set(DLDT_COVERAGE_BASE_DIRECTORY "${IE_MAIN_SOURCE_DIR}/src")
ie_coverage_clean(REPOSITORY "dldt"
DIRECTORY "${DLDT_COVERAGE_GCDA_DATA_DIRECTORY}")
ie_coverage_capture(INFO_FILE "dldt"
BASE_DIRECTORY "${DLDT_COVERAGE_BASE_DIRECTORY}"
DIRECTORY "${DLDT_COVERAGE_GCDA_DATA_DIRECTORY}")
# Generate reports
ie_coverage_extract(INPUT "dldt" OUTPUT "inference_engine"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/inference_engine/*"
"${DLDT_COVERAGE_BASE_DIRECTORY}/plugin_api/*")
ie_coverage_genhtml(INFO_FILE "inference_engine"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
ie_coverage_extract(INPUT "dldt" OUTPUT "inference_engine_ir_reader"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/readers/*")
ie_coverage_genhtml(INFO_FILE "inference_engine_ir_reader"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
ie_coverage_extract(INPUT "dldt" OUTPUT "inference_engine_legacy"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/legacy_api/*")
ie_coverage_genhtml(INFO_FILE "inference_engine_legacy"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
ie_coverage_extract(INPUT "dldt" OUTPUT "hetero_plugin"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/hetero_plugin/*")
ie_coverage_genhtml(INFO_FILE "hetero_plugin"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
ie_coverage_extract(INPUT "dldt" OUTPUT "multi_device"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/multi_device/*")
ie_coverage_genhtml(INFO_FILE "multi_device"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
ie_coverage_extract(INPUT "dldt" OUTPUT "preprocessing"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/preprocessing/*")
ie_coverage_genhtml(INFO_FILE "preprocessing"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
ie_coverage_extract(INPUT "dldt" OUTPUT "inference_engine_transformations"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/inference_engine_transformations/*")
ie_coverage_genhtml(INFO_FILE "inference_engine_transformations"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
ie_coverage_extract(INPUT "dldt" OUTPUT "low_precision_transformations"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/low_precision_transformations/*")
ie_coverage_genhtml(INFO_FILE "low_precision_transformations"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
if(ENABLE_MKL_DNN)
ie_coverage_extract(INPUT "dldt" OUTPUT "mkldnn_plugin"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/mkldnn_plugin/*")
ie_coverage_genhtml(INFO_FILE "mkldnn_plugin"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
endif()
if(ENABLE_CLDNN)
ie_coverage_extract(INPUT "dldt" OUTPUT "cldnn_engine"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/cldnn_engine/*")
ie_coverage_genhtml(INFO_FILE "cldnn_engine"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
endif()
if(ENABLE_GNA)
ie_coverage_extract(INPUT "dldt" OUTPUT "gna_plugin"
PATTERNS "${DLDT_COVERAGE_BASE_DIRECTORY}/gna_plugin/*")
ie_coverage_genhtml(INFO_FILE "gna_plugin"
PREFIX "${DLDT_COVERAGE_BASE_DIRECTORY}")
endif()

View File

@@ -0,0 +1,174 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if(ENABLE_CPPLINT)
find_package(Python3 COMPONENTS Interpreter)
if(NOT Python3_Interpreter_FOUND)
message(WARNING "Python3 interpreter was not found (required for cpplint check)")
set(ENABLE_CPPLINT OFF)
endif()
endif()
if(ENABLE_CPPLINT)
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 "CPPLINT_SCRIPT=${IE_MAIN_SOURCE_DIR}/scripts/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 "${IE_MAIN_SOURCE_DIR}/cmake/cpplint_run.cmake"
DEPENDS
"${source_file}"
"${IE_MAIN_SOURCE_DIR}/scripts/cpplint.py"
"${IE_MAIN_SOURCE_DIR}/cmake/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()
function(add_cpplint_report_target)
if(NOT ENABLE_CPPLINT OR NOT ENABLE_CPPLINT_REPORT)
return()
endif()
set(cpplint_output_file "${CMAKE_BINARY_DIR}/cpplint/final_output.cpplint")
add_custom_command(
OUTPUT
"${cpplint_output_file}"
COMMAND
"${CMAKE_COMMAND}"
-D "FINAL_OUTPUT_FILE=${cpplint_output_file}"
-D "OUTPUT_FILES=${CPPLINT_ALL_OUTPUT_FILES}"
-P "${IE_MAIN_SOURCE_DIR}/cmake/cpplint_merge.cmake"
DEPENDS
${CPPLINT_ALL_OUTPUT_FILES}
"${IE_MAIN_SOURCE_DIR}/cmake/cpplint_merge.cmake"
COMMENT
"[cpplint] Merge all output files"
VERBATIM)
set(cppcheck_output_file "${CMAKE_BINARY_DIR}/cpplint/cpplint-cppcheck-result.xml")
add_custom_command(
OUTPUT
"${cppcheck_output_file}"
COMMAND
"${CMAKE_COMMAND}"
-D "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}"
-D "CONVERT_SCRIPT=${IE_MAIN_SOURCE_DIR}/scripts/cpplint_to_cppcheckxml.py"
-D "INPUT_FILE=${cpplint_output_file}"
-D "OUTPUT_FILE=${cppcheck_output_file}"
-P "${IE_MAIN_SOURCE_DIR}/cmake/cpplint_to_cppcheck_xml.cmake"
DEPENDS
"${cpplint_output_file}"
"${IE_MAIN_SOURCE_DIR}/scripts/cpplint_to_cppcheckxml.py"
"${IE_MAIN_SOURCE_DIR}/cmake/cpplint_to_cppcheck_xml.cmake"
COMMENT
"[cpplint] Convert to cppcheck XML format"
VERBATIM)
set(report_dir "${IE_MAIN_SOURCE_DIR}/report/cpplint")
set(html_output_file "${report_dir}/index.html")
add_custom_command(
OUTPUT
"${html_output_file}"
COMMAND
"${CMAKE_COMMAND}"
-D "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}"
-D "CONVERT_SCRIPT=${IE_MAIN_SOURCE_DIR}/scripts/cppcheck-htmlreport.py"
-D "INPUT_FILE=${cppcheck_output_file}"
-D "REPORT_DIR=${report_dir}"
-D "SOURCE_DIR=${IE_MAIN_SOURCE_DIR}"
-D "TITLE=${CMAKE_PROJECT_NAME}"
-P "${IE_MAIN_SOURCE_DIR}/cmake/cpplint_html.cmake"
DEPENDS
"${cppcheck_output_file}"
"${IE_MAIN_SOURCE_DIR}/scripts/cppcheck-htmlreport.py"
"${IE_MAIN_SOURCE_DIR}/cmake/cpplint_html.cmake"
COMMENT
"[cpplint] Generate HTML report"
VERBATIM)
add_custom_target(cpplint_report
DEPENDS "${html_output_file}"
COMMENT "[cpplint] Generate report")
set_target_properties(cpplint_report PROPERTIES FOLDER cpplint)
endfunction()

View File

@@ -0,0 +1,29 @@
# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if(EXISTS "${REPORT_DIR}")
file(REMOVE_RECURSE "${REPORT_DIR}")
endif()
file(MAKE_DIRECTORY "${REPORT_DIR}")
execute_process(
COMMAND
"${PYTHON_EXECUTABLE}"
"${CONVERT_SCRIPT}"
"--file=${INPUT_FILE}"
"--report-dir=${REPORT_DIR}"
"--source-dir=${SOURCE_DIR}"
"--title=${TITLE}")
# Change cppcheck things to cpplint
file(READ "${REPORT_DIR}/index.html" cur_file_content)
string(REPLACE "Cppcheck" "cpplint" cur_file_content "${cur_file_content}")
string(REPLACE "a tool for static C/C++ code analysis" "an open source lint-like tool from Google" cur_file_content "${cur_file_content}")
string(REPLACE "http://cppcheck.sourceforge.net" "http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py" cur_file_content "${cur_file_content}")
string(REPLACE "IRC: <a href=\"irc://irc.freenode.net/cppcheck\">irc://irc.freenode.net/cppcheck</a>" " " cur_file_content "${cur_file_content}")
file(WRITE "${REPORT_DIR}/index.html" "${cur_file_content}")

Some files were not shown because too many files have changed in this diff Show More