ensure that threading has been initialized in the first place before calling openblas_set_num_threads
This commit is contained in:
parent
8a43baacb2
commit
38cf5d9364
|
@ -850,6 +850,11 @@ void goto_set_num_threads(int num_threads) {
|
||||||
|
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
|
#ifdef SMP_SERVER
|
||||||
|
// Handle lazy re-init of the thread-pool after a POSIX fork
|
||||||
|
if (unlikely(blas_server_avail == 0)) blas_thread_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (num_threads < 1) num_threads = blas_num_threads;
|
if (num_threads < 1) num_threads = blas_num_threads;
|
||||||
|
|
||||||
#ifndef NO_AFFINITY
|
#ifndef NO_AFFINITY
|
||||||
|
|
|
@ -480,6 +480,11 @@ void goto_set_num_threads(int num_threads)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
|
#if defined(SMP_SERVER) && defined(OS_CYGWIN_NT)
|
||||||
|
// Handle lazy re-init of the thread-pool after a POSIX fork
|
||||||
|
if (unlikely(blas_server_avail == 0)) blas_thread_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (num_threads < 1) num_threads = blas_cpu_number;
|
if (num_threads < 1) num_threads = blas_cpu_number;
|
||||||
|
|
||||||
if (num_threads > MAX_CPU_NUMBER) num_threads = MAX_CPU_NUMBER;
|
if (num_threads > MAX_CPU_NUMBER) num_threads = MAX_CPU_NUMBER;
|
||||||
|
|
Loading…
Reference in New Issue