Skip to content

Commit 41ae8e8

Browse files
authored
Add threading and OpenMP information to output
For #1416 and #1529, more information about the options OpenBLAS was built with is needed. Additionally we may want to add this data to the openblas.pc file (but not all projects use pkgconfig, and as far as I am aware the cmake module for accessing it does not make such "private" declarations available)
1 parent 88e224f commit 41ae8e8

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

driver/others/openblas_get_config.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,33 @@ static char* openblas_config_str=""
5454
#ifdef NO_AFFINITY
5555
"NO_AFFINITY "
5656
#endif
57+
#ifdef USE_OPENMP
58+
"USE_OPENMP "
59+
#endif
5760
#ifndef DYNAMIC_ARCH
5861
CHAR_CORENAME
5962
#endif
6063
;
6164

6265
#ifdef DYNAMIC_ARCH
6366
char *gotoblas_corename();
64-
static char tmp_config_str[256];
6567
#endif
6668

69+
static char tmp_config_str[256];
70+
int openblas_get_parallel();
6771

6872
char* CNAME() {
69-
#ifndef DYNAMIC_ARCH
70-
return openblas_config_str;
71-
#else
73+
char tmpstr[20];
7274
strcpy(tmp_config_str, openblas_config_str);
75+
#ifdef DYNAMIC_ARCH
7376
strcat(tmp_config_str, gotoblas_corename());
74-
return tmp_config_str;
7577
#endif
78+
if (openblas_get_parallel() == 0)
79+
sprintf(tmpstr, " SINGLE_THREADED");
80+
else
81+
snprintf(tmpstr,19," MAX_THREADS=%d",MAX_CPU_NUMBER);
82+
strcat(tmp_config_str, tmpstr);
83+
return tmp_config_str;
7684
}
7785

7886

@@ -83,3 +91,4 @@ char* openblas_get_corename() {
8391
return gotoblas_corename();
8492
#endif
8593
}
94+

0 commit comments

Comments
 (0)