git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #16334 from artuuge/theano_cudnn

Theano-cuda: init at 0.8.2

commit8ef747baed3a3313c229d86e8c410b731d3a9124 authorFrederik Rietdijk <freddyrietdijk@fridh.nl> dateTue 21 Jun 2016, 14:26 (10 years ago) parent0a8e613465d6a2
4 files changed+127
pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nix+46 pkgs/development/python-modules/theano/cuda/default.nix+62 pkgs/top-level/all-packages.nix+4 pkgs/top-level/python-packages.nix+15
pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nixnew file+46
@@ -0,0 +1,46 @@
1+{ stdenv
2+, requireFile
3+, cudatoolkit
4+}:
5+
6+stdenv.mkDerivation rec {
7+ version = "5.0";
8+ cudatoolkit_version = "7.5";
9+
10+ name = "cudatoolkit-${cudatoolkit_version}-cudnn-${version}";
11+
12+ src = requireFile rec {
13+ name = "cudnn-${cudatoolkit_version}-linux-x64-v${version}-ga.tgz";
14+ message = ''
15+ This nix expression requires that ${name} is already part of the store.
16+ Register yourself to NVIDIA Accelerated Computing Developer Program, retrieve the cuDNN library
17+ at https://developer.nvidia.com/cudnn, and run the following command in the download directory:
18+ nix-prefetch-url file://${name}
19+ '';
20+ sha256 = "c4739a00608c3b66a004a74fc8e721848f9112c5cb15f730c1be4964b3a23b3a";
21+ };
22+
23+ phases = "unpackPhase installPhase fixupPhase";
24+
25+ installPhase = ''
26+ function fixRunPath {
27+ p=$(patchelf --print-rpath $1)
28+ patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
29+ }
30+ fixRunPath lib64/libcudnn.so
31+
32+ mkdir -p $out
33+ cp -a include $out/include
34+ cp -a lib64 $out/lib64
35+ '';
36+
37+ propagatedBuildInputs = [
38+ cudatoolkit
39+ ];
40+
41+ meta = {
42+ description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
43+ homepage = "https://developer.nvidia.com/cudnn";
44+ license = stdenv.lib.licenses.unfree;
45+ };
46+}
pkgs/development/python-modules/theano/cuda/default.nixnew file+62
@@ -0,0 +1,62 @@
1+{ buildPythonPackage
2+, fetchFromGitHub
3+, blas
4+, numpy
5+, six
6+, scipy
7+, nose
8+, nose-parameterized
9+, pydot_ng
10+, sphinx
11+, pygments
12+, libgpuarray
13+, python
14+, pycuda
15+, cudatoolkit
16+, cudnn
17+, stdenv
18+}:
19+
20+buildPythonPackage rec {
21+ name = "Theano-cuda-${version}";
22+ version = "0.8.2";
23+
24+ src = fetchFromGitHub {
25+ owner = "Theano";
26+ repo = "Theano";
27+ rev = "46fbfeb628220b5e42bf8277a5955c52d153e874";
28+ sha256 = "1sl91gli3jaw5gpjqqab4fiq4x6282spqciaid1s65pjsf3k55sc";
29+ };
30+
31+ doCheck = false;
32+
33+ patchPhase = ''
34+ pushd theano/sandbox/gpuarray
35+ sed -i -re '2s/^/from builtins import bytes\n/g' subtensor.py
36+ sed -i -re "s/(b'2')/int(bytes(\1))/g" subtensor.py
37+ sed -i -re "s/(ctx.bin_id\[\-2\])/int(\1)/g" subtensor.py
38+
39+ sed -i -re '2s/^/from builtins import bytes\n/g' dnn.py
40+ sed -i -re "s/(b'30')/int(bytes(\1))/g" dnn.py
41+ sed -i -re "s/(ctx.bin_id\[\-2:\])/int(\1)/g" dnn.py
42+ popd
43+ '';
44+
45+ dontStrip = true;
46+
47+ propagatedBuildInputs = [
48+ blas
49+ numpy
50+ six
51+ scipy
52+ nose
53+ nose-parameterized
54+ pydot_ng
55+ sphinx
56+ pygments
57+ pycuda
58+ cudatoolkit
59+ libgpuarray
60+ ] ++ (stdenv.lib.optional (cudnn != null) [ cudnn ]);
61+
62+}
pkgs/top-level/all-packages.nix+4
@@ -1194,6 +1194,10 @@ in
11941194
11951195 cudnn = callPackage ../development/libraries/science/math/cudnn/default.nix {};
11961196
1197+ cudnn5_cudatoolkit75 = callPackage ../development/libraries/science/math/cudnn/7.5-5.0 {
1198+ cudatoolkit = self.cudatoolkit75;
1199+ };
1200+
11971201 curlFull = self.curl.override {
11981202 idnSupport = true;
11991203 ldapSupport = true;
pkgs/top-level/python-packages.nix+15
@@ -21031,6 +21031,21 @@ in modules // {
2103121031 };
2103221032 };
2103321033
21034+ Theano-cuda = callPackage ../development/python-modules/theano/cuda (
21035+ let
21036+ boost = pkgs.boost159.override {
21037+ inherit (self) python numpy scipy;
21038+ };
21039+ in rec {
21040+ cudatoolkit = pkgs.cudatoolkit75;
21041+ cudnn = pkgs.cudnn5_cudatoolkit75;
21042+ inherit (self) numpy scipy;
21043+ pycuda = self.pycuda.override { inherit boost; };
21044+ libgpuarray = self.libgpuarray-cuda.override {
21045+ clblas = pkgs.clblas-cuda.override { inherit boost; };
21046+ };
21047+ });
21048+
2103421049 tidylib = buildPythonPackage rec {
2103521050 version = "0.2.4";
2103621051 name = "pytidylib-${version}";