18 inherit (cudaPackages) cudnn cutensor nccl;
19 cudatoolkit-joined = symlinkJoin {
20 name = "cudatoolkit-joined-${cudaPackages.cudaVersion}";
21 paths = with cudaPackages; [
22 cuda_cccl # <nv/target>
25 cuda_nvcc.dev # <crt/host_defines.h>
41 buildPythonPackage rec {
44 format = "setuptools";
46 disabled = pythonOlder "3.7";
49 inherit pname version;
50 hash = "sha256-LwTnhX9pKnEzYNycOwZwmAarhAT8o5ta+XIcBKKXmq4=";
53 # See https://docs.cupy.dev/en/v10.2.0/reference/environment.html. Seting both
54 # CUPY_NUM_BUILD_JOBS and CUPY_NUM_NVCC_THREADS to NIX_BUILD_CORES results in
55 # a small amount of thrashing but it turns out there are a large number of
56 # very short builds and a few extremely long ones, so setting both ends up
57 # working nicely in practice.
59 export CUPY_NUM_BUILD_JOBS="$NIX_BUILD_CORES"
60 export CUPY_NUM_NVCC_THREADS="$NIX_BUILD_CORES"
68 cudaPackages.cuda_nvcc
78 NVCC = "${lib.getExe cudaPackages.cuda_nvcc}"; # FIXME: splicing/buildPackages
79 CUDA_PATH = "${cudatoolkit-joined}";
80 LDFLAGS = "-L${cudaPackages.cuda_cudart}/lib/stubs";
82 propagatedBuildInputs = [
92 # Won't work with the GPU, whose drivers won't be accessible from the build
97 find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
98 addOpenGLRunpath "$lib"
102 enableParallelBuilding = true;
105 description = "A NumPy-compatible matrix library accelerated by CUDA";
106 homepage = "https://cupy.chainer.org/";
107 changelog = "https://github.com/cupy/cupy/releases/tag/v${version}";
108 license = licenses.mit;
109 platforms = [ "x86_64-linux" ];
110 maintainers = with maintainers; [ hyphon81 ];