Serialize accesses to parallelized level3 functions from multiple callers
for #1851
This commit is contained in:
parent
76a66eaac8
commit
2e6fae2aad
|
@ -514,6 +514,10 @@ static int gemm_driver(blas_arg_t *args, BLASLONG *range_m, BLASLONG
|
||||||
*range_n, FLOAT *sa, FLOAT *sb,
|
*range_n, FLOAT *sa, FLOAT *sb,
|
||||||
BLASLONG nthreads_m, BLASLONG nthreads_n) {
|
BLASLONG nthreads_m, BLASLONG nthreads_n) {
|
||||||
|
|
||||||
|
#ifndef USE_OPENMP
|
||||||
|
static pthread_mutex_t level3_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
#endif
|
||||||
|
|
||||||
blas_arg_t newarg;
|
blas_arg_t newarg;
|
||||||
|
|
||||||
#ifndef USE_ALLOC_HEAP
|
#ifndef USE_ALLOC_HEAP
|
||||||
|
@ -554,6 +558,10 @@ static int gemm_driver(blas_arg_t *args, BLASLONG *range_m, BLASLONG
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef USE_OPENMP
|
||||||
|
pthread_mutex_lock(&level3_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_ALLOC_HEAP
|
#ifdef USE_ALLOC_HEAP
|
||||||
/* Dynamically allocate workspace */
|
/* Dynamically allocate workspace */
|
||||||
job = (job_t*)malloc(MAX_CPU_NUMBER * sizeof(job_t));
|
job = (job_t*)malloc(MAX_CPU_NUMBER * sizeof(job_t));
|
||||||
|
@ -671,6 +679,10 @@ static int gemm_driver(blas_arg_t *args, BLASLONG *range_m, BLASLONG
|
||||||
free(job);
|
free(job);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef USE_OPENMP
|
||||||
|
pthread_mutex_unlock(&level3_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue