2021-01-25 08:26:54 +00:00
|
|
|
{ lib, buildPythonPackage
|
2021-03-23 04:25:41 +00:00
|
|
|
, fetchPypi, isPy3k, cython
|
|
|
|
, fastrlock, numpy, six, wheel, pytestCheckHook, mock, setuptools
|
2021-03-15 23:09:15 +00:00
|
|
|
, cudatoolkit, cudnn, cutensor, nccl
|
2021-03-23 04:25:41 +00:00
|
|
|
, addOpenGLRunpath
|
2017-12-28 16:42:53 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cupy";
|
2021-03-23 04:25:41 +00:00
|
|
|
version = "8.5.0";
|
2020-11-05 07:17:12 +00:00
|
|
|
disabled = !isPy3k;
|
2017-12-28 16:42:53 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-03-23 04:25:41 +00:00
|
|
|
sha256 = "fb3f8d3b3454beb249b9880502a45fe493c5a44efacc4c72914cbe1a5dbdf803";
|
2017-12-28 16:42:53 +00:00
|
|
|
};
|
|
|
|
|
2020-01-14 12:26:09 +00:00
|
|
|
preConfigure = ''
|
2021-03-23 04:25:41 +00:00
|
|
|
export CUDA_PATH=${cudatoolkit}
|
2020-08-25 03:07:09 +01:00
|
|
|
'';
|
2020-01-14 12:26:09 +00:00
|
|
|
|
2021-03-23 04:25:41 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
addOpenGLRunpath
|
|
|
|
cython
|
|
|
|
];
|
|
|
|
|
|
|
|
LDFLAGS = "-L${cudatoolkit}/lib/stubs";
|
|
|
|
|
2017-12-28 16:42:53 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cudatoolkit
|
|
|
|
cudnn
|
2021-03-15 23:09:15 +00:00
|
|
|
cutensor
|
2017-12-28 16:42:53 +00:00
|
|
|
nccl
|
|
|
|
fastrlock
|
|
|
|
numpy
|
|
|
|
six
|
2020-01-14 12:26:09 +00:00
|
|
|
setuptools
|
2017-12-28 16:42:53 +00:00
|
|
|
wheel
|
|
|
|
];
|
|
|
|
|
2021-03-23 04:25:41 +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
|
|
|
|
'';
|
2017-12-28 16:42:53 +00:00
|
|
|
|
2020-01-14 12:26:09 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-12-28 16:42:53 +00:00
|
|
|
description = "A NumPy-compatible matrix library accelerated by CUDA";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://cupy.chainer.org/";
|
2017-12-28 16:42:53 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
maintainers = with maintainers; [ hyphon81 ];
|
|
|
|
};
|
|
|
|
}
|