2021-04-12 18:23:04 +00:00
|
|
|
{ lib
|
2024-02-07 01:22:34 +00:00
|
|
|
, gcc12Stdenv
|
2021-04-12 18:23:04 +00:00
|
|
|
, fetchFromGitHub
|
2023-02-09 11:40:11 +00:00
|
|
|
, fetchurl
|
2024-01-02 11:29:13 +00:00
|
|
|
, cudaSupport ? opencv.cudaSupport or false
|
2023-02-09 11:40:11 +00:00
|
|
|
|
|
|
|
# build
|
2024-06-20 14:57:18 +00:00
|
|
|
, scons
|
2023-02-09 11:40:11 +00:00
|
|
|
, addOpenGLRunpath
|
|
|
|
, autoPatchelfHook
|
2021-04-12 18:23:04 +00:00
|
|
|
, cmake
|
|
|
|
, git
|
2023-02-09 11:40:11 +00:00
|
|
|
, libarchive
|
2024-04-21 15:54:59 +00:00
|
|
|
, patchelf
|
2023-02-09 11:40:11 +00:00
|
|
|
, pkg-config
|
2024-04-21 15:54:59 +00:00
|
|
|
, python3Packages
|
2023-02-09 11:40:11 +00:00
|
|
|
, shellcheck
|
|
|
|
|
|
|
|
# runtime
|
2024-02-07 01:22:34 +00:00
|
|
|
, flatbuffers
|
2024-05-15 15:35:15 +00:00
|
|
|
, level-zero
|
2023-02-09 11:40:11 +00:00
|
|
|
, 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
|
2024-02-07 01:22:34 +00:00
|
|
|
, snappy
|
2024-06-20 14:57:18 +00:00
|
|
|
, tbb_2021_5
|
2024-01-02 11:29:13 +00:00
|
|
|
, cudaPackages
|
2021-04-12 18:23:04 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-02-07 01:22:34 +00:00
|
|
|
inherit (lib)
|
|
|
|
cmakeBool
|
|
|
|
;
|
|
|
|
|
|
|
|
stdenv = gcc12Stdenv;
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
# prevent scons from leaking in the default python version
|
|
|
|
scons' = scons.override { python3 = python3Packages.python; };
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
tbbbind_version = "2_5";
|
|
|
|
tbbbind = fetchurl {
|
2024-02-07 01:22:34 +00:00
|
|
|
url = "https://storage.openvinotoolkit.org/dependencies/thirdparty/linux/tbbbind_${tbbbind_version}_static_lin_v4.tgz";
|
|
|
|
hash = "sha256-Tr8wJGUweV8Gb7lhbmcHxrF756ZdKdNRi1eKdp3VTuo=";
|
2023-02-09 11:40:11 +00:00
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
python = python3Packages.python.withPackages (ps: with ps; [
|
|
|
|
cython
|
|
|
|
pybind11
|
|
|
|
setuptools
|
|
|
|
sphinx
|
|
|
|
wheel
|
|
|
|
]);
|
|
|
|
|
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";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "2024.2.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;
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-HiKKvmqgbwW625An+Su0EOHqVrP18yvG2aOzrS0jWr4=";
|
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
|
2024-04-21 15:54:59 +00:00
|
|
|
patchelf
|
2023-02-09 11:40:11 +00:00
|
|
|
pkg-config
|
2024-04-21 15:54:59 +00:00
|
|
|
python
|
2024-06-20 14:57:18 +00:00
|
|
|
scons'
|
2023-02-09 11:40:11 +00:00
|
|
|
shellcheck
|
2024-01-02 11:29:13 +00:00
|
|
|
] ++ lib.optionals cudaSupport [
|
|
|
|
cudaPackages.cuda_nvcc
|
2023-02-09 11:40:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
mkdir -p temp/tbbbind_${tbbbind_version}
|
|
|
|
pushd temp/tbbbind_${tbbbind_version}
|
|
|
|
bsdtar -xf ${tbbbind}
|
|
|
|
echo "${tbbbind.url}" > ie_dependency.info
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
dontUseSconsCheck = true;
|
|
|
|
dontUseSconsBuild = true;
|
|
|
|
dontUseSconsInstall = true;
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2024-02-07 01:22:34 +00:00
|
|
|
"-Wno-dev"
|
2023-02-09 11:40:11 +00:00
|
|
|
"-DCMAKE_MODULE_PATH:PATH=${placeholder "out"}/lib/cmake"
|
2024-02-07 01:22:34 +00:00
|
|
|
"-DCMAKE_PREFIX_PATH:PATH=${placeholder "out"}"
|
2023-02-09 11:40:11 +00:00
|
|
|
"-DOpenCV_DIR=${opencv}/lib/cmake/opencv4/"
|
2024-02-07 01:22:34 +00:00
|
|
|
"-DProtobuf_LIBRARIES=${protobuf}/lib/libprotobuf${stdenv.hostPlatform.extensions.sharedLibrary}"
|
2024-04-21 15:54:59 +00:00
|
|
|
"-DPython_EXECUTABLE=${python.interpreter}"
|
2024-02-07 01:22:34 +00:00
|
|
|
|
|
|
|
(cmakeBool "CMAKE_VERBOSE_MAKEFILE" true)
|
|
|
|
(cmakeBool "NCC_SYLE" false)
|
|
|
|
(cmakeBool "BUILD_TESTING" false)
|
|
|
|
(cmakeBool "ENABLE_CPPLINT" false)
|
|
|
|
(cmakeBool "ENABLE_TESTING" false)
|
|
|
|
(cmakeBool "ENABLE_SAMPLES" false)
|
|
|
|
|
|
|
|
# features
|
2024-06-20 14:57:18 +00:00
|
|
|
(cmakeBool "ENABLE_INTEL_CPU" stdenv.isx86_64)
|
2024-02-07 01:22:34 +00:00
|
|
|
(cmakeBool "ENABLE_JS" false)
|
|
|
|
(cmakeBool "ENABLE_LTO" true)
|
|
|
|
(cmakeBool "ENABLE_ONEDNN_FOR_GPU" false)
|
|
|
|
(cmakeBool "ENABLE_OPENCV" true)
|
|
|
|
(cmakeBool "ENABLE_PYTHON" true)
|
|
|
|
|
|
|
|
# system libs
|
|
|
|
(cmakeBool "ENABLE_SYSTEM_FLATBUFFERS" true)
|
|
|
|
(cmakeBool "ENABLE_SYSTEM_OPENCL" true)
|
|
|
|
(cmakeBool "ENABLE_SYSTEM_PROTOBUF" false)
|
|
|
|
(cmakeBool "ENABLE_SYSTEM_PUGIXML" true)
|
|
|
|
(cmakeBool "ENABLE_SYSTEM_SNAPPY" true)
|
|
|
|
(cmakeBool "ENABLE_SYSTEM_TBB" true)
|
2021-04-12 18:23:04 +00:00
|
|
|
];
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
autoPatchelfIgnoreMissingDeps = [
|
|
|
|
"libngraph_backend.so"
|
2021-04-12 18:23:04 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2024-02-07 01:22:34 +00:00
|
|
|
flatbuffers
|
2024-05-15 15:35:15 +00:00
|
|
|
level-zero
|
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
|
|
|
pugixml
|
2024-02-07 01:22:34 +00:00
|
|
|
snappy
|
2024-06-20 14:57:18 +00:00
|
|
|
tbb_2021_5
|
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 = ''
|
|
|
|
mkdir -p $python
|
2024-02-07 01:22:34 +00:00
|
|
|
mv $out/python/* $python/
|
|
|
|
rmdir $out/python
|
2023-02-09 11:40:11 +00:00
|
|
|
'';
|
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;
|
2024-06-20 14:57:18 +00:00
|
|
|
broken = stdenv.isDarwin; # Cannot find macos sdk
|
2021-04-12 18:23:04 +00:00
|
|
|
maintainers = with maintainers; [ tfmoraes ];
|
|
|
|
};
|
|
|
|
}
|