2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
buildPythonPackage,
|
|
|
|
addOpenGLRunpath,
|
|
|
|
fetchPypi,
|
|
|
|
fetchFromGitHub,
|
|
|
|
mako,
|
|
|
|
boost,
|
|
|
|
numpy,
|
|
|
|
pytools,
|
|
|
|
pytest,
|
|
|
|
decorator,
|
|
|
|
appdirs,
|
|
|
|
six,
|
|
|
|
cudaPackages,
|
|
|
|
python,
|
|
|
|
mkDerivation,
|
|
|
|
lib,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-06-05 15:53:02 +00:00
|
|
|
compyte = import ./compyte.nix { inherit mkDerivation fetchFromGitHub; };
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
inherit (cudaPackages) cudatoolkit;
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pycuda";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "2024.1";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-1Q0j/2NxSCz/fUuVPvQKuByd8DjsthRIT5/VNHMnMn4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
preConfigure = with lib.versions; ''
|
2023-11-16 04:20:00 +00:00
|
|
|
${python.pythonOnBuildForHost.interpreter} configure.py --boost-inc-dir=${boost.dev}/include \
|
2020-04-24 23:36:52 +00:00
|
|
|
--boost-lib-dir=${boost}/lib \
|
|
|
|
--no-use-shipped-boost \
|
2020-05-29 06:06:01 +00:00
|
|
|
--boost-python-libname=boost_python${major python.version}${minor python.version} \
|
|
|
|
--cuda-root=${cudatoolkit}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
ln -s ${compyte} $out/${python.sitePackages}/pycuda/compyte
|
|
|
|
'';
|
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
postFixup = ''
|
|
|
|
find $out/lib -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
|
|
|
|
echo "setting opengl runpath for $lib..."
|
|
|
|
addOpenGLRunpath "$lib"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Requires access to libcuda.so.1 which is provided by the driver
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
py.test
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ addOpenGLRunpath ];
|
2021-04-25 03:57:28 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
pytools
|
|
|
|
pytest
|
|
|
|
decorator
|
|
|
|
appdirs
|
|
|
|
six
|
|
|
|
cudatoolkit
|
|
|
|
compyte
|
|
|
|
python
|
2023-03-15 16:39:30 +00:00
|
|
|
mako
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/inducer/pycuda/";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "CUDA integration for Python";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ artuuge ];
|
|
|
|
};
|
|
|
|
}
|