diff --git a/pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nix b/pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nix new file mode 100644 index 00000000000..920b77b223f --- /dev/null +++ b/pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nix @@ -0,0 +1,46 @@ +{ stdenv +, requireFile +, cudatoolkit +}: + +stdenv.mkDerivation rec { + version = "5.0"; + cudatoolkit_version = "7.5"; + + name = "cudatoolkit-${cudatoolkit_version}-cudnn-${version}"; + + src = requireFile rec { + name = "cudnn-${cudatoolkit_version}-linux-x64-v${version}-ga.tgz"; + message = '' + This nix expression requires that ${name} is already part of the store. + Register yourself to NVIDIA Accelerated Computing Developer Program, retrieve the cuDNN library + at https://developer.nvidia.com/cudnn, and run the following command in the download directory: + nix-prefetch-url file://${name} + ''; + sha256 = "c4739a00608c3b66a004a74fc8e721848f9112c5cb15f730c1be4964b3a23b3a"; + }; + + phases = "unpackPhase installPhase fixupPhase"; + + installPhase = '' + function fixRunPath { + p=$(patchelf --print-rpath $1) + patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}" $1 + } + fixRunPath lib64/libcudnn.so + + mkdir -p $out + cp -a include $out/include + cp -a lib64 $out/lib64 + ''; + + propagatedBuildInputs = [ + cudatoolkit + ]; + + meta = { + description = "NVIDIA CUDA Deep Neural Network library (cuDNN)"; + homepage = "https://developer.nvidia.com/cudnn"; + license = stdenv.lib.licenses.unfree; + }; +} diff --git a/pkgs/development/python-modules/theano/cuda/default.nix b/pkgs/development/python-modules/theano/cuda/default.nix new file mode 100644 index 00000000000..bf49d391861 --- /dev/null +++ b/pkgs/development/python-modules/theano/cuda/default.nix @@ -0,0 +1,62 @@ +{ buildPythonPackage +, fetchFromGitHub +, blas +, numpy +, six +, scipy +, nose +, nose-parameterized +, pydot_ng +, sphinx +, pygments +, libgpuarray +, python +, pycuda +, cudatoolkit +, cudnn +, stdenv +}: + +buildPythonPackage rec { + name = "Theano-cuda-${version}"; + version = "0.8.2"; + + src = fetchFromGitHub { + owner = "Theano"; + repo = "Theano"; + rev = "46fbfeb628220b5e42bf8277a5955c52d153e874"; + sha256 = "1sl91gli3jaw5gpjqqab4fiq4x6282spqciaid1s65pjsf3k55sc"; + }; + + doCheck = false; + + patchPhase = '' + pushd theano/sandbox/gpuarray + sed -i -re '2s/^/from builtins import bytes\n/g' subtensor.py + sed -i -re "s/(b'2')/int(bytes(\1))/g" subtensor.py + sed -i -re "s/(ctx.bin_id\[\-2\])/int(\1)/g" subtensor.py + + sed -i -re '2s/^/from builtins import bytes\n/g' dnn.py + sed -i -re "s/(b'30')/int(bytes(\1))/g" dnn.py + sed -i -re "s/(ctx.bin_id\[\-2:\])/int(\1)/g" dnn.py + popd + ''; + + dontStrip = true; + + propagatedBuildInputs = [ + blas + numpy + six + scipy + nose + nose-parameterized + pydot_ng + sphinx + pygments + pycuda + cudatoolkit + libgpuarray + ] ++ (stdenv.lib.optional (cudnn != null) [ cudnn ]); + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5b4b6936cc1..60beb8eae28 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1194,6 +1194,10 @@ in cudnn = callPackage ../development/libraries/science/math/cudnn/default.nix {}; + cudnn5_cudatoolkit75 = callPackage ../development/libraries/science/math/cudnn/7.5-5.0 { + cudatoolkit = self.cudatoolkit75; + }; + curlFull = self.curl.override { idnSupport = true; ldapSupport = true; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index cd7982baa50..8ba9e066b43 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -21031,6 +21031,21 @@ in modules // { }; }; + Theano-cuda = callPackage ../development/python-modules/theano/cuda ( + let + boost = pkgs.boost159.override { + inherit (self) python numpy scipy; + }; + in rec { + cudatoolkit = pkgs.cudatoolkit75; + cudnn = pkgs.cudnn5_cudatoolkit75; + inherit (self) numpy scipy; + pycuda = self.pycuda.override { inherit boost; }; + libgpuarray = self.libgpuarray-cuda.override { + clblas = pkgs.clblas-cuda.override { inherit boost; }; + }; + }); + tidylib = buildPythonPackage rec { version = "0.2.4"; name = "pytidylib-${version}";