at 22.05-pre 1.7 kB view raw
1{ buildPythonPackage 2, addOpenGLRunpath 3, fetchPypi 4, fetchFromGitHub 5, Mako 6, boost 7, numpy 8, pytools 9, pytest 10, decorator 11, appdirs 12, six 13, cudatoolkit 14, python 15, mkDerivation 16, lib 17}: 18let 19 compyte = import ./compyte.nix { 20 inherit mkDerivation fetchFromGitHub; 21 }; 22in 23buildPythonPackage rec { 24 pname = "pycuda"; 25 version = "2021.1"; 26 27 src = fetchPypi { 28 inherit pname version; 29 sha256 = "ab87312d0fc349d9c17294a087bb9615cffcf966ad7b115f5b051008a48dd6ed"; 30 }; 31 32 preConfigure = with lib.versions; '' 33 ${python.interpreter} configure.py --boost-inc-dir=${boost.dev}/include \ 34 --boost-lib-dir=${boost}/lib \ 35 --no-use-shipped-boost \ 36 --boost-python-libname=boost_python${major python.version}${minor python.version} \ 37 --cuda-root=${cudatoolkit} 38 ''; 39 40 postInstall = '' 41 ln -s ${compyte} $out/${python.sitePackages}/pycuda/compyte 42 ''; 43 44 postFixup = '' 45 find $out/lib -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do 46 echo "setting opengl runpath for $lib..." 47 addOpenGLRunpath "$lib" 48 done 49 ''; 50 51 # Requires access to libcuda.so.1 which is provided by the driver 52 doCheck = false; 53 54 checkPhase = '' 55 py.test 56 ''; 57 58 nativeBuildInputs = [ 59 addOpenGLRunpath 60 ]; 61 62 propagatedBuildInputs = [ 63 numpy 64 pytools 65 pytest 66 decorator 67 appdirs 68 six 69 cudatoolkit 70 compyte 71 python 72 Mako 73 ]; 74 75 meta = with lib; { 76 homepage = "https://github.com/inducer/pycuda/"; 77 description = "CUDA integration for Python."; 78 license = licenses.mit; 79 maintainers = with maintainers; [ artuuge ]; 80 }; 81 82}