1{ buildPythonPackage
2, fetchPypi
3, fetchFromGitHub
4, Mako
5, boost
6, numpy
7, pytools
8, pytest
9, decorator
10, appdirs
11, six
12, cudatoolkit
13, python
14, mkDerivation
15, stdenv
16}:
17let
18 compyte = import ./compyte.nix {
19 inherit mkDerivation fetchFromGitHub;
20 };
21in
22buildPythonPackage rec {
23 pname = "pycuda";
24 version = "2019.1.2";
25
26 src = fetchPypi {
27 inherit pname version;
28 sha256 = "ada56ce98a41f9f95fe18809f38afbae473a5c62d346cfa126a2d5477f24cc8a";
29 };
30
31 preConfigure = with stdenv.lib.versions; ''
32 ${python.interpreter} configure.py --boost-inc-dir=${boost.dev}/include \
33 --boost-lib-dir=${boost}/lib \
34 --no-use-shipped-boost \
35 --boost-python-libname=boost_python${major python.version}${minor python.version} \
36 --cuda-root=${cudatoolkit}
37 '';
38
39 postInstall = ''
40 ln -s ${compyte} $out/${python.sitePackages}/pycuda/compyte
41 '';
42
43 # Requires access to libcuda.so.1 which is provided by the driver
44 doCheck = false;
45
46 checkPhase = ''
47 py.test
48 '';
49
50 propagatedBuildInputs = [
51 numpy
52 pytools
53 pytest
54 decorator
55 appdirs
56 six
57 cudatoolkit
58 compyte
59 python
60 Mako
61 ];
62
63 meta = with stdenv.lib; {
64 homepage = "https://github.com/inducer/pycuda/";
65 description = "CUDA integration for Python.";
66 license = licenses.mit;
67 maintainers = with maintainers; [ artuuge ];
68 };
69
70}