diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2016-11-30 10:03:57 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2016-11-30 10:04:54 +0100 |
commit | 07dcc4f43aeb3703cf55002dc00af89cc3585a69 (patch) | |
tree | bf5bfb26628ed9bab7ea5ced8affa15ae0a9fd80 /pkgs/development/python-modules/Theano | |
parent | 2605149d158a0247a344b7f484071a677d71bc82 (diff) |
pythonPackages.Theano: move and rename variants
We have two derivations, one that supports Cuda, and one that does not. The names, TheanoWithCuda and TheanoWithoutCuda, now reflect that. Furthermore, a boolean passthru.cudaSupport was added. In the future the two derivations should be merged in one, with a parameter `cudaSupport`.
Diffstat (limited to 'pkgs/development/python-modules/Theano')
-rw-r--r-- | pkgs/development/python-modules/Theano/theano-with-cuda/default.nix | 62 | ||||
-rw-r--r-- | pkgs/development/python-modules/Theano/theano-without-cuda/default.nix | 44 |
2 files changed, 106 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/Theano/theano-with-cuda/default.nix b/pkgs/development/python-modules/Theano/theano-with-cuda/default.nix new file mode 100644 index 0000000000000..c9ea79bef9a81 --- /dev/null +++ b/pkgs/development/python-modules/Theano/theano-with-cuda/default.nix @@ -0,0 +1,62 @@ +{ buildPythonPackage +, fetchFromGitHub +, 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 = [ + numpy.blas + numpy + six + scipy + nose + nose-parameterized + pydot_ng + sphinx + pygments + pycuda + cudatoolkit + libgpuarray + ] ++ (stdenv.lib.optional (cudnn != null) [ cudnn ]); + + passthru.cudaSupport = true; +} diff --git a/pkgs/development/python-modules/Theano/theano-without-cuda/default.nix b/pkgs/development/python-modules/Theano/theano-without-cuda/default.nix new file mode 100644 index 0000000000000..6efa945b0e611 --- /dev/null +++ b/pkgs/development/python-modules/Theano/theano-without-cuda/default.nix @@ -0,0 +1,44 @@ +{ stdenv +, fetchurl +, buildPythonPackage +, isPyPy +, pythonOlder +, isPy3k +, nose +, numpy +, pydot_ng +, scipy +, six +}: + +buildPythonPackage rec { + name = "Theano-0.8.2"; + + disabled = isPyPy || pythonOlder "2.6" || (isPy3k && pythonOlder "3.3"); + + src = fetchurl { + url = "mirror://pypi/T/Theano/${name}.tar.gz"; + sha256 = "7463c8f7ed1a787bf881f36d38a38607150186697e7ce7e78bfb94b7c6af8930"; + }; + + #preCheck = '' + # mkdir -p check-phase + # export HOME=$(pwd)/check-phase + #''; + doCheck = false; + # takes far too long, also throws "TypeError: sort() missing 1 required positional argument: 'a'" + # when run from the installer, and testing with Python 3.5 hits github.com/Theano/Theano/issues/4276, + # the fix for which hasn't been merged yet. + + # keep Nose around since running the tests by hand is possible from Python or bash + propagatedBuildInputs = [ stdenv nose numpy numpy.blas pydot_ng scipy six ]; + + meta = { + homepage = http://deeplearning.net/software/theano/; + description = "A Python library for large-scale array computation"; + license = stdenv.lib.licenses.bsd3; + maintainers = [ stdenv.lib.maintainers.bcdarwin ]; + }; + + passthru.cudaSupport = false; +} |