-
Notifications
You must be signed in to change notification settings - Fork 2.6k
ConditionalCompilation
Conditional compilation can significantly reduce the size of OpenVINO™ binaries by excluding unnecessary components for inference of particular models. The components are:
- layers and graph transformations in OpenVINO Runtime and plugins
- OpenVINO Runtime operations
- jit kernels in a CPU plugin
- arbitrary code that is not used for particular model inference
However, conditional compilation has a significant drawback - the resulting OpenVINO runtime will properly infer only using the models and devices for which it was compiled. If just one model is used to collect statistics for compilation, only this particular model is guaranteed to work with the resulting OpenVINO runtime.
To take advantage of conditional compilation, install the following tools:
Conditional compilation has two stages:
- Collecting information about code usage
- Building the result binaries without unused components or parts
To apply conditional compilation, follow the steps below:
- Perform code usage analysis:
- Run the CMake tool with the following options:
-DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT
. - Select several models to be used in a specific application or target device.
- Use the
sea_itt_lib
target to build the ITT collector. - Run the target application under the ITT collector for code usage analysis for each model. Statistics are generated in the
.csv
format.
python thirdparty/itt_collector/runtool/sea_runtool.py --bindir ${OPENVINO_LIBRARY_DIR} -o ${MY_MODEL_RESULT} ! ./benchmark_app -niter 1 -nireq 1 -m ${MY_MODEL}.xml
- Run the CMake tool with the following options:
- Build the resulting binaries:
- Run the CMake tool with the following options:
-DSELECTIVE_BUILD=ON -DSELECTIVE_BUILD_STAT=${ABSOLUTE_PATH_TO_STATISTICS_FILES}/*.csv -DENABLE_PROFILING_ITT=OFF
cmake --build <cmake_build_directory>
- Run the CMake tool with the following options:
The "-niter 1 -nireq 1" flags are highly recommended for benchmark_app. Otherwise, the trace files will be very large. If you are using an application other than benchmark_app, remember to limit the number of inference requests and iterations.
Building for devices with different ISA is quite similar to building for different models (see the previous chapter). The differences are only in the code usage analysis step. The analysis step should be performed on target devices and all CSV files with statistics should be copied to the build machine. These files will be used for the final build.
- Currently, Ninja build system is not supported for the conditional compilation build.
© Copyright 2018-2024, OpenVINO team
- Home
- General resources
- How to build
-
Developer documentation
- Inference Engine architecture
- CPU plugin
- GPU plugin
- HETERO plugin architecture
- Snippets
- Sample for IE C++/C/Python API
- Proxy plugin (Concept)
- Tests