avoid setting nthreads higher than available

This commit is contained in:
Martin Kroeker 2024-06-11 15:17:20 +02:00 committed by GitHub
parent 62c33db37d
commit 8e7e14b6aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -135,7 +135,7 @@ void CNAME(BLASLONG n, FLOAT_TYPE * in, BLASLONG inc_in, bfloat16 * out, BLASLON
if (n <= 0) return; if (n <= 0) return;
#if defined(SMP) #if defined(SMP)
int nthreads; int nthreads = blas_cpu_number(1);
FLOAT_TYPE dummy_alpha; FLOAT_TYPE dummy_alpha;
FLOAT_TYPE dummy_c; FLOAT_TYPE dummy_c;
#endif #endif
@ -145,9 +145,9 @@ void CNAME(BLASLONG n, FLOAT_TYPE * in, BLASLONG inc_in, bfloat16 * out, BLASLON
nthreads = 1; nthreads = 1;
} else { } else {
if (n/100000 < 100) { if (n/100000 < 100) {
nthreads = 4; nthreads = MAX(nthreads,4);
} else { } else {
nthreads = 16; nthreads = MAX(nthreads,16);
} }
} }