From be0ade9d0343905ae3ca439eae8d3b179592eb2e Mon Sep 17 00:00:00 2001 From: artuuge Date: Wed, 15 Jun 2016 00:47:55 +0200 Subject: [PATCH] pycuda: init at 2016.1 --- .../python-modules/pycuda/compyte.nix | 21 ++++++ .../python-modules/pycuda/default.nix | 66 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 5 ++ 3 files changed, 92 insertions(+) create mode 100644 pkgs/development/python-modules/pycuda/compyte.nix create mode 100644 pkgs/development/python-modules/pycuda/default.nix diff --git a/pkgs/development/python-modules/pycuda/compyte.nix b/pkgs/development/python-modules/pycuda/compyte.nix new file mode 100644 index 000000000000..50bd81ac462c --- /dev/null +++ b/pkgs/development/python-modules/pycuda/compyte.nix @@ -0,0 +1,21 @@ +{ mkDerivation +, fetchFromGitHub +}: + +mkDerivation rec { + name = "compyte-${version}"; + version = "git-20150817"; + + src = fetchFromGitHub { + owner = "inducer"; + repo = "compyte"; + rev = "ac1c71d46428c14aa1bd1c09d7da19cd0298d5cc"; + sha256 = "1980h017qi52b7fqwm75m481xs2napgdd3fbrzkfc29k085cbign"; + }; + + installPhase = '' + mkdir -p $out + cp -r * $out + ''; + +} diff --git a/pkgs/development/python-modules/pycuda/default.nix b/pkgs/development/python-modules/pycuda/default.nix new file mode 100644 index 000000000000..df507f9b6ad0 --- /dev/null +++ b/pkgs/development/python-modules/pycuda/default.nix @@ -0,0 +1,66 @@ +{ buildPythonPackage +, fetchFromGitHub +, boost +, numpy +, pytools +, pytest +, decorator +, appdirs +, six +, cudatoolkit +, python +, mkDerivation +, stdenv +}: +let + compyte = import ./compyte.nix { + inherit mkDerivation fetchFromGitHub; + }; +in +buildPythonPackage rec { + name = "pycuda-${version}"; + version = "2016.1"; + + src = fetchFromGitHub { + owner = "inducer"; + repo = "pycuda"; + rev = "609817e22c038249f5e9ddd720b3ca5a9d58ca11"; + sha256 = "0kg6ayxsw2gja9rqspy6z8ihacf9jnxr8hzywjwmj1izkv24cff7"; + }; + + preConfigure = '' + findInputs ${boost} boost_dirs propagated-native-build-inputs + + export BOOST_INCLUDEDIR=$(echo $boost_dirs | sed -e s/\ /\\n/g - | grep '\-dev')/include + export BOOST_LIBRARYDIR=$(echo $boost_dirs | sed -e s/\ /\\n/g - | grep -v '\-dev')/lib + + ${python.interpreter} configure.py --boost-inc-dir=$BOOST_INCLUDEDIR \ + --boost-lib-dir=$BOOST_LIBRARYDIR \ + --no-use-shipped-boost \ + --boost-python-libname=boost_python + ''; + + postInstall = '' + ln -s ${compyte} $out/${python.sitePackages}/pycuda/compyte + ''; + + propagatedBuildInputs = [ + numpy + pytools + pytest + decorator + appdirs + six + cudatoolkit + compyte + python + ]; + + meta = with stdenv.lib; { + homepage = https://github.com/inducer/pycuda/; + description = "CUDA integration for Python."; + license = licenses.mit; + maintainers = with maintainers; [ artuuge ]; + }; + +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 098a133ea71c..2411dcd105e0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7508,6 +7508,11 @@ in modules // { }; }; + pycuda = callPackage ../development/python-modules/pycuda rec { + cudatoolkit = pkgs.cudatoolkit75; + inherit (pkgs.stdenv) mkDerivation; + }; + python-axolotl = buildPythonPackage rec { name = "python-axolotl-${version}"; version = "0.1.7";