Skip to content

Commit

Permalink
Merge pull request #4308 from martin-frbg/issue4277-2
Browse files Browse the repository at this point in the history
Add workaround for omp_get_max_threads hanging on FreeBSD/LLVM14
  • Loading branch information
martin-frbg authored Nov 12, 2023
2 parents 58427ff + 9324520 commit eef4d15
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions driver/others/blas_server_omp.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,18 @@ void openblas_set_num_threads(int num_threads) {
}

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();

#endif

blas_get_cpu_number();

adjust_thread_buffers();
Expand Down

0 comments on commit eef4d15

Please sign in to comment.