2021-02-05 17:12:51 +00:00
|
|
|
{ lib, buildPythonPackage
|
2021-03-20 04:20:00 +00:00
|
|
|
, fetchPypi, isPy3k, cython
|
|
|
|
, fastrlock, numpy, six, wheel, pytestCheckHook, mock, setuptools
|
2021-03-19 17:17:44 +00:00
|
|
|
, cudatoolkit, cudnn, cutensor, nccl
|
2021-03-20 04:20:00 +00:00
|
|
|
, addOpenGLRunpath
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cupy";
|
2021-03-20 04:20:00 +00:00
|
|
|
version = "8.5.0";
|
2020-11-06 00:33:48 +00:00
|
|
|
disabled = !isPy3k;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-03-20 04:20:00 +00:00
|
|
|
sha256 = "fb3f8d3b3454beb249b9880502a45fe493c5a44efacc4c72914cbe1a5dbdf803";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
preConfigure = ''
|
2021-03-20 04:20:00 +00:00
|
|
|
export CUDA_PATH=${cudatoolkit}
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
addOpenGLRunpath
|
|
|
|
cython
|
|
|
|
];
|
|
|
|
|
|
|
|
LDFLAGS = "-L${cudatoolkit}/lib/stubs";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cudatoolkit
|
|
|
|
cudnn
|
2021-03-19 17:17:44 +00:00
|
|
|
cutensor
|
2020-04-24 23:36:52 +00:00
|
|
|
nccl
|
|
|
|
fastrlock
|
|
|
|
numpy
|
|
|
|
six
|
|
|
|
setuptools
|
|
|
|
wheel
|
|
|
|
];
|
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
mock
|
|
|
|
];
|
|
|
|
|
|
|
|
# Won't work with the GPU, whose drivers won't be accessible from the build
|
|
|
|
# sandbox
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
|
|
|
|
addOpenGLRunpath "$lib"
|
|
|
|
done
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A NumPy-compatible matrix library accelerated by CUDA";
|
|
|
|
homepage = "https://cupy.chainer.org/";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
maintainers = with maintainers; [ hyphon81 ];
|
|
|
|
};
|
|
|
|
}
|