aboutsummaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'init.c')
-rw-r--r--init.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/init.c b/init.c
index f112ce7..07a00d8 100644
--- a/init.c
+++ b/init.c
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <unistd.h>
#include <cblas.h>
@@ -30,7 +31,6 @@
#include "basis.h"
#include "common.h"
-#include "cpu.h"
#include "internal.h"
#include "log.h"
#include "nlsolve.h"
@@ -55,9 +55,16 @@ static int teukolsky_init_check_options(TDContext *td)
int ret;
if (!td->nb_threads) {
- td->nb_threads = tdi_cpu_count();
- if (!td->nb_threads)
- td->nb_threads = 1;
+ long val = 0;
+
+#ifdef _SC_NPROCESSORS_ONLN
+ val = sysconf(_SC_NPROCESSORS_ONLN);
+#endif
+
+ if (val <= 0)
+ val = 1;
+
+ td->nb_threads = val;
}
ret = tp_init(&s->tp, td->nb_threads);
@@ -327,7 +334,7 @@ TDContext *td_context_alloc(void)
if (!td)
return NULL;
- td->nb_threads = 1;
+ td->nb_threads = 0;
td->family = TD_FAMILY_TIME_ANTISYM_CUBIC;
td->solution_branch = 0;