diff --git a/pkgs/development/python-modules/cupy/default.nix b/pkgs/development/python-modules/cupy/default.nix index 661645a7ceb9..a798920ef7a8 100644 --- a/pkgs/development/python-modules/cupy/default.nix +++ b/pkgs/development/python-modules/cupy/default.nix @@ -19,8 +19,15 @@ buildPythonPackage rec { sha256 = "sha256-5ovvA76QGOsOnVztMfDgLerks5nJrKR08rLc+ArmWA8="; }; + # 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 + # very short builds and a few extremely long ones, so setting both ends up + # working nicely in practice. preConfigure = '' export CUDA_PATH=${cudatoolkit} + export CUPY_NUM_BUILD_JOBS="$NIX_BUILD_CORES" + export CUPY_NUM_NVCC_THREADS="$NIX_BUILD_CORES" ''; nativeBuildInputs = [