Merge pull request #147509 from tpwrules/fix-tf-gpu

python3Packages.tensorflowWithCuda: fix build
This commit is contained in:
Dmitry Kalinkin 2021-11-27 19:26:01 -05:00 committed by GitHub
commit b9d33a0c16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 10 deletions

View File

@ -22,6 +22,7 @@
, cudaSupport ? false , cudaSupport ? false
, cudatoolkit , cudatoolkit
, cudnn , cudnn
, patchelfUnstable
, zlib , zlib
, python , python
, keras-applications , keras-applications
@ -78,7 +79,8 @@ in buildPythonPackage {
] ++ lib.optional (!isPy3k) mock ] ++ lib.optional (!isPy3k) mock
++ lib.optionals (pythonOlder "3.4") [ backports_weakref ]; ++ lib.optionals (pythonOlder "3.4") [ backports_weakref ];
nativeBuildInputs = [ wheel ] ++ lib.optional cudaSupport addOpenGLRunpath; # remove patchelfUnstable once patchelf 0.14 with https://github.com/NixOS/patchelf/pull/256 becomes the default
nativeBuildInputs = [ wheel ] ++ lib.optional cudaSupport [ addOpenGLRunpath patchelfUnstable ];
preConfigure = '' preConfigure = ''
unset SOURCE_DATE_EPOCH unset SOURCE_DATE_EPOCH

View File

@ -1,5 +1,5 @@
{ stdenv, bazel_3, buildBazelPackage, isPy3k, lib, fetchFromGitHub, symlinkJoin { stdenv, bazel_3, buildBazelPackage, isPy3k, lib, fetchFromGitHub, symlinkJoin
, addOpenGLRunpath, fetchpatch , addOpenGLRunpath, fetchpatch, patchelfUnstable
# Python deps # Python deps
, buildPythonPackage, pythonOlder, python , buildPythonPackage, pythonOlder, python
# Python libraries # Python libraries
@ -465,7 +465,8 @@ in buildPythonPackage {
tensorflow-tensorboard tensorflow-tensorboard
]; ];
nativeBuildInputs = lib.optional cudaSupport addOpenGLRunpath; # remove patchelfUnstable once patchelf 0.14 with https://github.com/NixOS/patchelf/pull/256 becomes the default
nativeBuildInputs = lib.optional cudaSupport [ addOpenGLRunpath patchelfUnstable ];
postFixup = lib.optionalString cudaSupport '' postFixup = lib.optionalString cudaSupport ''
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do

View File

@ -2,13 +2,13 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "patchelf-${version}"; name = "patchelf-${version}";
version = "2020-07-11"; version = "2021-11-16";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "NixOS"; owner = "NixOS";
repo = "patchelf"; repo = "patchelf";
rev = "126372b636733b160e693c9913e871f6755c02e"; rev = "a174cf3006baf31e0e9eaa62bc9adead93af63f7";
sha256 = "07cn40ypys5pyc3jfgxvqj7qk5v6m2rr5brnpmxdsl1557ryx226"; sha256 = "sha256-cKZ4DE70R5XiIqfnIVAl2s7a1bJxaaPpuCmxs3pxFRU=";
}; };
# Drop test that fails on musl (?) # Drop test that fails on musl (?)

View File

@ -9229,15 +9229,15 @@ in {
tensorflow-bin = callPackage ../development/python-modules/tensorflow/bin.nix { tensorflow-bin = callPackage ../development/python-modules/tensorflow/bin.nix {
cudaSupport = pkgs.config.cudaSupport or false; cudaSupport = pkgs.config.cudaSupport or false;
cudatoolkit = pkgs.cudatoolkit_11_0; cudatoolkit = pkgs.cudatoolkit_11_2;
cudnn = pkgs.cudnn_cudatoolkit_11_0; cudnn = pkgs.cudnn_cudatoolkit_11_2;
}; };
tensorflow-build = callPackage ../development/python-modules/tensorflow { tensorflow-build = callPackage ../development/python-modules/tensorflow {
inherit (pkgs.darwin) cctools; inherit (pkgs.darwin) cctools;
cudaSupport = pkgs.config.cudaSupport or false; cudaSupport = pkgs.config.cudaSupport or false;
cudatoolkit = pkgs.cudatoolkit_11_0; cudatoolkit = pkgs.cudatoolkit_11_2;
cudnn = pkgs.cudnn_cudatoolkit_11_0; cudnn = pkgs.cudnn_cudatoolkit_11_2;
nccl = pkgs.nccl_cudatoolkit_11; nccl = pkgs.nccl_cudatoolkit_11;
inherit (pkgs.darwin.apple_sdk.frameworks) Foundation Security; inherit (pkgs.darwin.apple_sdk.frameworks) Foundation Security;
flatbuffers-core = pkgs.flatbuffers; flatbuffers-core = pkgs.flatbuffers;