singular: backport patch to fix docbuilding with >= 64 cpus

This commit is contained in:
Mauricio Collares 2021-12-27 22:23:05 -03:00
parent ac169ec637
commit ec0c4a001f
3 changed files with 39 additions and 18 deletions

View file

@ -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

View file

@ -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

View file

@ -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();