summary refs log tree commit diff
path: root/pkgs/applications/science/math
diff options
context:
space:
mode:
authorMauricio Collares <mauricio@collares.org>2021-12-27 22:23:05 -0300
committerMauricio Collares <mauricio@collares.org>2021-12-27 22:29:15 -0300
commitec0c4a001f48aea7570bfe96592c418a83964707 (patch)
tree0959aa0cedda0ed8be0e6d4087c4c5653b086592 /pkgs/applications/science/math
parentac169ec6371f0d835542db654a65e0f2feb07838 (diff)
downloadnixpkgs-ec0c4a001f48aea7570bfe96592c418a83964707.tar
nixpkgs-ec0c4a001f48aea7570bfe96592c418a83964707.tar.gz
nixpkgs-ec0c4a001f48aea7570bfe96592c418a83964707.tar.bz2
nixpkgs-ec0c4a001f48aea7570bfe96592c418a83964707.tar.lz
nixpkgs-ec0c4a001f48aea7570bfe96592c418a83964707.tar.xz
nixpkgs-ec0c4a001f48aea7570bfe96592c418a83964707.tar.zst
nixpkgs-ec0c4a001f48aea7570bfe96592c418a83964707.zip
singular: backport patch to fix docbuilding with >= 64 cpus
Diffstat (limited to 'pkgs/applications/science/math')
-rw-r--r--pkgs/applications/science/math/singular/default.nix7
-rw-r--r--pkgs/applications/science/math/singular/disable-vspace-on-aarch64.patch15
-rw-r--r--pkgs/applications/science/math/singular/vspace-MAX_PROCESS.patch35
3 files changed, 39 insertions, 18 deletions
diff --git a/pkgs/applications/science/math/singular/default.nix b/pkgs/applications/science/math/singular/default.nix
index df298aab211..b543252e871 100644
--- a/pkgs/applications/science/math/singular/default.nix
+++ b/pkgs/applications/science/math/singular/default.nix
@@ -47,12 +47,13 @@ stdenv.mkDerivation rec {
   };
 
   patches = [
+    # fix timeouts when docbuilding with >= 64 cpus
+    # https://github.com/Singular/Singular/issues/1117
+    ./vspace-MAX_PROCESS.patch
+
     # add aarch64 support to cpu-check.m4. copied from redhat.
     ./redhat-aarch64.patch
 
-    # vspace causes hangs in modstd and other libraries on aarch64
-    ./disable-vspace-on-aarch64.patch
-
     # the newest version of ax-prog-cc-for-build.m4 seems to trigger
     # linker errors. see
     # https://github.com/alsa-project/alsa-firmware/issues/3 for a
diff --git a/pkgs/applications/science/math/singular/disable-vspace-on-aarch64.patch b/pkgs/applications/science/math/singular/disable-vspace-on-aarch64.patch
deleted file mode 100644
index 3e51b7fb2ce..00000000000
--- a/pkgs/applications/science/math/singular/disable-vspace-on-aarch64.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/kernel/mod2.h b/kernel/mod2.h
-index 867fcae47..2abd84f23 100644
---- a/kernel/mod2.h
-+++ b/kernel/mod2.h
-@@ -60,8 +60,10 @@
- 
- /* define for parallel processes with shared memory */
- #ifndef __CCYGWIN__
-+#ifndef SI_CPU_AARCH64
- #define HAVE_VSPACE 1
- #endif
-+#endif
- 
- /*#define PROFILING*/
- #ifdef PROFILING
diff --git a/pkgs/applications/science/math/singular/vspace-MAX_PROCESS.patch b/pkgs/applications/science/math/singular/vspace-MAX_PROCESS.patch
new file mode 100644
index 00000000000..78d658f926e
--- /dev/null
+++ b/pkgs/applications/science/math/singular/vspace-MAX_PROCESS.patch
@@ -0,0 +1,35 @@
+diff --git a/kernel/GBEngine/kChinese.cc b/kernel/GBEngine/kChinese.cc
+index 829a66609..84655caf2 100644
+--- a/kernel/GBEngine/kChinese.cc
++++ b/kernel/GBEngine/kChinese.cc
+@@ -209,6 +209,8 @@ ideal id_ChineseRemainder_0(ideal *xx, number *q, int rl, const ring r)
+     return NULL;
+   }
+   int cpus=(int)(long)feOptValue(FE_OPT_CPUS);
++  if (cpus>=vspace::internals::MAX_PROCESS)
++    cpus=vspace::internals::MAX_PROCESS-1;
+   if ((cpus==1) || (2*cpus>=cnt))
+     /* at least 2 polys for each process, or switch to seriell version */
+     return id_ChineseRemainder(xx,q,rl,r);
+@@ -295,6 +297,8 @@ ideal id_Farey_0(ideal x, number N, const ring r)
+ {
+   int cnt=IDELEMS(x)*x->nrows;
+   int cpus=(int)(long)feOptValue(FE_OPT_CPUS);
++  if (cpus>=vspace::internals::MAX_PROCESS)
++    cpus=vspace::internals::MAX_PROCESS-1;
+   if (2*cpus>=cnt) /* at least 2 polys for each process, 
+                      or switch to seriell version */
+     return id_Farey(x,N,r);
+diff --git a/kernel/GBEngine/kverify.cc b/kernel/GBEngine/kverify.cc
+index 909d84994..aa06d6624 100644
+--- a/kernel/GBEngine/kverify.cc
++++ b/kernel/GBEngine/kverify.cc
+@@ -176,6 +176,8 @@ BOOLEAN kVerify2(ideal F, ideal Q)
+   /*---------------------------------------------------------------------*/
+   BOOLEAN all_okay=TRUE;
+   int cpus=(int)(long)feOptValue(FE_OPT_CPUS);
++  if (cpus>=vspace::internals::MAX_PROCESS)
++    cpus=vspace::internals::MAX_PROCESS-1;
+   int parent_pid=getpid();
+   using namespace vspace;
+   vmem_init();