onnxruntime: 1.10.0 -> 1.12.1
This commit is contained in:
parent
579237dbf5
commit
da9cf977b7
@ -2,74 +2,43 @@
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, runCommand
|
||||
, patchutils
|
||||
, fetchurl
|
||||
, pkg-config
|
||||
, glibcLocales
|
||||
, cmake
|
||||
, python3
|
||||
, libpng
|
||||
, zlib
|
||||
, eigen
|
||||
, protobuf
|
||||
, nsync
|
||||
, flatbuffers
|
||||
, howard-hinnant-date
|
||||
, re2
|
||||
, nlohmann_json
|
||||
, boost
|
||||
, oneDNN
|
||||
, gtest
|
||||
}:
|
||||
|
||||
let
|
||||
externals = {
|
||||
pytorch_cpuinfo = fetchFromGitHub {
|
||||
owner = "pytorch";
|
||||
repo = "cpuinfo";
|
||||
rev = "5916273f79a21551890fd3d56fc5375a78d1598d";
|
||||
sha256 = "sha256-nXBnloVTuB+AVX59VDU/Wc+Dsx94o92YQuHp3jowx2A=";
|
||||
};
|
||||
onnx = fetchFromGitHub {
|
||||
owner = "onnx";
|
||||
repo = "onnx";
|
||||
rev = "be76ca7148396176784ba8733133b9fb1186ea0d";
|
||||
sha256 = "sha256-WwbfUijV67LL69RPgz+4m6EcwSyBNFweGUe0jkYRpbg=";
|
||||
};
|
||||
"SafeInt/safeint" = fetchFromGitHub {
|
||||
owner = "dcleblanc";
|
||||
repo = "SafeInt";
|
||||
rev = "a104e0cf23be4fe848f7ef1f3e8996fe429b06bb";
|
||||
sha256 = "sha256-LmQNIoHPqvl8asn86P33SDn+lCg8LpLfxUmoG9CGEdc=";
|
||||
};
|
||||
# prefetch abseil
|
||||
# Note: keep URL in sync with `cmake/external/abseil-cpp.cmake`
|
||||
abseil = fetchurl {
|
||||
url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.zip";
|
||||
sha256 = "sha256-pFZ/8C+spnG5XjHTFbqxi0K2xvGmDpHG6oTlohQhEsI=";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "onnxruntime";
|
||||
version = "1.10.0";
|
||||
version = "1.12.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "microsoft";
|
||||
repo = "onnxruntime";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-kWl0xrbTQL2FBSvpiqTcaj8uZV+ZV8gJJvj4/I0jopw=";
|
||||
sha256 = "sha256-wwllEemiHTp9aJcCd1gsTS4WUVMp5wW+4i/+6DzmAeM=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
preConfigure = lib.concatStringsSep "\n" (lib.mapAttrsToList (name: path: ''
|
||||
rmdir cmake/external/${name}
|
||||
ln -s ${path} cmake/external/${name}
|
||||
'') externals);
|
||||
|
||||
patches = [
|
||||
# Exclude the flatbuffers change which breaks things
|
||||
(runCommand "filtered" {
|
||||
AUR_PATCH = fetchpatch {
|
||||
name = "aur-build-fixes.patch";
|
||||
url = "https://aur.archlinux.org/cgit/aur.git/plain/build-fixes.patch?h=python-onnxruntime&id=0185531906bda3a9aba93bbb0f3dcfeb0ae671ad";
|
||||
sha256 = "sha256-bAJWThTbECQaoqDdkjHLneg6I1BshGMyCWaj7nfACvA=";
|
||||
};
|
||||
} ''
|
||||
${patchutils}/bin/filterdiff --hunks 1,2 $AUR_PATCH > $out
|
||||
'')
|
||||
# Use dnnl from nixpkgs instead of submodules
|
||||
(fetchpatch {
|
||||
name = "system-dnnl.patch";
|
||||
url = "https://aur.archlinux.org/cgit/aur.git/plain/system-dnnl.diff?h=python-onnxruntime&id=0185531906bda3a9aba93bbb0f3dcfeb0ae671ad";
|
||||
@ -77,44 +46,57 @@ stdenv.mkDerivation rec {
|
||||
})
|
||||
];
|
||||
|
||||
# TODO: build server, and move .so's to lib output
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
python3
|
||||
gtest
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libpng
|
||||
zlib
|
||||
protobuf
|
||||
nsync
|
||||
flatbuffers
|
||||
howard-hinnant-date
|
||||
re2
|
||||
nlohmann_json
|
||||
boost
|
||||
oneDNN
|
||||
];
|
||||
|
||||
# TODO: build server, and move .so's to lib output
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
cmakeDir = "../cmake";
|
||||
|
||||
cmakeFlags = [
|
||||
"-Donnxruntime_PREFER_SYSTEM_LIB=ON"
|
||||
"-Donnxruntime_BUILD_SHARED_LIB=ON"
|
||||
"-Donnxruntime_ENABLE_LTO=ON"
|
||||
"-Donnxruntime_BUILD_UNIT_TESTS=OFF"
|
||||
"-Donnxruntime_BUILD_UNIT_TESTS=ON"
|
||||
"-Donnxruntime_USE_PREINSTALLED_EIGEN=ON"
|
||||
"-Donnxruntime_USE_MPI=ON"
|
||||
"-Deigen_SOURCE_PATH=${eigen.src}"
|
||||
"-Donnxruntime_USE_DNNL=YES"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
doCheck = true;
|
||||
|
||||
meta = {
|
||||
postPatch = ''
|
||||
substituteInPlace cmake/external/abseil-cpp.cmake \
|
||||
--replace "${abseil.url}" "${abseil}"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
# perform parts of `tools/ci_build/github/linux/copy_strip_binary.sh`
|
||||
install -m644 -Dt $out/include \
|
||||
../include/onnxruntime/core/framework/provider_options.h \
|
||||
../include/onnxruntime/core/providers/cpu/cpu_provider_factory.h \
|
||||
../include/onnxruntime/core/session/onnxruntime_*.h
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Cross-platform, high performance scoring engine for ML models";
|
||||
longDescription = ''
|
||||
ONNX Runtime is a performance-focused complete scoring engine
|
||||
@ -126,10 +108,10 @@ stdenv.mkDerivation rec {
|
||||
compatibility.
|
||||
'';
|
||||
homepage = "https://github.com/microsoft/onnxruntime";
|
||||
changelog = "https://github.com/microsoft/onnxruntime/releases";
|
||||
changelog = "https://github.com/microsoft/onnxruntime/releases/tag/v${version}";
|
||||
# https://github.com/microsoft/onnxruntime/blob/master/BUILD.md#architectures
|
||||
platforms = lib.platforms.unix;
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ jonringer puffnfresh ];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ jonringer puffnfresh ck3d ];
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user