at master 1.8 kB view raw
1{ 2 buildPythonPackage, 3 addDriverRunpath, 4 fetchPypi, 5 fetchFromGitHub, 6 mako, 7 boost, 8 numpy, 9 pytools, 10 pytest, 11 decorator, 12 appdirs, 13 six, 14 cudaPackages, 15 python, 16 mkDerivation, 17 lib, 18}: 19let 20 compyte = import ./compyte.nix { inherit mkDerivation fetchFromGitHub; }; 21 22 inherit (cudaPackages) cudatoolkit; 23in 24buildPythonPackage rec { 25 pname = "pycuda"; 26 version = "2025.1.2"; 27 format = "setuptools"; 28 29 src = fetchPypi { 30 inherit pname version; 31 hash = "sha256-DdgpEdctjgPGMSiuROmc+3tGiQlKumzFGT2OlEcXqvo="; 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 addDriverRunpath "$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 = [ addDriverRunpath ]; 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; [ ]; 80 }; 81}