Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / README.md
1 ## Repository components
2
3 The Inference Engine can infer models in different formats with various input and output formats.
4
5 The open source version of Inference Engine includes the following plugins:
6
7 | PLUGIN               | DEVICE TYPES |
8 | ---------------------| -------------|
9 | CPU plugin           | Intel® Xeon® with Intel® AVX2 and AVX512, Intel® Core™ Processors with Intel® AVX2, Intel® Atom® Processors with Intel® SSE |
10 | GPU plugin           | Intel® Processor Graphics, including Intel® HD Graphics and Intel® Iris® Graphics |
11 | 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 |
12 | Heterogeneous plugin | Heterogeneous plugin enables computing for inference on one network on several Intel® devices. |
13
14 Inference Engine plugins for Intel® FPGA and Intel® Movidius™ Neural Compute Stick are distributed only in a binary form as a part of [Intel® Distribution of OpenVINO™](https://software.intel.com/en-us/openvino-toolkit).
15
16 ## Build on Linux\* Systems
17
18 The software was validated on:
19 - Ubuntu\* 16.04 (64-bit) with default GCC\* 5.4.0
20 - CentOS\* 7.4 (64-bit) with default GCC\* 4.8.5
21 - [Intel® Graphics Compute Runtime for OpenCL™ Driver package 18.28.11080](https://github.com/intel/compute-runtime/releases/tag/18.28.11080).
22
23 ### Software Requirements
24 - [CMake\*](https://cmake.org/download/) 3.9 or higher
25 - GCC\* 4.8 or higher to build the Inference Engine
26 - Python 2.7 or higher for Inference Engine Python API wrapper
27
28 ### Build Steps
29 1. Clone submodules:
30     ```sh
31     cd dldt/inference-engine
32     git submodule init
33     git submodule update --recursive
34     ```
35 2. Install build dependencies using the `install_dependencies.sh` script in the project root folder.
36 3. Create a build folder:
37 ```sh
38   mkdir build
39 ```
40 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:
41 ```sh
42   cmake -DCMAKE_BUILD_TYPE=Release ..
43   make -j16
44 ```
45 You can use the following additional build options:
46 - Internal JIT GEMM implementation is used by default.
47 - To switch to OpenBLAS\* implementation, use `GEMM=OPENBLAS` option and `BLAS_INCLUDE_DIRS` and `BLAS_LIBRARIES` cmake options to specify path to OpenBLAS headers and library, for example use the following options on CentOS\*: `-DGEMM=OPENBLAS -DBLAS_INCLUDE_DIRS=/usr/include/openblas -DBLAS_LIBRARIES=/usr/lib64/libopenblas.so.0`
48
49 - 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 [here](https://github.com/intel/mkl-dnn/releases/download/v0.17/mklml_lnx_2019.0.1.20180928.tgz)
50
51 - Threading Building Blocks (TBB) is used by default. To build the Inference Engine with OpenMP* threading, set the `-DTHREADING=OMP` option.
52
53 - Required versions of TBB and OpenCV packages are downloaded automatically by the CMake-based script. If 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.
54
55 - To build the Python API wrapper, use the `-DENABLE_PYTHON=ON` option. To specify an exact Python version, use the following options:
56 ```sh
57   -DPYTHON_EXECUTABLE=`which python3.7` \
58   -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so \
59   -DPYTHON_INCLUDE_DIR=/usr/include/python3.7
60 ```
61
62 - To switch on/off the CPU and GPU plugins, use `cmake` options `-DENABLE_MKL_DNN=ON/OFF` and `-DENABLE_CLDNN=ON/OFF`.
63
64 5. Adding to your project
65
66     For CMake projects, set an environment variable `InferenceEngine_DIR`:
67
68     ```sh
69     export InferenceEngine_DIR=/path/to/dldt/inference-engine/build/
70     ```
71
72     Then you can find Inference Engine by `find_package`:
73
74     ```cmake
75     find_package(InferenceEngine)
76
77     include_directories(${InferenceEngine_INCLUDE_DIRS})
78
79     target_link_libraries(${PROJECT_NAME} ${InferenceEngine_LIBRARIES} dl)
80     ```
81
82 ## Build on Windows\* Systems:
83
84 The software was validated on:
85 - Microsoft\* Windows\* 10 (64-bit) with Visual Studio 2017 and Intel® C++ Compiler 2018 Update 3
86 - [Intel® Graphics Driver for Windows* [24.20] driver package](https://downloadcenter.intel.com/download/27803/Graphics-Intel-Graphics-Driver-for-Windows-10?v=t).
87
88 ### Software Requirements
89 - [CMake\*](https://cmake.org/download/) 3.9 or higher
90 - [OpenBLAS\*](https://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int64.zip/download) and [mingw64\* runtime dependencies](https://sourceforge.net/projects/openblas/files/v0.2.14/mingw64_dll.zip/download).
91 - [Intel® C++ Compiler](https://software.intel.com/en-us/intel-parallel-studio-xe) 18.0 to build the Inference Engine on Windows.
92 - Python 3.4 or higher for Inference Engine Python API wrapper
93
94 ### Build Steps
95 1. Clone submodules:
96     ```sh
97     git submodule init
98     git submodule update --recursive
99     ```
100 2. Download and install [Intel® C++ Compiler](https://software.intel.com/en-us/intel-parallel-studio-xe) 18.0
101 3. Install OpenBLAS:
102     1. Download [OpenBLAS\*](https://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int64.zip/download)
103     2. Unzip the downloaded package to a directory on your machine. In this document, this directory is referred to as `<OPENBLAS_DIR>`.
104 4. Create build directory:
105     ```sh
106     mkdir build
107     ```
108 5. In the `build` directory, run `cmake` to fetch project dependencies and generate a Visual Studio solution:
109 ```sh
110 cd build
111 cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 18.0" ^
112     -DCMAKE_BUILD_TYPE=Release ^
113     -DICCLIB="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib" ..
114 ```
115
116 - Internal JIT GEMM implementation is used by default.
117 - To switch to OpenBLAS GEMM implementation, use -DGEMM=OPENBLAS cmake option and specify path to OpenBLAS using `-DBLAS_INCLUDE_DIRS=<OPENBLAS_DIR>\include` and `-DBLAS_LIBRARIES=<OPENBLAS_DIR>\lib\libopenblas.dll.a` options. Prebuilt OpenBLAS\* package can be downloaded [here](https://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int64.zip/download), mingw64* runtime dependencies [here](https://sourceforge.net/projects/openblas/files/v0.2.14/mingw64_dll.zip/download)
118 - 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 [here](https://github.com/intel/mkl-dnn/releases/download/v0.17/mklml_win_2019.0.1.20180928.zip)
119
120 - Threading Building Blocks (TBB) is used by default. To build the Inference Engine with OpenMP* threading, set the `-DTHREADING=OMP` option.
121
122 - Required versions of TBB and OpenCV packages are downloaded automatically by the CMake-based script. If 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.
123
124 - To build the Python API wrapper, use the `-DENABLE_PYTHON=ON` option. To specify an exact Python version, use the following options:
125 ```sh
126   -DPYTHON_EXECUTABLE="C:\Program Files\Python37\python.exe" ^
127   -DPYTHON_LIBRARY="C:\Program Files\Python37\libs\python37.lib" ^
128   -DPYTHON_INCLUDE_DIR="C:\Program Files\Python37\include"
129 ```
130
131 6. Build generated solution in Visual Studio 2017 or run `cmake --build . --config Release` to build from the command line.
132
133 7. Before running the samples, add paths to 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 `<dldt_repo>/inference-engine/temp/tbb/lib` folder, OpenCV binaries - to the `<dldt_repo>/inference-engine/temp/opencv_4.1.0/bin` folder.
134
135 ### Building Inference Engine with Ninja
136
137 ```sh
138 call "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\bin\ipsxe-comp-vars.bat" intel64 vs2017
139 set CXX=icl
140 set CC=icl
141 :: clean TBBROOT value set by ipsxe-comp-vars.bat, required TBB package will be downloaded by dldt cmake script
142 set TBBROOT=
143 cmake -G Ninja -Wno-dev -DCMAKE_BUILD_TYPE=Release ..
144 cmake --build . --config Release
145 ```
146
147 ## Build on macOS\* Systems
148
149 The software was validated on:
150 - macOS\* 10.14, 64-bit
151
152 ### Software Requirements
153 - [CMake\*](https://cmake.org/download/) 3.9 or higher
154 - Clang\* compiler from Xcode\* 10.1
155 - Python\* 3.4 or higher for the Inference Engine Python API wrapper
156
157 ### Build Steps
158 1. Clone submodules:
159     ```sh
160     cd dldt/inference-engine
161     git submodule init
162     git submodule update --recursive
163     ```
164 2. Install build dependencies using the `install_dependencies.sh` script in the project root folder.
165 3. Create a build folder:
166 ```sh
167   mkdir build
168 ```
169 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:
170 ```sh
171   cmake -DCMAKE_BUILD_TYPE=Release ..
172   make -j16
173 ```
174 You can use the following additional build options:
175 - Internal JIT GEMM implementation is used by default.
176 - 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 [here](https://github.com/intel/mkl-dnn/releases/download/v0.17.1/mklml_mac_2019.0.1.20180928.tgz)
177
178 - Threading Building Blocks (TBB) is used by default. To build the Inference Engine with OpenMP* threading, set the `-DTHREADING=OMP` option.
179
180 - To build the Python API wrapper, use the `-DENABLE_PYTHON=ON` option. To specify an exact Python version, use the following options:
181 ```sh
182   -DPYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 \
183   -DPYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib \
184   -DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m
185 ```
186
187
188 ---
189 \* Other names and brands may be claimed as the property of others.