Merge pull request #324672 from cfhammill/patch-and-update-cupy

python312Packages.cupy: 13.0->13.2, patch to find libcudart-static
This commit is contained in:
Someone 2024-07-11 12:26:42 +00:00 committed by GitHub
commit 7b73c86048
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,8 @@
{ {
lib, lib,
buildPythonPackage, buildPythonPackage,
fetchPypi, fetchFromGitHub,
cython, cython_0,
fastrlock, fastrlock,
numpy, numpy,
wheel, wheel,
@ -13,13 +13,12 @@
addOpenGLRunpath, addOpenGLRunpath,
pythonOlder, pythonOlder,
symlinkJoin, symlinkJoin,
fetchpatch
}: }:
let let
inherit (cudaPackages) cudnn cutensor nccl; inherit (cudaPackages) cudnn cutensor nccl;
cudatoolkit-joined = symlinkJoin { outpaths = with cudaPackages; [
name = "cudatoolkit-joined-${cudaPackages.cudaVersion}";
paths = with cudaPackages; [
cuda_cccl # <nv/target> cuda_cccl # <nv/target>
cuda_cudart cuda_cudart
cuda_nvcc # <crt/host_defines.h> cuda_nvcc # <crt/host_defines.h>
@ -35,7 +34,10 @@ let
# Missing: # Missing:
# cusparselt # 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 in
buildPythonPackage rec { buildPythonPackage rec {
@ -45,11 +47,22 @@ buildPythonPackage rec {
disabled = pythonOlder "3.7"; disabled = pythonOlder "3.7";
src = fetchPypi { src = fetchFromGitHub {
inherit pname version; owner = "cupy";
hash = "sha256-5NvSsu1BWaXMDA+YpxCgFJUOssFu60VelWEo87O9DVE="; repo = "cupy";
rev = "v13.2.0";
hash = "sha256-vZAtpIZztmsYeJeuq7yl7kgZse2azrIM3efHDmUswJI=";
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 # 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 # 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 # a small amount of thrashing but it turns out there are a large number of
@ -64,7 +77,7 @@ buildPythonPackage rec {
setuptools setuptools
wheel wheel
addOpenGLRunpath addOpenGLRunpath
cython cython_0
cudaPackages.cuda_nvcc cudaPackages.cuda_nvcc
]; ];
@ -77,7 +90,6 @@ buildPythonPackage rec {
NVCC = "${lib.getExe cudaPackages.cuda_nvcc}"; # FIXME: splicing/buildPackages NVCC = "${lib.getExe cudaPackages.cuda_nvcc}"; # FIXME: splicing/buildPackages
CUDA_PATH = "${cudatoolkit-joined}"; CUDA_PATH = "${cudatoolkit-joined}";
LDFLAGS = "-L${cudaPackages.cuda_cudart}/lib/stubs";
propagatedBuildInputs = [ propagatedBuildInputs = [
fastrlock fastrlock