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