[SCM] an open source computer algebra system branch, cleanedupstream, updated. 6125e540ca6d66c307958938a9d53b245507c323

Bernhard R. Link brlink at debian.org
Tue Apr 24 15:54:07 UTC 2012


The following commit has been merged in the cleanedupstream branch:
commit 7fa47c0c4c0dd80d459c047ad0f95a5d4b8cc2e3
Author: Hans Schoenemann <hannes at mathematik.uni-kl.de>
Date:   Mon Mar 12 15:48:36 2012 +0100

    fix: auto-set --cpus depending on machine

diff --git a/Singular/extra.cc b/Singular/extra.cc
index 477f4e6..0c2a5a0 100644
--- a/Singular/extra.cc
+++ b/Singular/extra.cc
@@ -284,15 +284,8 @@ BOOLEAN jjSYSTEM(leftv res, leftv args)
 /*==================== cpu ==================================*/
     if(strcmp(sys_cmd,"cpu")==0)
     {
+      res->data=(void *)feOptValue(FE_OPT_CPUS);
       res->rtyp=INT_CMD;
-      #ifdef _SC_NPROCESSORS_ONLN
-      res->data=(void *)sysconf(_SC_NPROCESSORS_ONLN);
-      #elif defined(_SC_NPROCESSORS_CONF)
-      res->data=(void *)sysconf(_SC_NPROCESSORS_CONF);
-      #else
-      // dummy, if not defined:
-      res->data=(void *)1;
-      #endif
       return FALSE;
     }
     else
diff --git a/Singular/misc_ip.cc b/Singular/misc_ip.cc
index c42eb06..3107e06 100644
--- a/Singular/misc_ip.cc
+++ b/Singular/misc_ip.cc
@@ -1136,6 +1136,15 @@ void siInit(char *name)
 // singular links: --------------------------------------------------
   slStandardInit();
   myynest=0;
+// semapohore 0 -----------------------------------------------------
+  int cpus=2;
+  int cpu_n;
+  #ifdef _SC_NPROCESSORS_ONLN
+  if ((cpu_n=sysconf(_SC_NPROCESSORS_ONLN))>cpus) cpus=cpu_n;
+  #elif defined(_SC_NPROCESSORS_CONF)
+  if ((cpu_n=sysconf(_SC_NPROCESSORS_CONF))>cpus) cpus=cpu_n;
+  #endif
+  feSetOptValue(FE_OPT_CPUS, cpus);
 
 // loading standard.lib -----------------------------------------------
   if (! feOptValue(FE_OPT_NO_STDLIB))
diff --git a/Singular/tesths.cc b/Singular/tesths.cc
index 9796e4c..3f7b411 100644
--- a/Singular/tesths.cc
+++ b/Singular/tesths.cc
@@ -131,6 +131,7 @@ int main(          /* main entry to Singular */
   int cpus = (int)(long)feOptValue(FE_OPT_CPUS);
   sipc_semaphore_init(0, cpus);
 #endif
+
   /* say hello */
   //for official version: not active
   //bigintm_setup();

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list