2021-04-12 18:23:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2023-02-09 11:40:11 +00:00
|
|
|
, fetchurl
|
|
|
|
, substituteAll
|
2024-01-02 11:29:13 +00:00
|
|
|
, cudaSupport ? opencv.cudaSupport or false
|
2023-02-09 11:40:11 +00:00
|
|
|
|
|
|
|
# build
|
|
|
|
, addOpenGLRunpath
|
|
|
|
, autoPatchelfHook
|
2021-04-12 18:23:04 +00:00
|
|
|
, cmake
|
|
|
|
, git
|
2023-02-09 11:40:11 +00:00
|
|
|
, libarchive
|
|
|
|
, pkg-config
|
|
|
|
, python
|
|
|
|
, shellcheck
|
|
|
|
|
|
|
|
# runtime
|
|
|
|
, libusb1
|
|
|
|
, libxml2
|
2024-01-02 11:29:13 +00:00
|
|
|
, ocl-icd
|
2023-02-09 11:40:11 +00:00
|
|
|
, opencv
|
2021-04-12 18:23:04 +00:00
|
|
|
, protobuf
|
2023-02-09 11:40:11 +00:00
|
|
|
, pugixml
|
2021-04-12 18:23:04 +00:00
|
|
|
, tbb
|
2024-01-02 11:29:13 +00:00
|
|
|
, cudaPackages
|
2021-04-12 18:23:04 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2023-02-09 11:40:11 +00:00
|
|
|
# See GNA_VERSION in cmake/dependencies.cmake
|
2023-07-15 17:15:38 +00:00
|
|
|
gna_version = "03.05.00.1906";
|
2023-02-09 11:40:11 +00:00
|
|
|
gna = fetchurl {
|
|
|
|
url = "https://storage.openvinotoolkit.org/dependencies/gna/gna_${gna_version}.zip";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-SlvobZwCaw4Qr6wqV/x8mddisw49UGq7OjOA+8/icm4=";
|
2021-04-12 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
tbbbind_version = "2_5";
|
|
|
|
tbbbind = fetchurl {
|
2023-07-15 17:15:38 +00:00
|
|
|
url = "https://storage.openvinotoolkit.org/dependencies/thirdparty/linux/tbbbind_${tbbbind_version}_static_lin_v3.tgz";
|
|
|
|
hash = "sha256-053rJiwGmBteLS48WT6fyb5izk/rkd1OZI6SdTZZprM=";
|
2023-02-09 11:40:11 +00:00
|
|
|
};
|
2021-04-12 18:23:04 +00:00
|
|
|
in
|
2023-02-09 11:40:11 +00:00
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "openvino";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "2023.0.0";
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openvinotoolkit";
|
|
|
|
repo = "openvino";
|
2023-02-09 11:40:11 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2021-04-12 18:23:04 +00:00
|
|
|
fetchSubmodules = true;
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-z88SgAZ0UX9X7BhBA7/NU/UhVLltb6ANKolruU8YiZQ=";
|
2021-04-12 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"python"
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
addOpenGLRunpath
|
|
|
|
autoPatchelfHook
|
|
|
|
cmake
|
|
|
|
git
|
|
|
|
libarchive
|
|
|
|
pkg-config
|
|
|
|
(python.withPackages (ps: with ps; [
|
|
|
|
cython
|
|
|
|
pybind11
|
|
|
|
setuptools
|
|
|
|
]))
|
|
|
|
shellcheck
|
2024-01-02 11:29:13 +00:00
|
|
|
] ++ lib.optionals cudaSupport [
|
|
|
|
cudaPackages.cuda_nvcc
|
2023-02-09 11:40:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./cmake.patch;
|
|
|
|
inherit (lib) version;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
dontUseCmakeBuildDir = true;
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2023-02-09 11:40:11 +00:00
|
|
|
"-DCMAKE_PREFIX_PATH:PATH=${placeholder "out"}"
|
|
|
|
"-DCMAKE_MODULE_PATH:PATH=${placeholder "out"}/lib/cmake"
|
|
|
|
"-DENABLE_LTO:BOOL=ON"
|
|
|
|
# protobuf
|
|
|
|
"-DENABLE_SYSTEM_PROTOBUF:BOOL=OFF"
|
|
|
|
"-DProtobuf_LIBRARIES=${protobuf}/lib/libprotobuf${stdenv.hostPlatform.extensions.sharedLibrary}"
|
|
|
|
# tbb
|
|
|
|
"-DENABLE_SYSTEM_TBB:BOOL=ON"
|
|
|
|
# opencv
|
2021-04-12 18:23:04 +00:00
|
|
|
"-DENABLE_OPENCV:BOOL=ON"
|
2023-02-09 11:40:11 +00:00
|
|
|
"-DOpenCV_DIR=${opencv}/lib/cmake/opencv4/"
|
|
|
|
# pugixml
|
|
|
|
"-DENABLE_SYSTEM_PUGIXML:BOOL=ON"
|
|
|
|
# onednn
|
|
|
|
"-DENABLE_ONEDNN_FOR_GPU:BOOL=OFF"
|
|
|
|
# intel gna
|
|
|
|
"-DENABLE_INTEL_GNA:BOOL=ON"
|
|
|
|
# python
|
|
|
|
"-DENABLE_PYTHON:BOOL=ON"
|
|
|
|
# tests
|
|
|
|
"-DENABLE_CPPLINT:BOOL=OFF"
|
2021-04-12 18:23:04 +00:00
|
|
|
"-DBUILD_TESTING:BOOL=OFF"
|
|
|
|
"-DENABLE_SAMPLES:BOOL=OFF"
|
2024-01-02 11:29:13 +00:00
|
|
|
(lib.cmakeBool "CMAKE_VERBOSE_MAKEFILE" true)
|
2021-04-12 18:23:04 +00:00
|
|
|
];
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isAarch64 "-Wno-narrowing";
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
autoPatchelfIgnoreMissingDeps = [
|
|
|
|
"libngraph_backend.so"
|
2021-04-12 18:23:04 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2023-02-09 11:40:11 +00:00
|
|
|
libusb1
|
|
|
|
libxml2
|
2024-01-02 11:29:13 +00:00
|
|
|
ocl-icd
|
|
|
|
opencv.cxxdev
|
2023-02-09 11:40:11 +00:00
|
|
|
protobuf
|
|
|
|
pugixml
|
2021-04-12 18:23:04 +00:00
|
|
|
tbb
|
2024-01-02 11:29:13 +00:00
|
|
|
] ++ lib.optionals cudaSupport [
|
|
|
|
cudaPackages.cuda_cudart
|
2023-02-09 11:40:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
pushd $out/python/python${lib.versions.majorMinor python.version}
|
|
|
|
mkdir -p $python
|
|
|
|
mv ./* $python/
|
|
|
|
popd
|
|
|
|
rm -r $out/python
|
|
|
|
'';
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# Link to OpenCL
|
|
|
|
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
|
|
|
|
addOpenGLRunpath "$lib"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "OpenVINO™ Toolkit repository";
|
|
|
|
longDescription = ''
|
|
|
|
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 several components: namely Model Optimizer, nGraph and Inference Engine, as well as CPU, GPU, MYRIAD,
|
|
|
|
multi device 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*.
|
|
|
|
'';
|
|
|
|
homepage = "https://docs.openvinotoolkit.org/";
|
|
|
|
license = with licenses; [ asl20 ];
|
2022-04-27 09:35:20 +00:00
|
|
|
platforms = platforms.all;
|
2023-07-15 17:15:38 +00:00
|
|
|
broken = (stdenv.isLinux && stdenv.isAarch64) # requires scons, then fails with *** Source directory cannot be under variant directory.
|
|
|
|
|| stdenv.isDarwin; # Cannot find macos sdk
|
2021-04-12 18:23:04 +00:00
|
|
|
maintainers = with maintainers; [ tfmoraes ];
|
|
|
|
};
|
|
|
|
}
|