Skip to content

Commit cfa9392

Browse files
committed
Fix openblas_get_num_threads and openblas_get_num_procs bug with single thread.
1 parent 1ccd57c commit cfa9392

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

driver/others/memory.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,6 @@ void set_stack_limit(int limitMB){
241241
*/
242242
#endif
243243

244-
int openblas_get_num_procs(void) {
245-
return get_num_procs();
246-
}
247244

248245
/*
249246
OpenBLAS uses the numbers of CPU cores in multithreading.
@@ -327,8 +324,21 @@ int blas_get_cpu_number(void){
327324
}
328325
#endif
329326

327+
328+
int openblas_get_num_procs(void) {
329+
#ifndef SMP
330+
return 1;
331+
#else
332+
return get_num_procs();
333+
#endif
334+
}
335+
330336
int openblas_get_num_threads(void) {
337+
#ifndef SMP
338+
return 1;
339+
#else
331340
return blas_get_cpu_number();
341+
#endif
332342
}
333343

334344
struct release_t {

0 commit comments

Comments
 (0)