nixpkgs/pkgs/development/libraries/onnxruntime/default.nix

75 lines
2.3 KiB
Nix
Raw Normal View History

2019-08-27 03:46:04 +00:00
{ stdenv, fetchFromGitHub, glibcLocales
2020-01-13 21:18:03 +00:00
, cmake, python3, libpng, zlib
2019-08-27 03:46:04 +00:00
}:
stdenv.mkDerivation rec {
pname = "onnxruntime";
2020-03-27 19:58:33 +00:00
version = "1.2.0";
2019-08-27 03:46:04 +00:00
src = fetchFromGitHub {
owner = "microsoft";
repo = "onnxruntime";
rev = "v${version}";
2020-03-27 19:58:33 +00:00
sha256 = "1alhb7nvlxrr9yf757gs4hkzksbk3mxyv5zcmmpl82ibl65vh55k";
2019-08-27 03:46:04 +00:00
# TODO: use nix-versions of grpc, onnx, eigen, googletest, etc.
# submodules increase src size and compile times significantly
# not currently feasible due to how integrated cmake build is with git
fetchSubmodules = true;
};
# TODO: build server, and move .so's to lib output
outputs = [ "out" "dev" ];
nativeBuildInputs = [
cmake
python3 # for shared-lib or server
];
2020-01-13 21:18:03 +00:00
buildInputs = [
# technically optional, but highly recommended
libpng
zlib
];
2019-08-27 03:46:04 +00:00
cmakeDir = "../cmake";
cmakeFlags = [
"-Donnxruntime_USE_OPENMP=ON"
"-Donnxruntime_BUILD_SHARED_LIB=ON"
2020-01-13 21:18:03 +00:00
# flip back to ON next release
"-Donnxruntime_ENABLE_LTO=OFF" # https://github.com/microsoft/onnxruntime/issues/2828
2019-08-27 03:46:04 +00:00
];
# ContribOpTest.StringNormalizerTest sets locale to en_US.UTF-8"
preCheck = stdenv.lib.optionalString stdenv.isLinux ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'';
doCheck = true;
postInstall = ''
rm -r $out/bin # ctest runner
'';
2019-10-30 18:25:38 +00:00
enableParallelBuilding = true;
2019-08-27 03:46:04 +00:00
meta = with stdenv.lib; {
description = "Cross-platform, high performance scoring engine for ML models";
longDescription = ''
ONNX Runtime is a performance-focused complete scoring engine
for Open Neural Network Exchange (ONNX) models, with an open
extensible architecture to continually address the latest developments
in AI and Deep Learning. ONNX Runtime stays up to date with the ONNX
standard with complete implementation of all ONNX operators, and
supports all ONNX releases (1.2+) with both future and backwards
compatibility.
'';
homepage = "https://github.com/microsoft/onnxruntime";
2019-10-30 18:25:38 +00:00
changelog = "https://github.com/microsoft/onnxruntime/releases";
# https://github.com/microsoft/onnxruntime/blob/master/BUILD.md#architectures
platforms = platforms.unix;
2019-08-27 03:46:04 +00:00
license = licenses.mit;
maintainers = with maintainers; [ jonringer ];
};
}