Browse Source

Merge pull request #4308 from martin-frbg/issue4277-2

Add workaround for omp_get_max_threads hanging on FreeBSD/LLVM14
tags/v0.3.25^2
Martin Kroeker GitHub 2 years ago
parent
commit
eef4d15369
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      driver/others/blas_server_omp.c

+ 11
- 2
driver/others/blas_server_omp.c View File

@@ -124,9 +124,18 @@ void openblas_set_num_threads(int num_threads) {
} }


int blas_thread_init(void){ int blas_thread_init(void){
if(blas_omp_number_max <= 0)

#if defined(__FreeBSD__) && defined(__clang__)
extern int openblas_omp_num_threads_env();

if(blas_omp_number_max <= 0)
blas_omp_number_max= openblas_omp_num_threads_env();
if (blas_omp_number_max <= 0)
blas_omp_number_max=MAX_CPU_NUMBER;
#else
blas_omp_number_max = omp_get_max_threads(); blas_omp_number_max = omp_get_max_threads();
#endif

blas_get_cpu_number(); blas_get_cpu_number();


adjust_thread_buffers(); adjust_thread_buffers();


Loading…
Cancel
Save