pythonPackages.tensorflow: repair cuda-dependent variant

merge the outputs of cudatoolkit locally in the tensorflow
derivation, using symlinkJoin

Fixes #29798
This commit is contained in:
Jean-Philippe Bernardy 2017-10-03 15:50:39 +02:00 committed by Nikolay Amiantov
parent 79ae9be220
commit 244f34785e

View File

@ -1,4 +1,5 @@
{ stdenv
, symlinkJoin
, lib
, fetchurl
, buildPythonPackage
@ -35,6 +36,13 @@ buildPythonPackage rec {
format = "wheel";
disabled = ! (isPy35 || isPy36 || isPy27);
# cudatoolkit is split (see https://github.com/NixOS/nixpkgs/commit/bb1c9b027d343f2ce263496582d6b56af8af92e6)
# However this means that libcusolver is not loadable by tensor flow. So we undo the split here.
cudatoolkit_joined = symlinkJoin {
name = "unsplit_cudatoolkit";
paths = [ cudatoolkit.out
cudatoolkit.lib ];};
src = let
tfurl = sys: proc: pykind:
let
@ -112,7 +120,7 @@ buildPythonPackage rec {
propagatedBuildInputs =
[ numpy six protobuf mock backports_weakref ]
++ lib.optional (!isPy36) tensorflow-tensorboard
++ lib.optionals cudaSupport [ cudatoolkit cudnn stdenv.cc ];
++ lib.optionals cudaSupport [ cudatoolkit_joined cudnn stdenv.cc ];
# tensorflow-gpu depends on tensorflow_tensorboard, which cannot be
# built at the moment (some of its dependencies do not build
@ -126,7 +134,7 @@ buildPythonPackage rec {
postFixup = let
rpath = stdenv.lib.makeLibraryPath
(if cudaSupport then
[ stdenv.cc.cc.lib zlib cudatoolkit cudnn
[ stdenv.cc.cc.lib zlib cudatoolkit_joined cudnn
linuxPackages.nvidia_x11 ]
else
[ stdenv.cc.cc.lib zlib ]