Merge pull request #214574 from mweinelt/openvino-2022.3.0
openvino: 2021.2 -> 2022.3.0
This commit is contained in:
commit
ff4ed85523
31
pkgs/development/libraries/openvino/cmake.patch
Normal file
31
pkgs/development/libraries/openvino/cmake.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
diff --git a/cmake/developer_package/linux_name.cmake b/cmake/developer_package/linux_name.cmake
|
||||||
|
index 3e8c775770..2d5e00fb8b 100644
|
||||||
|
--- a/cmake/developer_package/linux_name.cmake
|
||||||
|
+++ b/cmake/developer_package/linux_name.cmake
|
||||||
|
@@ -6,25 +6,7 @@ include(target_flags)
|
||||||
|
|
||||||
|
if(LINUX)
|
||||||
|
function(get_linux_name res_var)
|
||||||
|
- if(EXISTS "/etc/lsb-release")
|
||||||
|
- # linux version detection using cat /etc/lsb-release
|
||||||
|
- file(READ "/etc/lsb-release" release_data)
|
||||||
|
- set(name_regex "DISTRIB_ID=([^ \n]*)\n")
|
||||||
|
- set(version_regex "DISTRIB_RELEASE=([0-9]+(\\.[0-9]+)?)")
|
||||||
|
- else()
|
||||||
|
- execute_process(COMMAND find -L /etc/ -maxdepth 1 -type f -name *-release -exec cat {} \;
|
||||||
|
- OUTPUT_VARIABLE release_data
|
||||||
|
- RESULT_VARIABLE result)
|
||||||
|
- string(REPLACE "Red Hat" "CentOS" release_data "${release_data}")
|
||||||
|
- set(name_regex "NAME=\"([^ \"\n]*).*\"\n")
|
||||||
|
- set(version_regex "VERSION=\"([0-9]+(\\.[0-9]+)?)[^\n]*\"")
|
||||||
|
- endif()
|
||||||
|
-
|
||||||
|
- string(REGEX MATCH ${name_regex} name ${release_data})
|
||||||
|
- set(os_name ${CMAKE_MATCH_1})
|
||||||
|
-
|
||||||
|
- string(REGEX MATCH ${version_regex} version ${release_data})
|
||||||
|
- set(os_name "${os_name} ${CMAKE_MATCH_1}")
|
||||||
|
+ set(os_name "NixOS @version@")
|
||||||
|
|
||||||
|
if(os_name)
|
||||||
|
set(${res_var} ${os_name} PARENT_SCOPE)
|
@ -1,115 +1,167 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, addOpenGLRunpath
|
|
||||||
, autoPatchelfHook
|
|
||||||
, stdenv
|
, stdenv
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
|
, fetchurl
|
||||||
|
, substituteAll
|
||||||
|
|
||||||
|
# build
|
||||||
|
, addOpenGLRunpath
|
||||||
|
, autoPatchelfHook
|
||||||
, cmake
|
, cmake
|
||||||
, git
|
, git
|
||||||
, protobuf
|
, libarchive
|
||||||
, tbb
|
, pkg-config
|
||||||
, opencv
|
|
||||||
, unzip
|
|
||||||
, shellcheck
|
|
||||||
, srcOnly
|
|
||||||
, python
|
, python
|
||||||
, enablePython ? false
|
, shellcheck
|
||||||
|
|
||||||
|
# runtime
|
||||||
|
, libusb1
|
||||||
|
, libxml2
|
||||||
|
, opencv
|
||||||
|
, protobuf
|
||||||
|
, pugixml
|
||||||
|
, tbb
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
# See FIRMWARE_PACKAGE_VERSION in src/plugins/intel_myriad/myriad_dependencies.cmake
|
||||||
onnx_src = srcOnly {
|
myriad_firmware_version = "20221129_35";
|
||||||
name = "onnx-patched";
|
myriad_usb_firmware = fetchurl {
|
||||||
src = fetchFromGitHub {
|
url = "https://storage.openvinotoolkit.org/dependencies/myriad/firmware_usb-ma2x8x_${myriad_firmware_version}.zip";
|
||||||
owner = "onnx";
|
hash = "sha256-HKNWbSlMjSafOgrS9WmenbsmeaJKRVssw0NhIwPYZ70=";
|
||||||
repo = "onnx";
|
|
||||||
rev = "v1.8.1";
|
|
||||||
sha256 = "+1zNnZ4lAyVYRptfk0PV7koIX9FqcfD1Ah33qj/G2rA=";
|
|
||||||
};
|
};
|
||||||
patches = [
|
myriad_pcie_firmware = fetchurl {
|
||||||
# Fix build with protobuf 3.18+
|
url = "https://storage.openvinotoolkit.org/dependencies/myriad/firmware_pcie-ma2x8x_${myriad_firmware_version}.zip";
|
||||||
# Remove with onnx 1.9 release
|
hash = "sha256-VmfrAoKQ++ySIgAxWQul+Hd0p7Y4sTF44Nz4RHpO6Mo=";
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/onnx/onnx/commit/d3bc82770474761571f950347560d62a35d519d7.patch";
|
|
||||||
sha256 = "0vdsrklkzhdjaj8wdsl4icn93q3961g8dx35zvff0nhpr08wjb7y";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# See GNA_VERSION in cmake/dependencies.cmake
|
||||||
|
gna_version = "03.00.00.1910";
|
||||||
|
gna = fetchurl {
|
||||||
|
url = "https://storage.openvinotoolkit.org/dependencies/gna/gna_${gna_version}.zip";
|
||||||
|
hash = "sha256-iU3bwK40WfBFE7hTsMq8MokN1Oo3IooCK2oyEBvbt/g=";
|
||||||
|
};
|
||||||
|
|
||||||
|
tbbbind_version = "2_5";
|
||||||
|
tbbbind = fetchurl {
|
||||||
|
url = "https://download.01.org/opencv/master/openvinotoolkit/thirdparty/linux/tbbbind_${tbbbind_version}_static_lin_v2.tgz";
|
||||||
|
hash = "sha256-hl54lMWEAiM8rw0bKIBW4OarK/fJ0AydxgVhxIS8kPQ=";
|
||||||
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "openvino";
|
pname = "openvino";
|
||||||
version = "2021.2";
|
version = "2022.3.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "openvinotoolkit";
|
owner = "openvinotoolkit";
|
||||||
repo = "openvino";
|
repo = "openvino";
|
||||||
rev = version;
|
rev = "refs/tags/${version}";
|
||||||
sha256 = "pv4WTfY1U5GbA9Yj07UOLQifvVH3oDfWptxxYW5IwVQ=";
|
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
|
hash = "sha256-Ie58zTNatiYZZQJ8kJh/+HlSetQjhAtf2Us83z1jGv4=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
outputs = [
|
||||||
|
"out"
|
||||||
|
"python"
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
addOpenGLRunpath
|
||||||
|
autoPatchelfHook
|
||||||
|
cmake
|
||||||
|
git
|
||||||
|
libarchive
|
||||||
|
pkg-config
|
||||||
|
(python.withPackages (ps: with ps; [
|
||||||
|
cython
|
||||||
|
pybind11
|
||||||
|
setuptools
|
||||||
|
]))
|
||||||
|
shellcheck
|
||||||
|
];
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
(substituteAll {
|
||||||
|
src = ./cmake.patch;
|
||||||
|
inherit (lib) version;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
mkdir -p temp/vpu/firmware/{pcie,usb}-ma2x8x
|
||||||
|
pushd temp/vpu/firmware
|
||||||
|
bsdtar -xf ${myriad_pcie_firmware} -C pcie-ma2x8x
|
||||||
|
echo "${myriad_pcie_firmware.url}" > pcie-ma2x8x/ie_dependency.info
|
||||||
|
bsdtar -xf ${myriad_usb_firmware} -C usb-ma2x8x
|
||||||
|
echo "${myriad_usb_firmware.url}" > usb-ma2x8x/ie_dependency.info
|
||||||
|
popd
|
||||||
|
|
||||||
|
mkdir -p temp/gna_${gna_version}
|
||||||
|
pushd temp/
|
||||||
|
bsdtar -xf ${gna}
|
||||||
|
autoPatchelf gna_${gna_version}
|
||||||
|
echo "${gna.url}" > gna_${gna_version}/ie_dependency.info
|
||||||
|
popd
|
||||||
|
|
||||||
|
mkdir -p temp/tbbbind_${tbbbind_version}
|
||||||
|
pushd temp/tbbbind_${tbbbind_version}
|
||||||
|
bsdtar -xf ${tbbbind}
|
||||||
|
echo "${tbbbind.url}" > ie_dependency.info
|
||||||
|
popd
|
||||||
|
'';
|
||||||
|
|
||||||
dontUseCmakeBuildDir = true;
|
dontUseCmakeBuildDir = true;
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DNGRAPH_USE_SYSTEM_PROTOBUF:BOOL=ON"
|
"-DCMAKE_PREFIX_PATH:PATH=${placeholder "out"}"
|
||||||
"-DFETCHCONTENT_FULLY_DISCONNECTED:BOOL=ON"
|
"-DCMAKE_MODULE_PATH:PATH=${placeholder "out"}/lib/cmake"
|
||||||
"-DFETCHCONTENT_SOURCE_DIR_EXT_ONNX:STRING=${onnx_src}"
|
"-DENABLE_LTO:BOOL=ON"
|
||||||
"-DENABLE_VPU:BOOL=OFF"
|
# protobuf
|
||||||
"-DTBB_DIR:STRING=${tbb}"
|
"-DENABLE_SYSTEM_PROTOBUF:BOOL=OFF"
|
||||||
|
"-DProtobuf_LIBRARIES=${protobuf}/lib/libprotobuf${stdenv.hostPlatform.extensions.sharedLibrary}"
|
||||||
|
# tbb
|
||||||
|
"-DENABLE_SYSTEM_TBB:BOOL=ON"
|
||||||
|
# opencv
|
||||||
"-DENABLE_OPENCV:BOOL=ON"
|
"-DENABLE_OPENCV:BOOL=ON"
|
||||||
"-DOPENCV:STRING=${opencv}"
|
"-DOpenCV_DIR=${opencv}/lib/cmake/opencv4/"
|
||||||
"-DENABLE_GNA:BOOL=OFF"
|
# pugixml
|
||||||
"-DENABLE_SPEECH_DEMO:BOOL=OFF"
|
"-DENABLE_SYSTEM_PUGIXML:BOOL=ON"
|
||||||
"-DBUILD_TESTING:BOOL=OFF"
|
# onednn
|
||||||
"-DENABLE_CLDNN_TESTS:BOOL=OFF"
|
"-DENABLE_ONEDNN_FOR_GPU:BOOL=OFF"
|
||||||
"-DNGRAPH_INTERPRETER_ENABLE:BOOL=ON"
|
# intel gna
|
||||||
"-DNGRAPH_TEST_UTIL_ENABLE:BOOL=OFF"
|
"-DENABLE_INTEL_GNA:BOOL=ON"
|
||||||
"-DNGRAPH_UNIT_TEST_ENABLE:BOOL=OFF"
|
# python
|
||||||
"-DENABLE_SAMPLES:BOOL=OFF"
|
|
||||||
"-DENABLE_CPPLINT:BOOL=OFF"
|
|
||||||
] ++ lib.optionals enablePython [
|
|
||||||
"-DENABLE_PYTHON:BOOL=ON"
|
"-DENABLE_PYTHON:BOOL=ON"
|
||||||
|
# tests
|
||||||
|
"-DENABLE_CPPLINT:BOOL=OFF"
|
||||||
|
"-DBUILD_TESTING:BOOL=OFF"
|
||||||
|
"-DENABLE_SAMPLES:BOOL=OFF"
|
||||||
];
|
];
|
||||||
|
|
||||||
preConfigure = ''
|
autoPatchelfIgnoreMissingDeps = [
|
||||||
# To make install openvino inside /lib instead of /python
|
"libngraph_backend.so"
|
||||||
substituteInPlace inference-engine/ie_bridges/python/CMakeLists.txt \
|
|
||||||
--replace 'DESTINATION python/''${PYTHON_VERSION}/openvino' 'DESTINATION lib/''${PYTHON_VERSION}/site-packages/openvino' \
|
|
||||||
--replace 'DESTINATION python/''${PYTHON_VERSION}' 'DESTINATION lib/''${PYTHON_VERSION}/site-packages/openvino'
|
|
||||||
substituteInPlace inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt \
|
|
||||||
--replace 'python/''${PYTHON_VERSION}/openvino/inference_engine' 'lib/''${PYTHON_VERSION}/site-packages/openvino/inference_engine'
|
|
||||||
|
|
||||||
# Used to download OpenCV based on Linux Distro and make it use system OpenCV
|
|
||||||
substituteInPlace inference-engine/cmake/dependencies.cmake \
|
|
||||||
--replace 'include(linux_name)' ' ' \
|
|
||||||
--replace 'if (ENABLE_OPENCV)' 'if (ENABLE_OPENCV AND NOT DEFINED OPENCV)'
|
|
||||||
|
|
||||||
cmakeDir=$PWD
|
|
||||||
mkdir ../build
|
|
||||||
cd ../build
|
|
||||||
'';
|
|
||||||
|
|
||||||
autoPatchelfIgnoreMissingDeps = [ "libngraph_backend.so" ];
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
cmake
|
|
||||||
autoPatchelfHook
|
|
||||||
addOpenGLRunpath
|
|
||||||
unzip
|
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
git
|
libusb1
|
||||||
protobuf
|
libxml2
|
||||||
opencv
|
opencv
|
||||||
python
|
protobuf
|
||||||
|
pugixml
|
||||||
tbb
|
tbb
|
||||||
shellcheck
|
];
|
||||||
] ++ lib.optionals enablePython (with python.pkgs; [
|
|
||||||
cython
|
enableParallelBuilding = true;
|
||||||
pybind11
|
|
||||||
]);
|
postInstall = ''
|
||||||
|
pushd $out/python/python${lib.versions.majorMinor python.version}
|
||||||
|
mkdir -p $python
|
||||||
|
mv ./* $python/
|
||||||
|
popd
|
||||||
|
rm -r $out/python
|
||||||
|
'';
|
||||||
|
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
# Link to OpenCL
|
# Link to OpenCL
|
||||||
@ -130,8 +182,7 @@ stdenv.mkDerivation rec {
|
|||||||
homepage = "https://docs.openvinotoolkit.org/";
|
homepage = "https://docs.openvinotoolkit.org/";
|
||||||
license = with licenses; [ asl20 ];
|
license = with licenses; [ asl20 ];
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
broken = (stdenv.isLinux && stdenv.isx86_64) # at 2022-09-23
|
broken = stdenv.isDarwin; # Cannot find macos sdk
|
||||||
|| stdenv.isDarwin; # Cannot find macos sdk
|
|
||||||
maintainers = with maintainers; [ tfmoraes ];
|
maintainers = with maintainers; [ tfmoraes ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
40
pkgs/development/python-modules/openvino/default.nix
Normal file
40
pkgs/development/python-modules/openvino/default.nix
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{ lib
|
||||||
|
, buildPythonPackage
|
||||||
|
, openvino-native
|
||||||
|
, numpy
|
||||||
|
, python
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildPythonPackage {
|
||||||
|
pname = "openvino";
|
||||||
|
inherit (openvino-native) version;
|
||||||
|
format = "other";
|
||||||
|
|
||||||
|
src = openvino-native.python;
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
numpy
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out/${python.sitePackages}
|
||||||
|
cp -Rv * $out/${python.sitePackages}/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
pythonImportsCheck = [
|
||||||
|
"ngraph"
|
||||||
|
"openvino"
|
||||||
|
"openvino.runtime"
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "OpenVINO(TM) Runtime";
|
||||||
|
homepage = "https://github.com/openvinotoolkit/openvino";
|
||||||
|
license = licenses.asl20;
|
||||||
|
maintainers = with maintainers; [ hexa ];
|
||||||
|
};
|
||||||
|
}
|
@ -38720,8 +38720,9 @@ with pkgs;
|
|||||||
|
|
||||||
openring = callPackage ../applications/misc/openring { };
|
openring = callPackage ../applications/misc/openring { };
|
||||||
|
|
||||||
openvino = callPackage ../development/libraries/openvino
|
openvino = callPackage ../development/libraries/openvino {
|
||||||
{ stdenv = gcc10StdenvCompat; python = python3; };
|
python = python3;
|
||||||
|
};
|
||||||
|
|
||||||
phonetisaurus = callPackage ../development/libraries/phonetisaurus {
|
phonetisaurus = callPackage ../development/libraries/phonetisaurus {
|
||||||
# https://github.com/AdolfVonKleist/Phonetisaurus/issues/70
|
# https://github.com/AdolfVonKleist/Phonetisaurus/issues/70
|
||||||
|
@ -6692,10 +6692,11 @@ self: super: with self; {
|
|||||||
|
|
||||||
opentracing = callPackage ../development/python-modules/opentracing { };
|
opentracing = callPackage ../development/python-modules/opentracing { };
|
||||||
|
|
||||||
openvino = toPythonModule (pkgs.openvino.override {
|
openvino = callPackage ../development/python-modules/openvino {
|
||||||
inherit (self) python;
|
openvino-native = pkgs.openvino.override {
|
||||||
enablePython = true;
|
inherit python;
|
||||||
});
|
};
|
||||||
|
};
|
||||||
|
|
||||||
openwebifpy = callPackage ../development/python-modules/openwebifpy { };
|
openwebifpy = callPackage ../development/python-modules/openwebifpy { };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user