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 , lib 3 , fetchFromGitHub 4 , fetchpatch 5 - , runCommand 6 - , patchutils 7 , pkg-config 8 - , glibcLocales 9 , cmake 10 , python3 11 , libpng 12 , zlib 13 , eigen 14 , protobuf 15 - , nsync 16 - , flatbuffers 17 , howard-hinnant-date 18 - , re2 19 , nlohmann_json 20 , boost 21 , oneDNN 22 }: 23 24 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 - }; 44 }; 45 in 46 stdenv.mkDerivation rec { 47 pname = "onnxruntime"; 48 - version = "1.10.0"; 49 50 src = fetchFromGitHub { 51 owner = "microsoft"; 52 repo = "onnxruntime"; 53 rev = "v${version}"; 54 - sha256 = "sha256-kWl0xrbTQL2FBSvpiqTcaj8uZV+ZV8gJJvj4/I0jopw="; 55 }; 56 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 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 - '') 73 (fetchpatch { 74 name = "system-dnnl.patch"; 75 url = "https://aur.archlinux.org/cgit/aur.git/plain/system-dnnl.diff?h=python-onnxruntime&id=0185531906bda3a9aba93bbb0f3dcfeb0ae671ad"; ··· 77 }) 78 ]; 79 80 - # TODO: build server, and move .so's to lib output 81 - outputs = [ "out" "dev" ]; 82 - 83 nativeBuildInputs = [ 84 cmake 85 pkg-config 86 python3 87 ]; 88 89 buildInputs = [ 90 libpng 91 zlib 92 protobuf 93 - nsync 94 - flatbuffers 95 howard-hinnant-date 96 - re2 97 nlohmann_json 98 boost 99 oneDNN 100 ]; 101 102 cmakeDir = "../cmake"; 103 104 cmakeFlags = [ 105 "-Donnxruntime_PREFER_SYSTEM_LIB=ON" 106 "-Donnxruntime_BUILD_SHARED_LIB=ON" 107 "-Donnxruntime_ENABLE_LTO=ON" 108 - "-Donnxruntime_BUILD_UNIT_TESTS=OFF" 109 "-Donnxruntime_USE_PREINSTALLED_EIGEN=ON" 110 "-Donnxruntime_USE_MPI=ON" 111 "-Deigen_SOURCE_PATH=${eigen.src}" 112 "-Donnxruntime_USE_DNNL=YES" 113 ]; 114 115 - enableParallelBuilding = true; 116 117 - meta = { 118 description = "Cross-platform, high performance scoring engine for ML models"; 119 longDescription = '' 120 ONNX Runtime is a performance-focused complete scoring engine ··· 126 compatibility. 127 ''; 128 homepage = "https://github.com/microsoft/onnxruntime"; 129 - changelog = "https://github.com/microsoft/onnxruntime/releases"; 130 # 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 ]; 134 }; 135 }
··· 2 , lib 3 , fetchFromGitHub 4 , fetchpatch 5 + , fetchurl 6 , pkg-config 7 , cmake 8 , python3 9 , libpng 10 , zlib 11 , eigen 12 , protobuf 13 , howard-hinnant-date 14 , nlohmann_json 15 , boost 16 , oneDNN 17 + , gtest 18 }: 19 20 let 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="; 26 }; 27 in 28 stdenv.mkDerivation rec { 29 pname = "onnxruntime"; 30 + version = "1.12.1"; 31 32 src = fetchFromGitHub { 33 owner = "microsoft"; 34 repo = "onnxruntime"; 35 rev = "v${version}"; 36 + sha256 = "sha256-wwllEemiHTp9aJcCd1gsTS4WUVMp5wW+4i/+6DzmAeM="; 37 + fetchSubmodules = true; 38 }; 39 40 patches = [ 41 + # Use dnnl from nixpkgs instead of submodules 42 (fetchpatch { 43 name = "system-dnnl.patch"; 44 url = "https://aur.archlinux.org/cgit/aur.git/plain/system-dnnl.diff?h=python-onnxruntime&id=0185531906bda3a9aba93bbb0f3dcfeb0ae671ad"; ··· 46 }) 47 ]; 48 49 nativeBuildInputs = [ 50 cmake 51 pkg-config 52 python3 53 + gtest 54 ]; 55 56 buildInputs = [ 57 libpng 58 zlib 59 protobuf 60 howard-hinnant-date 61 nlohmann_json 62 boost 63 oneDNN 64 ]; 65 66 + # TODO: build server, and move .so's to lib output 67 + outputs = [ "out" "dev" ]; 68 + 69 + enableParallelBuilding = true; 70 + 71 cmakeDir = "../cmake"; 72 73 cmakeFlags = [ 74 "-Donnxruntime_PREFER_SYSTEM_LIB=ON" 75 "-Donnxruntime_BUILD_SHARED_LIB=ON" 76 "-Donnxruntime_ENABLE_LTO=ON" 77 + "-Donnxruntime_BUILD_UNIT_TESTS=ON" 78 "-Donnxruntime_USE_PREINSTALLED_EIGEN=ON" 79 "-Donnxruntime_USE_MPI=ON" 80 "-Deigen_SOURCE_PATH=${eigen.src}" 81 "-Donnxruntime_USE_DNNL=YES" 82 ]; 83 84 + doCheck = true; 85 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; { 100 description = "Cross-platform, high performance scoring engine for ML models"; 101 longDescription = '' 102 ONNX Runtime is a performance-focused complete scoring engine ··· 108 compatibility. 109 ''; 110 homepage = "https://github.com/microsoft/onnxruntime"; 111 + changelog = "https://github.com/microsoft/onnxruntime/releases/tag/v${version}"; 112 # https://github.com/microsoft/onnxruntime/blob/master/BUILD.md#architectures 113 + platforms = platforms.unix; 114 + license = licenses.mit; 115 + maintainers = with maintainers; [ jonringer puffnfresh ck3d ]; 116 }; 117 }