From e0cf582493ad249acbf69267e1a2e35f08e37f47 Mon Sep 17 00:00:00 2001 From: Stefan Matting Date: Sun, 13 May 2018 14:23:12 +0200 Subject: [PATCH] Theano: fix broken compiler; Add nvidia_x11 as dependency when cudaSupport --- pkgs/development/python-modules/Theano/default.nix | 9 ++++++++- pkgs/top-level/python-packages.nix | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/Theano/default.nix b/pkgs/development/python-modules/Theano/default.nix index 03dc825218e2..9eb04782d6f8 100644 --- a/pkgs/development/python-modules/Theano/default.nix +++ b/pkgs/development/python-modules/Theano/default.nix @@ -15,17 +15,24 @@ , libgpuarray , cudaSupport ? false, cudatoolkit , cudnnSupport ? false, cudnn +, nvidia_x11 }: assert cudnnSupport -> cudaSupport; +assert cudaSupport -> nvidia_x11 != null + && cudatoolkit != null + && cudnn != null; + let extraFlags = lib.optionals cudaSupport [ "-I ${cudatoolkit}/include" "-L ${cudatoolkit}/lib" ] - ++ lib.optionals cudnnSupport [ "-I ${cudnn}/include" "-L ${cudnn}/lib" ]; + ++ lib.optionals cudnnSupport [ "-I ${cudnn}/include" "-L ${cudnn}/lib" ] + ++ lib.optionals cudaSupport [ "-I ${libgpuarray}/include" "-L ${libgpuarray}/lib" ]; gcc_ = writeScriptBin "g++" '' #!${stdenv.shell} + export NIX_CC_WRAPPER_${stdenv.cc.infixSalt}_TARGET_HOST=1 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${toString extraFlags}" exec ${gcc}/bin/g++ "$@" ''; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ce520ca71193..a5a24e42865a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -12986,6 +12986,7 @@ in { Theano = callPackage ../development/python-modules/Theano rec { cudaSupport = pkgs.config.cudaSupport or false; cudnnSupport = cudaSupport; + inherit (pkgs.linuxPackages) nvidia_x11; }; TheanoWithoutCuda = self.Theano.override {