diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-06-23 08:16:49 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-06-23 08:16:49 +0000 |
commit | 4dc730a187d41f9f2dce4fe2680c32dcecb79b93 (patch) | |
tree | 67673deb1649dc0a40962e70e6da302d7b6c4bf0 /nixpkgs/pkgs/development/libraries/science | |
parent | 633cab0ecb07627706c6b523e219490f019eaab5 (diff) | |
parent | 7e567a3d092b7de69cdf5deaeb8d9526de230916 (diff) | |
download | nixlib-4dc730a187d41f9f2dce4fe2680c32dcecb79b93.tar nixlib-4dc730a187d41f9f2dce4fe2680c32dcecb79b93.tar.gz nixlib-4dc730a187d41f9f2dce4fe2680c32dcecb79b93.tar.bz2 nixlib-4dc730a187d41f9f2dce4fe2680c32dcecb79b93.tar.lz nixlib-4dc730a187d41f9f2dce4fe2680c32dcecb79b93.tar.xz nixlib-4dc730a187d41f9f2dce4fe2680c32dcecb79b93.tar.zst nixlib-4dc730a187d41f9f2dce4fe2680c32dcecb79b93.zip |
Merge commit '7e567a3d092b7de69cdf5deaeb8d9526de230916'
# Conflicts: # nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/science')
6 files changed, 263 insertions, 17 deletions
diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/xcfun/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/xcfun/default.nix new file mode 100644 index 000000000000..7f8ef3dc47d7 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/xcfun/default.nix @@ -0,0 +1,30 @@ +{ stdenv, lib, fetchFromGitHub, cmake, gfortran, python3 } : + +stdenv.mkDerivation rec { + pname = "xcfun"; + version = "2.1.1"; + + src = fetchFromGitHub { + owner = "dftlibs"; + repo = pname; + rev = "v${version}"; + sha256= "1bj70cnhbh6ziy02x988wwl7cbwaq17ld7qwhswqkgnnx8rpgxid"; + }; + + nativeBuildInputs = [ + cmake + gfortran + ]; + + propagatedBuildInputs = [ (python3.withPackages (p: with p; [ pybind11 ])) ]; + + cmakeFlags = [ "-DXCFUN_MAX_ORDER=3" ]; + + meta = with lib; { + description = "A library of exchange-correlation functionals with arbitrary-order derivatives"; + homepage = "https://github.com/dftlibs/xcfun"; + license = licenses.mpl20; + platforms = platforms.linux; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/math/libtorch/bin.nix b/nixpkgs/pkgs/development/libraries/science/math/libtorch/bin.nix index 87b5835aa9ef..efbd071ecd79 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/libtorch/bin.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/libtorch/bin.nix @@ -18,7 +18,7 @@ let # this derivation. However, we should ensure on version bumps # that the CUDA toolkit for `passthru.tests` is still # up-to-date. - version = "1.8.1"; + version = "1.9.0"; device = if cudaSupport then "cuda" else "cpu"; srcs = import ./binary-hashes.nix version; unavailable = throw "libtorch is not available for this platform"; diff --git a/nixpkgs/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix b/nixpkgs/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix index ec4522a75592..6ded62fb87c3 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix @@ -1,14 +1,14 @@ version: { x86_64-darwin-cpu = { url = "https://download.pytorch.org/libtorch/cpu/libtorch-macos-${version}.zip"; - hash = "sha256-FYgnd5zlycjCYnP5bZcjpMdGYXrRERwhFFBYo/SJgzs="; + hash = "sha256-TOJ+iQpqazta46y4IzIbfEGMjz/fz+pRDV8fKqriB6Q="; }; x86_64-linux-cpu = { url = "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${version}%2Bcpu.zip"; - hash = "sha256-xneCcVrY25Whgbs/kPbwdS1Lc0e6RxsDRpA5lHTZigc="; + hash = "sha256-gZMNLCzW3j+eplBqWo6lVvuHS5iRqtMD8NL3MoszsVg="; }; x86_64-linux-cuda = { url = "https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-${version}%2Bcu111.zip"; - hash = "sha256-VW+TW00nD49GBztCyxHE4dTyy81aN/kfYE3hKQOIm50="; + hash = "sha256-dRu4F8k2SAbtghwrPJNyX0u3tsODCbXfi9EqUdf4xYc="; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix b/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix index f464a755f6e4..ccb37d295bff 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, perl, which +{ lib, stdenv, fetchFromGitHub, perl, which # Most packages depending on openblas expect integer width to match # pointer width, but some expect to use 32-bit integers always # (for compatibility with reference BLAS). @@ -116,7 +116,7 @@ let in stdenv.mkDerivation rec { pname = "openblas"; - version = "0.3.13"; + version = "0.3.15"; outputs = [ "out" "dev" ]; @@ -124,19 +124,9 @@ stdenv.mkDerivation rec { owner = "xianyi"; repo = "OpenBLAS"; rev = "v${version}"; - sha256 = "14jxh0v3jfbw4mfjx4mcz4dd51lyq7pqvh9k8dg94539ypzjr2lj"; + sha256 = "1qjr02cqncv20abdp1yzr55n7smhx6h9chqvb0xbp18byynvj87w"; }; - # apply https://github.com/xianyi/OpenBLAS/pull/3060 to fix a crash on arm - # remove this when updating to 0.3.14 or newer - patches = [ - (fetchpatch { - name = "label-get_cpu_ftr-as-volatile.patch"; - url = "https://github.com/xianyi/OpenBLAS/commit/6fe0f1fab9d6a7f46d71d37ebb210fbf56924fbc.diff"; - sha256 = "06gwh73k4sas1ap2fi3jvpifbjkys2vhmnbj4mzrsvj279ljsfdk"; - }) - ]; - inherit blas64; # Some hardening features are disabled due to sporadic failures in diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix b/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix new file mode 100644 index 000000000000..cf2346bad271 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix @@ -0,0 +1,181 @@ +{ stdenv +, bash +, abseil-cpp +, fetchFromGitHub +, fetchFromGitLab +, fetchpatch +, fetchurl +, flatbuffers +, hostPlatform +, lib +, zlib +}: +let + tflite-eigen = fetchFromGitLab { + owner = "libeigen"; + repo = "eigen"; + rev = "3d9051ea84a5089b277c88dac456b3b1576bfa7f"; + sha256 = "1y3f2jvimb5i904f4n37h23cv2pkdlbz8656s0kga1y7c0p50wif"; + }; + + gemmlowp-src = fetchFromGitHub { + owner = "google"; + repo = "gemmlowp"; + rev = "fda83bdc38b118cc6b56753bd540caa49e570745"; + sha256 = "1sbp8kmr2azwlvfbzryy1frxi99jhsh1nc93bdbxdf8zdgpv0kxl"; + }; + + neon-2-sse-src = fetchFromGitHub { + owner = "intel"; + repo = "ARM_NEON_2_x86_SSE"; + rev = "1200fe90bb174a6224a525ee60148671a786a71f"; + sha256 = "0fhxch711ck809dpq1myxz63jiiwfcnxvj45ww0kg8s0pqpn5kv6"; + }; + + farmhash-src = fetchFromGitHub { + owner = "google"; + repo = "farmhash"; + rev = "816a4ae622e964763ca0862d9dbd19324a1eaf45"; + sha256 = "1mqxsljq476n1hb8ilkrpb39yz3ip2hnc7rhzszz4sri8ma7qzp6"; + }; + + fft2d-src = fetchurl { + url = "http://www.kurims.kyoto-u.ac.jp/~ooura/fft2d.tgz"; + sha256 = "ada7e99087c4ed477bfdf11413f2ba8db8a840ba9bbf8ac94f4f3972e2a7cec9"; + }; + + fp16-src = fetchFromGitHub { + owner = "Maratyszcza"; + repo = "FP16"; + rev = "4dfe081cf6bcd15db339cf2680b9281b8451eeb3"; + sha256 = "06a8dfl3a29r93nxpp6hpywsajz5d555n3sqd3i6krybb6swnvh7"; + }; + + ruy-src = fetchFromGitHub { + owner = "google"; + repo = "ruy"; + rev = "23633b37099b614a2f836ef012cafc8087fdb98c"; + sha256 = "14k9hz6ss8qy8nsajk6lrq25f6qxrldxky31ijw0dpqnfnnswrx4"; + }; + + cpuinfo-src = fetchFromGitHub { + owner = "pytorch"; + repo = "cpuinfo"; + rev = "5916273f79a21551890fd3d56fc5375a78d1598d"; + sha256 = "0q6760xdxsg18acdv8vq3yrq7ksr7wsm8zbyan01zf2khnb6fw4x"; + }; +in +stdenv.mkDerivation rec { + pname = "tensorflow-lite"; + version = "2.5.0"; + + src = fetchFromGitHub { + owner = "tensorflow"; + repo = "tensorflow"; + rev = "v${version}"; + sha256 = "1jdw2i1rq06zqd6aabh7bbm0avsg4pygnfmd7gviv0blhih9054l"; + }; + + patches = [ + # TODO: remove on the next version bump + (fetchpatch { + name = "include-schema-conversion-utils-source.patch"; + url = "https://github.com/tensorflow/tensorflow/commit/f3c4f4733692150fd6174f2cd16438cfaba2e5ab.patch"; + sha256 = "0zx4hbz679kn79f30159rl1mq74dg45cvaawii0cyv48z472yy4k"; + }) + # TODO: remove on the next version bump + (fetchpatch { + name = "cxxstandard-var.patch"; + url = "https://github.com/tensorflow/tensorflow/commit/9b128ae4200e10b4752f903492d1e7d11957ed5c.patch"; + sha256 = "1q0izdwdji5fbyqll6k4dmkzfykyvvz5cvc6hysdj285nkn2wy6h"; + }) + ]; + + buildInputs = [ zlib flatbuffers ]; + + dontConfigure = true; + + postPatch = '' + substituteInPlace ./tensorflow/lite/tools/make/Makefile \ + --replace /bin/bash ${bash}/bin/bash \ + --replace /bin/sh ${bash}/bin/sh + ''; + + makefile = "tensorflow/lite/tools/make/Makefile"; + + preBuild = + let + includes = + lib.concatMapStringsSep + " " + (subdir: "-I $PWD/tensorflow/lite/tools/make/downloads/${subdir}") + [ + "neon_2_sse" + "gemmlowp" + "absl" + "fp16/include" + "farmhash/src" + "ruy" + "cpuinfo" + "cpuinfo/src" + "cpuinfo/include" + "cpuinfo/deps/clog/include" + "eigen" + ]; + in + '' + # enter the vendoring lair of doom + + prefix="$PWD/tensorflow/lite/tools/make/downloads" + + mkdir -p "$prefix" + + tar xzf ${fft2d-src} -C "$prefix" + + ln -s ${ruy-src} "$prefix/ruy" + ln -s ${gemmlowp-src} "$prefix/gemmlowp" + ln -s ${neon-2-sse-src} "$prefix/neon_2_sse" + ln -s ${farmhash-src} "$prefix/farmhash" + ln -s ${cpuinfo-src} "$prefix/cpuinfo" + ln -s ${fp16-src} "$prefix/fp16" + ln -s ${tflite-eigen} "$prefix/eigen" + + # tensorflow lite is using the *source* of flatbuffers + ln -s ${flatbuffers.src} "$prefix/flatbuffers" + + # tensorflow lite expects to compile abseil into `libtensorflow-lite.a` + ln -s ${abseil-cpp.src} "$prefix/absl" + + # set CXXSTANDARD=c++17 here because abseil-cpp in nixpkgs is set as + # such and would be used in dependents like libedgetpu + buildFlagsArray+=( + INCLUDES="-I $PWD ${includes}" + CXXSTANDARD="-std=c++17" + TARGET_TOOLCHAIN_PREFIX="" + -j$NIX_BUILD_CORES + all) + ''; + + installPhase = '' + mkdir "$out" + + # copy the static lib and binaries into the output dir + cp -r ./tensorflow/lite/tools/make/gen/linux_${hostPlatform.uname.processor}/{bin,lib} "$out" + + find ./tensorflow/lite -type f -name '*.h' | while read f; do + path="$out/include/''${f/.\//}" + install -D "$f" "$path" + + # remove executable bit from headers + chmod -x "$path" + done + ''; + + meta = with lib; { + description = "An open source deep learning framework for on-device inference."; + homepage = "https://www.tensorflow.org/lite"; + license = licenses.asl20; + maintainers = with maintainers; [ cpcloud ]; + platforms = [ "x86_64-linux" "aarch64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/eigen_include_dir.patch b/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/eigen_include_dir.patch new file mode 100644 index 000000000000..6fa3c703efa9 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/eigen_include_dir.patch @@ -0,0 +1,45 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 28103856e..a36909c0e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -449,13 +449,6 @@ install(FILES + DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel + ) + +-if(EIGEN_BUILD_PKGCONFIG) +- configure_file(eigen3.pc.in eigen3.pc @ONLY) +- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc +- DESTINATION ${PKGCONFIG_INSTALL_DIR} +- ) +-endif() +- + install(DIRECTORY Eigen DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) + + add_subdirectory(doc EXCLUDE_FROM_ALL) +@@ -570,8 +563,15 @@ set ( EIGEN_VERSION_MAJOR ${EIGEN_WORLD_VERSION} ) + set ( EIGEN_VERSION_MINOR ${EIGEN_MAJOR_VERSION} ) + set ( EIGEN_VERSION_PATCH ${EIGEN_MINOR_VERSION} ) + set ( EIGEN_DEFINITIONS "") +-set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" ) + set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} ) ++GNUInstallDirs_get_absolute_install_dir(EIGEN_INCLUDE_DIR INCLUDE_INSTALL_DIR) ++ ++if(EIGEN_BUILD_PKGCONFIG) ++ configure_file(eigen3.pc.in eigen3.pc @ONLY) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc ++ DESTINATION ${PKGCONFIG_INSTALL_DIR} ++ ) ++endif() + + # Interface libraries require at least CMake 3.0 + if (NOT CMAKE_VERSION VERSION_LESS 3.0) +diff --git a/eigen3.pc.in b/eigen3.pc.in +index 3368a3aa1..d6778bf06 100644 +--- a/eigen3.pc.in ++++ b/eigen3.pc.in +@@ -6,4 +6,4 @@ Description: A C++ template library for linear algebra: vectors, matrices, and r + Requires: + Version: @EIGEN_VERSION_NUMBER@ + Libs: +-Cflags: -I${prefix}/@INCLUDE_INSTALL_DIR@ ++Cflags: -I@EIGEN_INCLUDE_DIR@ |