comparison installer-files/octave-launch.c @ 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 88762923aa9a
children cf7adc238c0c
comparison
equal deleted inserted replaced
6024:e26ff3ad0f60 6025:9d6cbb229b0f
266 { 266 {
267 /* Only set if it wasn't already set in the environment */ 267 /* Only set if it wasn't already set in the environment */
268 size_t num_threads; 268 size_t num_threads;
269 num_threads = get_num_physical_cores (); 269 num_threads = get_num_physical_cores ();
270 270
271 // Setting OPENBLAS_NUM_THREADS to something higher than what NUM_THREADS
272 // was set to when OpenBLAS was configured, can lead to errors.
273 // FIXME: Can/should we get that number from the library?
274 #define MAX_NUM_THREADS 24
275 if (num_threads > MAX_NUM_THREADS)
276 num_threads = MAX_NUM_THREADS;
277
271 if (num_threads > 0) 278 if (num_threads > 0)
272 { 279 {
273 #define THREADS_SZ 64 280 #define THREADS_SZ 64
274 wchar_t buffer[THREADS_SZ]; 281 wchar_t buffer[THREADS_SZ];
275 StringCchPrintfW (buffer, THREADS_SZ, L"%zu", num_threads); 282 StringCchPrintfW (buffer, THREADS_SZ, L"%zu", num_threads);