about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Marshall <andrew@johnandrewmarshall.com>2023-08-16 18:40:22 -0400
committerAndrew Marshall <andrew@johnandrewmarshall.com>2023-11-11 13:44:23 -0500
commit5d9e3ac039b2c2fd62b71256e7368c212b6f475e (patch)
tree4c1d0ddf5f832799a777832462280649f0ffed39
parent85f1ba3e51676fa8cc604a3d863d729026a6b8eb (diff)
downloadnixlib-5d9e3ac039b2c2fd62b71256e7368c212b6f475e.tar
nixlib-5d9e3ac039b2c2fd62b71256e7368c212b6f475e.tar.gz
nixlib-5d9e3ac039b2c2fd62b71256e7368c212b6f475e.tar.bz2
nixlib-5d9e3ac039b2c2fd62b71256e7368c212b6f475e.tar.lz
nixlib-5d9e3ac039b2c2fd62b71256e7368c212b6f475e.tar.xz
nixlib-5d9e3ac039b2c2fd62b71256e7368c212b6f475e.tar.zst
nixlib-5d9e3ac039b2c2fd62b71256e7368c212b6f475e.zip
opensubdiv: Fix flaky build with CUDA and high parallelism
See upstream issue:
https://github.com/PixarAnimationStudios/OpenSubdiv/issues/1313
-rw-r--r--pkgs/development/libraries/opensubdiv/default.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/development/libraries/opensubdiv/default.nix b/pkgs/development/libraries/opensubdiv/default.nix
index 06d65be106da..b0ff4b528864 100644
--- a/pkgs/development/libraries/opensubdiv/default.nix
+++ b/pkgs/development/libraries/opensubdiv/default.nix
@@ -47,6 +47,11 @@ stdenv.mkDerivation rec {
       "-DNO_OPENCL=1"
     ];
 
+  preBuild = let maxBuildCores = 16; in lib.optionalString cudaSupport ''
+    # https://github.com/PixarAnimationStudios/OpenSubdiv/issues/1313
+    NIX_BUILD_CORES=$(( NIX_BUILD_CORES < ${toString maxBuildCores} ? NIX_BUILD_CORES : ${toString maxBuildCores} ))
+  '';
+
   postInstall = "rm $out/lib/*.a";
 
   meta = {