about summary refs log tree commit diff
path: root/pkgs/development/python-modules/cupy/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/cupy/default.nix')
-rw-r--r--pkgs/development/python-modules/cupy/default.nix70
1 files changed, 41 insertions, 29 deletions
diff --git a/pkgs/development/python-modules/cupy/default.nix b/pkgs/development/python-modules/cupy/default.nix
index 842645597062..e0f3e8311db1 100644
--- a/pkgs/development/python-modules/cupy/default.nix
+++ b/pkgs/development/python-modules/cupy/default.nix
@@ -1,28 +1,27 @@
-{ lib
-, buildPythonPackage
-, fetchPypi
-, cython
-, fastrlock
-, numpy
-, wheel
-, pytestCheckHook
-, mock
-, setuptools
-, cudaPackages
-, addOpenGLRunpath
-, pythonOlder
-, symlinkJoin
+{
+  lib,
+  buildPythonPackage,
+  fetchFromGitHub,
+  cython_0,
+  fastrlock,
+  numpy,
+  wheel,
+  pytestCheckHook,
+  mock,
+  setuptools,
+  cudaPackages,
+  addDriverRunpath,
+  pythonOlder,
+  symlinkJoin,
+  fetchpatch
 }:
 
 let
   inherit (cudaPackages) cudnn cutensor nccl;
-  cudatoolkit-joined = symlinkJoin {
-    name = "cudatoolkit-joined-${cudaPackages.cudaVersion}";
-    paths = with cudaPackages; [
+  outpaths = with cudaPackages; [
       cuda_cccl # <nv/target>
-      cuda_cccl.dev
       cuda_cudart
-      cuda_nvcc.dev # <crt/host_defines.h>
+      cuda_nvcc # <crt/host_defines.h>
       cuda_nvprof
       cuda_nvrtc
       cuda_nvtx
@@ -35,21 +34,35 @@ let
 
       # Missing:
       # cusparselt
-    ];
+  ];
+  cudatoolkit-joined = symlinkJoin {
+    name = "cudatoolkit-joined-${cudaPackages.cudaVersion}";
+    paths = outpaths ++ lib.concatMap (f: lib.map f outpaths) [lib.getLib lib.getDev (lib.getOutput "static") (lib.getOutput "stubs")];
   };
 in
 buildPythonPackage rec {
   pname = "cupy";
-  version = "13.0.0";
+  version = "13.3.0";
   format = "setuptools";
 
   disabled = pythonOlder "3.7";
 
-  src = fetchPypi {
-    inherit pname version;
-    hash = "sha256-LwTnhX9pKnEzYNycOwZwmAarhAT8o5ta+XIcBKKXmq4=";
+  src = fetchFromGitHub {
+    owner = "cupy";
+    repo = "cupy";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-eQZwOGCaWZ4b0JCHZlrPHVQVXQwSkibHb02j0czAMt8=";
+    fetchSubmodules = true;
   };
 
+  patches = [
+    (fetchpatch {
+      url =
+        "https://github.com/cfhammill/cupy/commit/67526c756e4a0a70f0420bf0e7f081b8a35a8ee5.patch";
+      hash = "sha256-WZgexBdM9J0ep5s+9CGZriVq0ZidCRccox+g0iDDywQ=";
+    })
+  ];
+
   # See https://docs.cupy.dev/en/v10.2.0/reference/environment.html. Seting both
   # CUPY_NUM_BUILD_JOBS and CUPY_NUM_NVCC_THREADS to NIX_BUILD_CORES results in
   # a small amount of thrashing but it turns out there are a large number of
@@ -63,8 +76,8 @@ buildPythonPackage rec {
   nativeBuildInputs = [
     setuptools
     wheel
-    addOpenGLRunpath
-    cython
+    addDriverRunpath
+    cython_0
     cudaPackages.cuda_nvcc
   ];
 
@@ -77,7 +90,6 @@ buildPythonPackage rec {
 
   NVCC = "${lib.getExe cudaPackages.cuda_nvcc}"; # FIXME: splicing/buildPackages
   CUDA_PATH = "${cudatoolkit-joined}";
-  LDFLAGS = "-L${cudaPackages.cuda_cudart}/lib/stubs";
 
   propagatedBuildInputs = [
     fastrlock
@@ -95,14 +107,14 @@ buildPythonPackage rec {
 
   postFixup = ''
     find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
-      addOpenGLRunpath "$lib"
+      addDriverRunpath "$lib"
     done
   '';
 
   enableParallelBuilding = true;
 
   meta = with lib; {
-    description = "A NumPy-compatible matrix library accelerated by CUDA";
+    description = "NumPy-compatible matrix library accelerated by CUDA";
     homepage = "https://cupy.chainer.org/";
     changelog = "https://github.com/cupy/cupy/releases/tag/v${version}";
     license = licenses.mit;