changeset 6025:9d6cbb229b0f

octave-launch: Limit number of OpenBLAS threads to a maximum of 24.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 01 Jan 2022 20:21:11 +0100
parents e26ff3ad0f60
children a882556270c8 43c0072150cc
files installer-files/octave-launch.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/installer-files/octave-launch.c	Sat Jan 01 10:43:05 2022 -0500
+++ b/installer-files/octave-launch.c	Sat Jan 01 20:21:11 2022 +0100
@@ -268,6 +268,13 @@
       size_t num_threads;
       num_threads = get_num_physical_cores ();
 
+      // Setting OPENBLAS_NUM_THREADS to something higher than what NUM_THREADS
+      // was set to when OpenBLAS was configured, can lead to errors.
+      // FIXME: Can/should we get that number from the library?
+#define MAX_NUM_THREADS 24
+      if (num_threads > MAX_NUM_THREADS)
+        num_threads = MAX_NUM_THREADS;
+
       if (num_threads > 0)
         {
 #define THREADS_SZ 64