We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe5d3ca commit 9f9d001Copy full SHA for 9f9d001
1 file changed
common_thread.h
@@ -53,6 +53,7 @@ extern void goto_set_num_threads(int nthreads);
53
/* Global Parameter */
54
extern int blas_cpu_number;
55
extern int blas_num_threads;
56
+extern int blas_num_threads_set;
57
extern int blas_omp_linked;
58
59
#define BLAS_LEGACY 0x8000U
@@ -137,9 +138,13 @@ typedef struct blas_queue {
137
138
extern int blas_server_avail;
139
140
static __inline int num_cpu_avail(int level) {
141
+int openmp_nthreads;
142
143
#ifdef USE_OPENMP
- int openmp_nthreads=omp_get_max_threads();
144
+ if (blas_num_threads_set == 0)
145
+ openmp_nthreads=omp_get_max_threads();
146
+ else
147
+ openmp_nthreads=blas_cpu_number;
148
#endif
149
150
#ifndef USE_OPENMP
0 commit comments