Browse Source

Use OMP_ADAPTIVE setting to choose between static and dynamic OMP threadpool size

tags/v0.3.21
Martin Kroeker GitHub 3 years ago
parent
commit
80cdfed7b2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      driver/others/blas_server_omp.c

+ 12
- 0
driver/others/blas_server_omp.c View File

@@ -403,6 +403,7 @@ int exec_blas(BLASLONG num, blas_queue_t *queue){
break; break;
} }


if (openblas_omp_adaptive_env() != 0) {
#pragma omp parallel for num_threads(num) schedule(OMP_SCHED) #pragma omp parallel for num_threads(num) schedule(OMP_SCHED)
for (i = 0; i < num; i ++) { for (i = 0; i < num; i ++) {


@@ -412,6 +413,17 @@ int exec_blas(BLASLONG num, blas_queue_t *queue){


exec_threads(&queue[i], buf_index); exec_threads(&queue[i], buf_index);
} }
} else {
#pragma omp parallel for schedule(OMP_SCHED)
for (i = 0; i < num; i ++) {

#ifndef USE_SIMPLE_THREADED_LEVEL3
queue[i].position = i;
#endif

exec_threads(&queue[i], buf_index);
}
}


#ifdef HAVE_C11 #ifdef HAVE_C11
atomic_store(&blas_buffer_inuse[buf_index], false); atomic_store(&blas_buffer_inuse[buf_index], false);


Loading…
Cancel
Save