%global githash 89282e3f3 %global gitdate 20211204 Name: openvino Summary: Deep Learning Deployment Toolkit repository Version: 2021.4.2 Release: %{gitdate}.git%{githash}%{?dist} License: BSD URL: https://github.com/openvinotoolkit/openvino Source0: openvino.tar.xz Patch0: dldt-assert.patch Patch1: dldt-shared.patch Patch2: openvino-gcc11.patch BuildRequires: cmake gcc-c++ wget git openblas-devel protobuf-lite-devel glibc-devel BuildRequires: python3 python3-devel python3-Cython protobuf-devel opencv-devel pybind11-devel >= 2.8.0 BuildRequires: tbb-devel gflags-devel pugixml-devel libusb-devel xbyak-devel python3-pyyaml ocl-icd-devel %undefine _hardened_build %global __cmake_in_source_build 1 %global have_cuda 1 %global vcu_maj 11 %global vcu_min 5 %bcond_without cuda %if %{without cuda} %global have_cuda 0 %endif %if %{have_cuda} BuildRequires: cuda-nvcc-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvtx-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-cudart-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvml-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvrtc-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-driver-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvprof-%{vcu_maj}-%{vcu_min} %endif %description This toolkit allows developers to deploy pre-trained deep learning models through a high-level C++ Inference Engine API integrated with application logic. %package devel Summary: Library Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Contains header files for developing applications that use the %{name} library. %package examples Summary: Library Requires: %{name}%{?_isa} = %{version}-%{release} %description examples Contains examples that use the %{name} library. %package python3 Summary: Library Requires: %{name}%{?_isa} = %{version}-%{release} Requires: python3-defusedxml python3-test-generator %description python3 Contains header files for developing applications that use the %{name} library. %prep %setup -q -n openvino %patch0 -p1 %patch1 -p0 #%patch2 -p0 %build rm -rf thirdparty/onnx rm -rf thirdparty/xbyak rm -rf thirdparty/gflags rm -rf thirdparty/gtest rm -rf thirdparty/ocl rm -rf thirdparty/protobuf rm -rf thirdparty/pugixml #rm -rf thirdparty/zlib rm -rf inference-engine/thirdparty/mkl-dnn sed -i '/add_gflags()/d' thirdparty/CMakeLists.txt sed -i '/add_subdirectory(gflags/d' thirdparty/CMakeLists.txt sed -i '/add_subdirectory(ocl/d' thirdparty/CMakeLists.txt sed -i '/add_subdirectory(xbyak/d' thirdparty/CMakeLists.txt sed -i '/add_subdirectory(onnx/d' thirdparty/CMakeLists.txt sed -i '/add_subdirectory(pugixml/d' thirdparty/CMakeLists.txt #sed -i '/add_subdirectory(zlib/d' thirdparty/CMakeLists.txt sed -i '/add_subdirectory(protobuf/d' thirdparty/CMakeLists.txt sed -i '/add_subdirectory(mkl/d' inference-engine/thirdparty/CMakeLists.txt sed -i '/install(DIR/,/USE_SOURCE_PERM/d' thirdparty/CMakeLists.txt ## cxxflags #sed -i 's|-Werror||g' ngraph/CMakeLists.txt sed -i -e 's|-Werror||g' cmake/developer_package/compile_flags/os_flags.cmake # external mkldnn sed -i 's|ie_add_mkldnn()|find_package(DNNL REQUIRED dnnl)|' inference-engine/thirdparty/CMakeLists.txt sed -i 's|$||' inference-engine/src/mkldnn_plugin/CMakeLists.txt sed -i 's| mkldnn| dnnl|' inference-engine/src/mkldnn_plugin/CMakeLists.txt sed -i 's|mkldnn.hpp|dnnl.h|' inference-engine/src/mkldnn_plugin/mkldnn/ie_mkldnn.h # external pybind11 rm -rf src/bindings/python/thirdparty/pybind11 sed -i 's|add_subdirectory(thirdparty/pybind11 EXCLUDE_FROM_ALL)|find_package(pybind11 REQUIRED)|' src/bindings/python/CMakeLists.txt # external onnx sed -i 's|add_subdirectory(onnx)|find_package(ONNX REQUIRED)|' thirdparty/CMakeLists.txt # use opencv sed -i '/^if (ENABLE_OPENCV)/,/^endif()/d' cmake/dependencies.cmake echo 'find_package(OpenCV REQUIRED)' >> cmake/dependencies.cmake # use external xbyak sed -i '/xbyak/d' thirdparty/CMakeLists.txt sed -i '/PRIVATE xbyak/d' src/core/reference/CMakeLists.txt sed -i 's|$||' src/inference/CMakeLists.txt # external protobuf sed -i 's|Protobuf 3.9.0 REQUIRED|Protobuf REQUIRED|' thirdparty/CMakeLists.txt sed -i 's|Protobuf_USE_STATIC_LIBS ON|Protobuf_USE_STATIC_LIBS OFF|' thirdparty/CMakeLists.txt #sed -i 's|libprotobuf|protobuf|g' ngraph/frontend/tensorflow/CMakeLists.txt # external onnx #echo 'find_package(ONNX REQUIRED)' > cmake/external_onnx.cmake #sed -i 's|add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/onnx ${CMAKE_BINARY_DIR}/_deps/onnx)|find_package(ONNX REQUIRED)|' CMakeLists.txt # use external gflags rm -rf inference-engine/samples/thirdparty/gflags sed -i -e 's|all_dev_targets gflags|all_dev_targets|g' cmake/extra_modules.cmake sed -i -e '/TARGETS gflags/d' thirdparty/CMakeLists.txt # use external tbb sed -i -e '/if (THREADING/,/^endif ()/d' cmake/dependencies.cmake # use external json sed -i -e '/nlohmann_json/d' thirdparty/CMakeLists.txt # plugin path sed -i -e 's|watchdogInterval, dirName|watchdogInterval, "%{_libdir}/dldt/"|' inference-engine/src/vpu/myriad_plugin/myriad_executor.cpp # cython version sed -i -e 's|0.29|0.28|' inference-engine/ie_bridges/python/CMakeLists.txt sed -i -e 's|0.29|0.28|' inference-engine/ie_bridges/python/src/requirements-dev.txt %ifarch ppc64le # missing cpuid.h rm -rf samples/cpp/speech_sample %endif %if 0%{?rhel} # explicit no tests sed -i 's|NOT NGRAPH_UNIT_TEST_ENABLE|TRUE|' src/core/tests/CMakeLists.txt sed -i 's|(__linux)|(__linux__)|g' src/core/tests/runtime/backend.cpp # old gflags rm -rf samples/cpp/benchmark_app rm -rf samples/cpp/speech_sample rm -rf samples/cpp/object_detection_sample_ssd rm -rf samples/cpp/classification_sample_async rm -rf samples/cpp/ngraph_function_creation_sample %endif mkdir -p build pushd build export CFLAGS="-Wno-error -I%{_builddir}/dldt/ngraph/src/ -I%{_includedir}/ngraph/frontend/ -I%{_includedir}/ngraph/test/runtime/ -Wno-deprecated-declarations" export CXXFLAGS="$CFLAGS" export LD_LIBRARY_PATH="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/%{_lib}/" %cmake ../ -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_SHARED_LIBS=ON \ -DENABLE_FASTER_BUILD=OFF \ -DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON \ -Dgflags_BINARY_DIR=%{_bindir} \ -DOpenCV_DIR="%{_includedir}" \ -DTHREADING=SEQ \ -DENABLE_LTO=ON \ -DENABLE_CPPLINT=OFF \ -DENABLE_FASTER_BUILD=OFF \ -DENABLE_CLANG_FORMAT=OFF \ -DENABLE_SYSTEM_PUGIXML=ON \ -DENABLE_OPENCV=ON \ -DENABLE_GNA=OFF \ -DENABLE_CLDNN=OFF \ -DENABLE_MKL_DNN=OFF \ -DENABLE_ONEDNN_FOR_GPU=OFF \ -DENABLE_INTEL_GPU=ON \ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-%{vcu_maj}.%{vcu_min} \ -DENABLE_MYRIAD=ON \ -DENABLE_PYTHON=ON \ -DENABLE_TESTS=OFF \ -DENABLE_PROFILING_ITT=OFF \ -DENABLE_FUNCTIONAL_TESTS=OFF \ -DNGRAPH_USE_SYSTEM_PROTOBUF=ON \ -DNGRAPH_ONNX_FRONTEND_ENABLE=OFF \ %if 0%{?rhel} -DNGRAPH_PDPD_FRONTEND_ENABLE=OFF \ -DNGRAPH_TF_FRONTEND_ENABLE=OFF \ %else -DNGRAPH_PDPD_FRONTEND_ENABLE=ON \ -DNGRAPH_TF_FRONTEND_ENABLE=ON \ %endif -DNGRAPH_UNIT_TEST_ENABLE=OFF \ -DNGRAPH_UNIT_TEST_BACKENDS_ENABLE=OFF make %{?_smp_mflags} popd %install rm -rf %{buildroot} pushd build make install DESTDIR=%{buildroot} INSTALL="install -p" CPPROG="cp -p" popd # includes mv -f %{buildroot}/usr/runtime/include %{buildroot}/usr/include # python3 mkdir -p %{buildroot}/%{python3_sitearch} mv -f %{buildroot}/usr/python/python*/* %{buildroot}/%{python3_sitearch}/ # libs mkdir -p %{buildroot}/%{_libdir} rm -rf %{buildroot}/usr/runtime/lib* cp -PRf bin/*/RelWithDebInfo/lib/lib*.so* %{buildroot}/%{_libdir}/ # binaries mkdir -p %{buildroot}/%{_bindir} find bin/*/RelWithDebInfo/* -maxdepth 0 -type f -exec cp -t %{buildroot}/%{_bindir}/ {} + pushd %{buildroot}/%{_bindir}/; rename '' 'dldt_' *; popd # cmake templates mv -f %{buildroot}/usr/runtime/cmake %{buildroot}%{_libdir}/cmake # udev rules mkdir -p %{buildroot}/%{_sysconfdir}/udev/rules.d mv -f %{buildroot}/usr/runtime/3rdparty/*.rules %{buildroot}/%{_sysconfdir}/udev/rules.d/ # firmware mkdir -p %{buildroot}/%{_libdir}/dldt cp -PRf bin/*/RelWithDebInfo/lib/*.mvcmd %{buildroot}/%{_libdir}/dldt/ # model optimizers cp -PRf model-optimizer/mo_*.py %{buildroot}/%{_bindir}/ cp -PRf model-optimizer/mo %{buildroot}/%{python3_sitearch}/ cp -PRf model-optimizer/mo.py %{buildroot}/%{python3_sitearch}/ cp -PRf model-optimizer/extensions %{buildroot}/%{python3_sitearch}/ cp -PRf model-optimizer/*.txt %{buildroot}/%{python3_sitearch}/ # cmake fixes sed -i 's|/runtime/|/|g' %{buildroot}/%{_libdir}/cmake/OpenVINOTargets.cmake sed -i 's|/runtime/lib/.*/|/%{_lib}/|g' %{buildroot}/%{_libdir}/cmake/OpenVINOTargets-relwithdebinfo.cmake sed -i 's|${PACKAGE_PREFIX_DIR}/include|/usr/include|g' %{buildroot}/%{_libdir}/cmake/InferenceEngineConfig.cmake sed -i '/"${_IMPORT_PREFIX}" PATH)/a set(_IMPORT_PREFIX "/usr")' %{buildroot}/%{_libdir}/cmake/OpenVINOTargets.cmake # remove spurrious rm -rf %{buildroot}/usr/tools rm -rf %{buildroot}/usr/samples rm -rf %{buildroot}/usr/licensing rm -rf %{buildroot}/usr/setupvars.sh rm -rf %{buildroot}/usr/install_dependencies rm -rf %{buildroot}/%{python3_sitearch}/*.txt %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %doc README.md %license LICENSE %{_bindir}/*.py %{_bindir}/dldt_compile_tool %{_libdir}/dldt %{_libdir}/lib*Plugin.so %{_libdir}/libopencv_c_wrapper.so %{_libdir}/libtemplate_extension.so %{_libdir}/libinference_engine_c_api.so %{_libdir}/libinference_engine_preproc.so %{_libdir}/libinference_engine_legacy.so %{_libdir}/libinference_engine_lp_transformations.so # % {_libdir}/libinference_engine_lp_transformations_legacy.so %{_libdir}/libinference_engine_snippets.so %{_libdir}/libinference_engine_transformations.so # % {_libdir}/libinference_engine_ir_reader.so # % {_libdir}/libinference_engine_ir_v7_reader.so # % {_libdir}/libinference_engine_onnx_reader.so %{_libdir}/libtemplate_ov_extension.so %{_libdir}/libinference_engine.so.* %{_libdir}/libfrontend_common.so %{_libdir}/libie_backend.so %{_libdir}/libinterpreter_backend.so %{_libdir}/libir_ov_frontend.so %if 0%{?fedora} %{_libdir}/libpaddlepaddle_ov_frontend.so %{_libdir}/libtensorflow_ov_frontend.so %endif # % {_libdir}/libir_ngraph_frontend.so %{_libdir}/libngraph.so %{_libdir}/libngraph_backend.so %{_libdir}/libov_hetero_plugin.so %{_sysconfdir}/udev/rules.d/* %files devel %{_libdir}/cmake/* %{_libdir}/libinference_engine.so %{_includedir}/* %files examples %exclude %{_bindir}/dldt_compile_tool %{_bindir}/dldt_* %{_libdir}/libformat_reader.so* %files python3 %{python3_sitearch}/* %changelog * Sun Jan 27 2019 Cristian Balint - github build