From 11bf0ac25ba3a87f574f4b896646ebb2581edadf Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Tue, 21 Sep 2021 01:05:02 -0700 Subject: [PATCH 1/2] pythonPackages.libgpuarray: fix opengl runpath nvidia_x11 libs should be picked up from /run/opengl-driver/lib at runtime --- .../python-modules/libgpuarray/default.nix | 18 +++++++++++------- pkgs/top-level/python-packages.nix | 1 - 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/libgpuarray/default.nix b/pkgs/development/python-modules/libgpuarray/default.nix index d061356490cb..2be115ae3658 100644 --- a/pkgs/development/python-modules/libgpuarray/default.nix +++ b/pkgs/development/python-modules/libgpuarray/default.nix @@ -1,5 +1,6 @@ { stdenv , lib +, addOpenGLRunpath , buildPythonPackage , fetchFromGitHub , cmake @@ -8,13 +9,10 @@ , six , nose , Mako -, cudaSupport ? false, cudatoolkit , nvidia_x11 +, cudaSupport ? false, cudatoolkit , openclSupport ? true, ocl-icd, clblas }: -assert cudaSupport -> nvidia_x11 != null - && cudatoolkit != null; - buildPythonPackage rec { pname = "libgpuarray"; version = "0.7.6"; @@ -32,8 +30,7 @@ buildPythonPackage rec { configurePhase = "cmakeConfigurePhase"; libraryPath = lib.makeLibraryPath ( - [] - ++ lib.optionals cudaSupport [ cudatoolkit.lib cudatoolkit.out nvidia_x11 ] + lib.optionals cudaSupport [ cudatoolkit.lib cudatoolkit.out ] ++ lib.optionals openclSupport ([ clblas ] ++ lib.optional (!stdenv.isDarwin) ocl-icd) ); @@ -55,6 +52,8 @@ buildPythonPackage rec { } fixRunPath $out/lib/libgpuarray.so + '' + lib.optionalString cudaSupport '' + addOpenGLRunpath $out/lib/libgpuarray.so ''; propagatedBuildInputs = [ @@ -63,7 +62,12 @@ buildPythonPackage rec { Mako ]; - nativeBuildInputs = [ cmake ]; + nativeBuildInputs = [ + cmake + ] ++ lib.optionals cudaSupport [ + addOpenGLRunpath + ]; + buildInputs = [ cython diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 05693a9a4f48..43b3bff7906c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4138,7 +4138,6 @@ in { libgpuarray = callPackage ../development/python-modules/libgpuarray { clblas = pkgs.clblas.override { boost = self.boost; }; cudaSupport = pkgs.config.cudaSupport or false; - inherit (pkgs.linuxPackages) nvidia_x11; }; libiio = (toPythonModule (pkgs.libiio.override { inherit python; })).python; From 63391899a35d732e85eb90efb8cf0c59d12f1c11 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Tue, 21 Sep 2021 01:07:45 -0700 Subject: [PATCH 2/2] pythonPackages.Theano: fix cuda package * add missing setuptools for cuda * remove unused nvidia_x11 --- .../python-modules/Theano/default.nix | 16 ++++++++++------ pkgs/top-level/python-packages.nix | 1 - 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/Theano/default.nix b/pkgs/development/python-modules/Theano/default.nix index e279100e9cc6..351f8dc9b711 100644 --- a/pkgs/development/python-modules/Theano/default.nix +++ b/pkgs/development/python-modules/Theano/default.nix @@ -8,19 +8,15 @@ , nose , numpy , scipy +, setuptools , six , libgpuarray , cudaSupport ? false, cudatoolkit , cudnnSupport ? false, cudnn -, nvidia_x11 }: assert cudnnSupport -> cudaSupport; -assert cudaSupport -> nvidia_x11 != null - && cudatoolkit != null - && cudnn != null; - let wrapped = command: buildTop: buildInputs: runCommandCC "${command}-wrapped" { inherit buildInputs; } '' @@ -81,7 +77,15 @@ in buildPythonPackage rec { # keep Nose around since running the tests by hand is possible from Python or bash checkInputs = [ nose ]; - propagatedBuildInputs = [ numpy numpy.blas scipy six libgpuarray_ ]; + # setuptools needed for cuda support + propagatedBuildInputs = [ + libgpuarray_ + numpy + numpy.blas + scipy + setuptools + six + ]; pythonImportsCheck = [ "theano" ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 43b3bff7906c..76bdf2c628bd 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8881,7 +8881,6 @@ in { Theano = callPackage ../development/python-modules/Theano rec { cudaSupport = pkgs.config.cudaSupport or false; cudnnSupport = cudaSupport; - inherit (pkgs.linuxPackages) nvidia_x11; }; TheanoWithCuda = self.Theano.override {