17 inherit (cudaPackages) cudatoolkit cudnn cutensor nccl;
18 in buildPythonPackage rec {
22 disabled = pythonOlder "3.7";
25 inherit pname version;
26 hash = "sha256-+V/9Cv6sthewSP4Cjt4HuX3J6VrKFhCgIrHz0gqaAn4=";
29 # See https://docs.cupy.dev/en/v10.2.0/reference/environment.html. Seting both
30 # CUPY_NUM_BUILD_JOBS and CUPY_NUM_NVCC_THREADS to NIX_BUILD_CORES results in
31 # a small amount of thrashing but it turns out there are a large number of
32 # very short builds and a few extremely long ones, so setting both ends up
33 # working nicely in practice.
35 export CUDA_PATH=${cudatoolkit}
36 export CUPY_NUM_BUILD_JOBS="$NIX_BUILD_CORES"
37 export CUPY_NUM_NVCC_THREADS="$NIX_BUILD_CORES"
45 LDFLAGS = "-L${cudatoolkit}/lib/stubs";
47 propagatedBuildInputs = [
63 # Won't work with the GPU, whose drivers won't be accessible from the build
68 find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
69 addOpenGLRunpath "$lib"
73 enableParallelBuilding = true;
76 description = "A NumPy-compatible matrix library accelerated by CUDA";
77 homepage = "https://cupy.chainer.org/";
78 changelog = "https://github.com/cupy/cupy/releases/tag/v${version}";
79 license = licenses.mit;
80 platforms = [ "x86_64-linux" ];
81 maintainers = with maintainers; [ hyphon81 ];