onnxruntime: 1.10.0 -> 1.12.1

authored by

Christian Kögler and committed by
Jonathan Ringer
da9cf977 579237db

+37 -55
+37 -55
pkgs/development/libraries/onnxruntime/default.nix
··· 2 2 , lib 3 3 , fetchFromGitHub 4 4 , fetchpatch 5 - , runCommand 6 - , patchutils 5 + , fetchurl 7 6 , pkg-config 8 - , glibcLocales 9 7 , cmake 10 8 , python3 11 9 , libpng 12 10 , zlib 13 11 , eigen 14 12 , protobuf 15 - , nsync 16 - , flatbuffers 17 13 , howard-hinnant-date 18 - , re2 19 14 , nlohmann_json 20 15 , boost 21 16 , oneDNN 17 + , gtest 22 18 }: 23 19 24 20 let 25 - externals = { 26 - pytorch_cpuinfo = fetchFromGitHub { 27 - owner = "pytorch"; 28 - repo = "cpuinfo"; 29 - rev = "5916273f79a21551890fd3d56fc5375a78d1598d"; 30 - sha256 = "sha256-nXBnloVTuB+AVX59VDU/Wc+Dsx94o92YQuHp3jowx2A="; 31 - }; 32 - onnx = fetchFromGitHub { 33 - owner = "onnx"; 34 - repo = "onnx"; 35 - rev = "be76ca7148396176784ba8733133b9fb1186ea0d"; 36 - sha256 = "sha256-WwbfUijV67LL69RPgz+4m6EcwSyBNFweGUe0jkYRpbg="; 37 - }; 38 - "SafeInt/safeint" = fetchFromGitHub { 39 - owner = "dcleblanc"; 40 - repo = "SafeInt"; 41 - rev = "a104e0cf23be4fe848f7ef1f3e8996fe429b06bb"; 42 - sha256 = "sha256-LmQNIoHPqvl8asn86P33SDn+lCg8LpLfxUmoG9CGEdc="; 43 - }; 21 + # prefetch abseil 22 + # Note: keep URL in sync with `cmake/external/abseil-cpp.cmake` 23 + abseil = fetchurl { 24 + url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.zip"; 25 + sha256 = "sha256-pFZ/8C+spnG5XjHTFbqxi0K2xvGmDpHG6oTlohQhEsI="; 44 26 }; 45 27 in 46 28 stdenv.mkDerivation rec { 47 29 pname = "onnxruntime"; 48 - version = "1.10.0"; 30 + version = "1.12.1"; 49 31 50 32 src = fetchFromGitHub { 51 33 owner = "microsoft"; 52 34 repo = "onnxruntime"; 53 35 rev = "v${version}"; 54 - sha256 = "sha256-kWl0xrbTQL2FBSvpiqTcaj8uZV+ZV8gJJvj4/I0jopw="; 36 + sha256 = "sha256-wwllEemiHTp9aJcCd1gsTS4WUVMp5wW+4i/+6DzmAeM="; 37 + fetchSubmodules = true; 55 38 }; 56 39 57 - preConfigure = lib.concatStringsSep "\n" (lib.mapAttrsToList (name: path: '' 58 - rmdir cmake/external/${name} 59 - ln -s ${path} cmake/external/${name} 60 - '') externals); 61 - 62 40 patches = [ 63 - # Exclude the flatbuffers change which breaks things 64 - (runCommand "filtered" { 65 - AUR_PATCH = fetchpatch { 66 - name = "aur-build-fixes.patch"; 67 - url = "https://aur.archlinux.org/cgit/aur.git/plain/build-fixes.patch?h=python-onnxruntime&id=0185531906bda3a9aba93bbb0f3dcfeb0ae671ad"; 68 - sha256 = "sha256-bAJWThTbECQaoqDdkjHLneg6I1BshGMyCWaj7nfACvA="; 69 - }; 70 - } '' 71 - ${patchutils}/bin/filterdiff --hunks 1,2 $AUR_PATCH > $out 72 - '') 41 + # Use dnnl from nixpkgs instead of submodules 73 42 (fetchpatch { 74 43 name = "system-dnnl.patch"; 75 44 url = "https://aur.archlinux.org/cgit/aur.git/plain/system-dnnl.diff?h=python-onnxruntime&id=0185531906bda3a9aba93bbb0f3dcfeb0ae671ad"; ··· 77 46 }) 78 47 ]; 79 48 80 - # TODO: build server, and move .so's to lib output 81 - outputs = [ "out" "dev" ]; 82 - 83 49 nativeBuildInputs = [ 84 50 cmake 85 51 pkg-config 86 52 python3 53 + gtest 87 54 ]; 88 55 89 56 buildInputs = [ 90 57 libpng 91 58 zlib 92 59 protobuf 93 - nsync 94 - flatbuffers 95 60 howard-hinnant-date 96 - re2 97 61 nlohmann_json 98 62 boost 99 63 oneDNN 100 64 ]; 101 65 66 + # TODO: build server, and move .so's to lib output 67 + outputs = [ "out" "dev" ]; 68 + 69 + enableParallelBuilding = true; 70 + 102 71 cmakeDir = "../cmake"; 103 72 104 73 cmakeFlags = [ 105 74 "-Donnxruntime_PREFER_SYSTEM_LIB=ON" 106 75 "-Donnxruntime_BUILD_SHARED_LIB=ON" 107 76 "-Donnxruntime_ENABLE_LTO=ON" 108 - "-Donnxruntime_BUILD_UNIT_TESTS=OFF" 77 + "-Donnxruntime_BUILD_UNIT_TESTS=ON" 109 78 "-Donnxruntime_USE_PREINSTALLED_EIGEN=ON" 110 79 "-Donnxruntime_USE_MPI=ON" 111 80 "-Deigen_SOURCE_PATH=${eigen.src}" 112 81 "-Donnxruntime_USE_DNNL=YES" 113 82 ]; 114 83 115 - enableParallelBuilding = true; 84 + doCheck = true; 116 85 117 - meta = { 86 + postPatch = '' 87 + substituteInPlace cmake/external/abseil-cpp.cmake \ 88 + --replace "${abseil.url}" "${abseil}" 89 + ''; 90 + 91 + postInstall = '' 92 + # perform parts of `tools/ci_build/github/linux/copy_strip_binary.sh` 93 + install -m644 -Dt $out/include \ 94 + ../include/onnxruntime/core/framework/provider_options.h \ 95 + ../include/onnxruntime/core/providers/cpu/cpu_provider_factory.h \ 96 + ../include/onnxruntime/core/session/onnxruntime_*.h 97 + ''; 98 + 99 + meta = with lib; { 118 100 description = "Cross-platform, high performance scoring engine for ML models"; 119 101 longDescription = '' 120 102 ONNX Runtime is a performance-focused complete scoring engine ··· 126 108 compatibility. 127 109 ''; 128 110 homepage = "https://github.com/microsoft/onnxruntime"; 129 - changelog = "https://github.com/microsoft/onnxruntime/releases"; 111 + changelog = "https://github.com/microsoft/onnxruntime/releases/tag/v${version}"; 130 112 # https://github.com/microsoft/onnxruntime/blob/master/BUILD.md#architectures 131 - platforms = lib.platforms.unix; 132 - license = lib.licenses.mit; 133 - maintainers = with lib.maintainers; [ jonringer puffnfresh ]; 113 + platforms = platforms.unix; 114 + license = licenses.mit; 115 + maintainers = with maintainers; [ jonringer puffnfresh ck3d ]; 134 116 }; 135 117 }