2020-04-24 23:36:52 +00:00
|
|
|
{ buildPythonPackage
|
2021-04-25 03:57:28 +00:00
|
|
|
, addOpenGLRunpath
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchPypi
|
|
|
|
, fetchFromGitHub
|
2023-03-15 16:39:30 +00:00
|
|
|
, mako
|
2020-04-24 23:36:52 +00:00
|
|
|
, boost
|
|
|
|
, numpy
|
|
|
|
, pytools
|
|
|
|
, pytest
|
|
|
|
, decorator
|
|
|
|
, appdirs
|
|
|
|
, six
|
2022-04-15 01:41:22 +00:00
|
|
|
, cudaPackages
|
2020-04-24 23:36:52 +00:00
|
|
|
, python
|
|
|
|
, mkDerivation
|
2021-02-05 17:12:51 +00:00
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
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";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "2022.2.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-zZLnJGu0WsNFKVWhEHFBEmdM3ztKni9P8lpBWcaE5rs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
preConfigure = with lib.versions; ''
|
2023-03-04 12:14:45 +00:00
|
|
|
${python.pythonForBuild.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
|
|
|
|
'';
|
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
addOpenGLRunpath
|
|
|
|
];
|
|
|
|
|
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/";
|
|
|
|
description = "CUDA integration for Python.";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ artuuge ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|