2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
buildPythonPackage,
|
2024-07-31 10:19:44 +00:00
|
|
|
addDriverRunpath,
|
2024-06-05 15:53:02 +00:00
|
|
|
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-09-19 14:19:46 +00:00
|
|
|
version = "2024.1.2";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-0RC3J8vqhZ2ktj6Rtvoen8MsW63gLYn/RJl1mW6cz6s=";
|
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..."
|
2024-07-31 10:19:44 +00:00
|
|
|
addDriverRunpath "$lib"
|
2021-04-25 03:57:28 +00:00
|
|
|
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-07-31 10:19:44 +00:00
|
|
|
nativeBuildInputs = [ addDriverRunpath ];
|
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 ];
|
|
|
|
};
|
|
|
|
}
|