Skip to content

Fix OpenMP builds defaulting to singlethreading with OMP_PLACES or OMP_PROC_BIND set #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions common_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@ extern int blas_server_avail;
static __inline int num_cpu_avail(int level) {

#ifdef USE_OPENMP
int openmp_nthreads=0;
int openmp_nthreads=omp_get_max_threads();
#endif

#ifndef USE_OPENMP
if (blas_cpu_number == 1

#endif
#ifdef USE_OPENMP
|| omp_in_parallel()
if (openmp_nthreads == 1 || omp_in_parallel()
#endif
) return 1;
) return 1;

#ifdef USE_OPENMP
openmp_nthreads=omp_get_max_threads();
if (blas_cpu_number != openmp_nthreads) {
goto_set_num_threads(openmp_nthreads);
}
Expand Down