tensorflow: add OpenGL path to find libcudart

This commit is contained in:
Nikolay Amiantov
2019-10-02 10:32:48 +03:00
parent 4947ddf347
commit 1c429acbff
3 changed files with 31 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
{ stdenv, pkgs, buildBazelPackage, lib, fetchFromGitHub, fetchpatch, symlinkJoin
, addOpenGLRunpath
# Python deps
, buildPythonPackage, isPy3k, pythonOlder, pythonAtLeast, python
# Python libraries
@@ -112,7 +113,7 @@ let
nativeBuildInputs = [
swig which pythonEnv
];
] ++ lib.optional cudaSupport addOpenGLRunpath;
buildInputs = [
jemalloc
@@ -296,6 +297,12 @@ let
bazel-bin/tensorflow/tools/pip_package/build_pip_package --src "$PWD/dist"
cp -Lr "$PWD/dist" "$python"
'';
postFixup = lib.optionalString cudaSupport ''
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
addOpenGLRunpath "$lib"
done
'';
};
meta = with stdenv.lib; {
@@ -347,6 +354,14 @@ in buildPythonPackage {
tensorflow-tensorboard
];
nativeBuildInputs = lib.optional cudaSupport addOpenGLRunpath;
postFixup = lib.optionalString cudaSupport ''
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
addOpenGLRunpath "$lib"
done
'';
# Actual tests are slow and impure.
# TODO try to run them anyway
# TODO better test (files in tensorflow/tools/ci_build/builds/*test)