diff options
author | Nikolay Amiantov <ab@fmap.me> | 2019-07-13 22:37:01 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2019-07-31 13:28:44 +0300 |
commit | 170dd558dffd2bb134e3001a93631fc71fe13f3c (patch) | |
tree | f0ae5648c06fa9445d7451966d65cb655c1e58ce | |
parent | 2e46ae0daa741031dd96d5bb089e390676878209 (diff) | |
download | nixlib-170dd558dffd2bb134e3001a93631fc71fe13f3c.tar nixlib-170dd558dffd2bb134e3001a93631fc71fe13f3c.tar.gz nixlib-170dd558dffd2bb134e3001a93631fc71fe13f3c.tar.bz2 nixlib-170dd558dffd2bb134e3001a93631fc71fe13f3c.tar.lz nixlib-170dd558dffd2bb134e3001a93631fc71fe13f3c.tar.xz nixlib-170dd558dffd2bb134e3001a93631fc71fe13f3c.tar.zst nixlib-170dd558dffd2bb134e3001a93631fc71fe13f3c.zip |
python.pkgs.tensorflow: cleanup binary build
-rw-r--r-- | pkgs/development/python-modules/tensorflow/bin.nix | 25 | ||||
-rw-r--r-- | pkgs/development/python-modules/tensorflow/binary-hashes.nix (renamed from pkgs/development/python-modules/tensorflow/tf1.14.0-hashes.nix) | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | pkgs/development/python-modules/tensorflow/prefetcher.sh | 5 |
3 files changed, 19 insertions, 12 deletions
diff --git a/pkgs/development/python-modules/tensorflow/bin.nix b/pkgs/development/python-modules/tensorflow/bin.nix index 817ba09dc9d2..a562ba8f2fad 100644 --- a/pkgs/development/python-modules/tensorflow/bin.nix +++ b/pkgs/development/python-modules/tensorflow/bin.nix @@ -35,15 +35,19 @@ assert cudaSupport -> cudatoolkit != null && cudnn != null && nvidia_x11 != null; + +# unsupported combination +assert ! (stdenv.isDarwin && cudaSupport); + let - cudatoolkit_joined = symlinkJoin { - name = "unsplit_cudatoolkit"; - paths = [ cudatoolkit.out - cudatoolkit.lib ];}; + packages = import ./binary-hashes.nix; + + variant = if cudaSupport then "-gpu" else ""; + pname = "tensorflow${variant}"; in buildPythonPackage rec { - pname = "tensorflow"; - version = "1.14.0"; + inherit pname; + inherit (packages) version; format = "wheel"; src = let @@ -52,8 +56,7 @@ in buildPythonPackage rec { platform = if stdenv.isDarwin then "mac" else "linux"; unit = if cudaSupport then "gpu" else "cpu"; key = "${platform}_py_${pyver}_${unit}"; - dls = import (./. + "/tf${version}-hashes.nix"); - in fetchurl dls.${key}; + in fetchurl packages.${key}; propagatedBuildInputs = [ protobuf @@ -86,9 +89,9 @@ in buildPythonPackage rec { # patchelf --shrink-rpath will remove the cuda libraries. postFixup = let rpath = stdenv.lib.makeLibraryPath - ([ stdenv.cc.cc.lib zlib ] ++ lib.optionals cudaSupport [ cudatoolkit_joined cudnn nvidia_x11 ]); + ([ stdenv.cc.cc.lib zlib ] ++ lib.optionals cudaSupport [ cudatoolkit.out cudatoolkit.lib cudnn nvidia_x11 ]); in - lib.optionalString (stdenv.isLinux) '' + lib.optionalString stdenv.isLinux '' rrPath="$out/${python.sitePackages}/tensorflow/:$out/${python.sitePackages}/tensorflow/contrib/tensor_forest/:${rpath}" internalLibPath="$out/${python.sitePackages}/tensorflow/python/_pywrap_tensorflow_internal.so" find $out \( -name '*.so' -or -name '*.so.*' \) -exec patchelf --set-rpath "$rrPath" {} \; @@ -100,7 +103,7 @@ in buildPythonPackage rec { homepage = http://tensorflow.org; license = licenses.asl20; maintainers = with maintainers; [ jyp abbradar ]; - platforms = with platforms; linux ++ lib.optionals (!cudaSupport) darwin; + platforms = [ "x86_64-linux" "x86_64-darwin" ]; # Python 2.7 build uses different string encoding. # See https://github.com/NixOS/nixpkgs/pull/37044#issuecomment-373452253 broken = stdenv.isDarwin && !isPy3k; diff --git a/pkgs/development/python-modules/tensorflow/tf1.14.0-hashes.nix b/pkgs/development/python-modules/tensorflow/binary-hashes.nix index f6b367aea383..fa4809dc3f19 100644 --- a/pkgs/development/python-modules/tensorflow/tf1.14.0-hashes.nix +++ b/pkgs/development/python-modules/tensorflow/binary-hashes.nix @@ -1,4 +1,5 @@ { +version = "1.14.0"; linux_py_27_cpu = { url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp27-none-linux_x86_64.whl"; sha256 = "0yywdrfk97dh1bxhibspg0raz70fx9lcczj6xlimqy4xb60clx7k"; diff --git a/pkgs/development/python-modules/tensorflow/prefetcher.sh b/pkgs/development/python-modules/tensorflow/prefetcher.sh index 3059340d127d..d590fb0f1732 100644..100755 --- a/pkgs/development/python-modules/tensorflow/prefetcher.sh +++ b/pkgs/development/python-modules/tensorflow/prefetcher.sh @@ -1,7 +1,10 @@ +#!/usr/bin/env bash + version=1.14.0 -hashfile=tf${version}-hashes.nix +hashfile=binary-hashes.nix rm -f $hashfile echo "{" >> $hashfile +echo "version = \"$version\";" >> $hashfile for sys in "linux" "mac"; do for tfpref in "cpu/tensorflow" "gpu/tensorflow_gpu"; do for pykind in "py2-none-any" "py3-none-any" "cp27-none-linux_x86_64" "cp35-cp35m-linux_x86_64" "cp36-cp36m-linux_x86_64" "cp37-cp37m-linux_x86_64"; do |