Do not use multithreading for small workloads

This commit is contained in:
Martin Kroeker 2023-03-23 23:13:02 +01:00 committed by GitHub
parent 2885e4d898
commit 244147495a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -180,6 +180,9 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha,
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMP
if (n <200)
nthreads=1;
else
nthreads = num_cpu_avail(2);
if (nthreads == 1) {

View File

@ -368,6 +368,9 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr
mode |= (uplo << BLAS_UPLO_SHIFT);
args.common = NULL;
if (args.n*args.k <1000)
args.nthreads =1 ;
else
args.nthreads = num_cpu_avail(3);
if (args.nthreads == 1) {