Merge pull request #103292 from mikesperber/libtensorflow-2
libtensorflow_2: add TensorFlow 2 as a library
This commit is contained in:
commit
9de67acaa9
|
@ -6,25 +6,20 @@
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
let
|
let
|
||||||
unavailable = throw "libtensorflow is not available for this platform!";
|
broken = !stdenv.isLinux && !stdenv.isDarwin;
|
||||||
|
|
||||||
tfType = if cudaSupport then "gpu" else "cpu";
|
tfType = if cudaSupport then "gpu" else "cpu";
|
||||||
|
|
||||||
system =
|
system =
|
||||||
if stdenv.isLinux then "linux"
|
if stdenv.isLinux then "linux"
|
||||||
else if stdenv.isDarwin then "darwin"
|
else "darwin";
|
||||||
else unavailable;
|
|
||||||
|
|
||||||
platform =
|
platform = "x86_64";
|
||||||
if stdenv.isx86_64 then "x86_64"
|
|
||||||
else unavailable;
|
|
||||||
|
|
||||||
rpath = makeLibraryPath ([stdenv.cc.libc stdenv.cc.cc.lib] ++
|
rpath = makeLibraryPath ([stdenv.cc.libc stdenv.cc.cc.lib]
|
||||||
optionals cudaSupport [ cudatoolkit.out cudatoolkit.lib cudnn nvidia_x11 ]);
|
++ optionals cudaSupport [ cudatoolkit.out cudatoolkit.lib cudnn nvidia_x11 ]);
|
||||||
|
|
||||||
packages = import ./binary-hashes.nix;
|
packages = import ./binary-hashes.nix;
|
||||||
packageName = "${tfType}-${system}-${platform}";
|
|
||||||
url = packages.${packageName} or unavailable;
|
|
||||||
|
|
||||||
patchLibs =
|
patchLibs =
|
||||||
if stdenv.isDarwin
|
if stdenv.isDarwin
|
||||||
|
@ -44,7 +39,7 @@ in stdenv.mkDerivation rec {
|
||||||
pname = "libtensorflow";
|
pname = "libtensorflow";
|
||||||
inherit (packages) version;
|
inherit (packages) version;
|
||||||
|
|
||||||
src = fetchurl url;
|
src = fetchurl packages."${tfType}-${system}-${platform}";
|
||||||
|
|
||||||
nativeBuildInputs = optional cudaSupport addOpenGLRunpath;
|
nativeBuildInputs = optional cudaSupport addOpenGLRunpath;
|
||||||
|
|
||||||
|
@ -72,6 +67,5 @@ in stdenv.mkDerivation rec {
|
||||||
homepage = "https://www.tensorflow.org/install/lang_c";
|
homepage = "https://www.tensorflow.org/install/lang_c";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
||||||
maintainers = with maintainers; [ basvandijk ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
{
|
{
|
||||||
version = "1.14.0";
|
version = "2.4.0";
|
||||||
cpu-linux-x86_64 = {
|
"cpu-linux-x86_64" = {
|
||||||
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.14.0.tar.gz";
|
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.4.0.tar.gz";
|
||||||
sha256 = "04bi3ijq4sbb8c5vk964zlv0j9mrjnzzxd9q9knq3h273nc1a36k";
|
sha256 = "022p5jjwmb8rhyyis3cpk2lw45apl2vz49m2rgxmd75h783x1gjk";
|
||||||
};
|
};
|
||||||
gpu-linux-x86_64 = {
|
"gpu-linux-x86_64" = {
|
||||||
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-1.14.0.tar.gz";
|
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.4.0.tar.gz";
|
||||||
sha256 = "1ffnpyj9jjgwxpjfiyjvq4dm3n6nwiksim5jld9zw7fdswh215x6";
|
sha256 = "1fclvbrn3fs8qmhmh3lzni7s7wl1w30a071b4gzh9ifnxdhip6lq";
|
||||||
};
|
};
|
||||||
cpu-darwin-x86_64 = {
|
"cpu-darwin-x86_64" = {
|
||||||
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.14.0.tar.gz";
|
url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.4.0.tar.gz";
|
||||||
sha256 = "0zsd5ils1a17j6jzh0c7q1z56fw46gkzybbnms7h2rgg8al0rh92";
|
sha256 = "09x096nslg04c8sr7bd5v68a5gfinc0f1h36lbzn8bahs8b1agi3";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
version=1.14.0
|
# ./prefetcher.sh 2.4.0 binary-hashes.nix
|
||||||
hashfile=binary-hashes.nix
|
|
||||||
|
version="$1"
|
||||||
|
hashfile="$2"
|
||||||
rm -f $hashfile
|
rm -f $hashfile
|
||||||
echo "{" >> $hashfile
|
echo "{" >> $hashfile
|
||||||
echo "version = \"$version\";" >> $hashfile
|
echo "version = \"$version\";" >> $hashfile
|
||||||
|
|
Loading…
Reference in New Issue