Cleanup white spaces.
This commit is contained in:
parent
12130ee961
commit
a922a07e61
|
@ -13,25 +13,25 @@ extern gotoblas_t gotoblas_POWER10;
|
||||||
extern void openblas_warning(int verbose, const char *msg);
|
extern void openblas_warning(int verbose, const char *msg);
|
||||||
|
|
||||||
static char *corename[] = {
|
static char *corename[] = {
|
||||||
"unknown",
|
"unknown",
|
||||||
"POWER6",
|
"POWER6",
|
||||||
"POWER8",
|
"POWER8",
|
||||||
"POWER9",
|
"POWER9",
|
||||||
"POWER10"
|
"POWER10"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_CORETYPES 5
|
#define NUM_CORETYPES 5
|
||||||
|
|
||||||
char *gotoblas_corename(void) {
|
char *gotoblas_corename(void) {
|
||||||
if (gotoblas == &gotoblas_POWER6) return corename[1];
|
if (gotoblas == &gotoblas_POWER6) return corename[1];
|
||||||
if (gotoblas == &gotoblas_POWER8) return corename[2];
|
if (gotoblas == &gotoblas_POWER8) return corename[2];
|
||||||
#if (!defined __GNUC__) || ( __GNUC__ >= 6)
|
#if (!defined __GNUC__) || ( __GNUC__ >= 6)
|
||||||
if (gotoblas == &gotoblas_POWER9) return corename[3];
|
if (gotoblas == &gotoblas_POWER9) return corename[3];
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_P10_SUPPORT
|
#ifdef HAVE_P10_SUPPORT
|
||||||
if (gotoblas == &gotoblas_POWER10) return corename[4];
|
if (gotoblas == &gotoblas_POWER10) return corename[4];
|
||||||
#endif
|
#endif
|
||||||
return corename[0];
|
return corename[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
|
@ -90,13 +90,13 @@ static int __builtin_cpu_supports(char* arg)
|
||||||
|
|
||||||
static gotoblas_t *get_coretype(void) {
|
static gotoblas_t *get_coretype(void) {
|
||||||
|
|
||||||
if (__builtin_cpu_supports("power6"))
|
if (__builtin_cpu_supports("power6"))
|
||||||
return &gotoblas_POWER6;
|
return &gotoblas_POWER6;
|
||||||
if (__builtin_cpu_supports("power8"))
|
if (__builtin_cpu_supports("power8"))
|
||||||
return &gotoblas_POWER8;
|
return &gotoblas_POWER8;
|
||||||
#if (!defined __GNUC__) || ( __GNUC__ >= 6)
|
#if (!defined __GNUC__) || ( __GNUC__ >= 6)
|
||||||
if (__builtin_cpu_supports("power9"))
|
if (__builtin_cpu_supports("power9"))
|
||||||
return &gotoblas_POWER9;
|
return &gotoblas_POWER9;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_P10_SUPPORT
|
#ifdef HAVE_P10_SUPPORT
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
|
@ -104,84 +104,84 @@ static gotoblas_t *get_coretype(void) {
|
||||||
#else
|
#else
|
||||||
if (__builtin_cpu_supports("arch_3_1") && __builtin_cpu_supports("mma"))
|
if (__builtin_cpu_supports("arch_3_1") && __builtin_cpu_supports("mma"))
|
||||||
#endif
|
#endif
|
||||||
return &gotoblas_POWER10;
|
return &gotoblas_POWER10;
|
||||||
#endif
|
#endif
|
||||||
/* Fall back to the POWER9 implementation if the toolchain is too old or the MMA feature is not set */
|
/* Fall back to the POWER9 implementation if the toolchain is too old or the MMA feature is not set */
|
||||||
#if (!defined __GNUC__) || ( __GNUC__ < 11) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2)
|
#if (!defined __GNUC__) || ( __GNUC__ < 11) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2)
|
||||||
if (__builtin_cpu_supports("power10"))
|
if (__builtin_cpu_supports("power10"))
|
||||||
return &gotoblas_POWER9;
|
return &gotoblas_POWER9;
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gotoblas_t *force_coretype(char * coretype) {
|
static gotoblas_t *force_coretype(char * coretype) {
|
||||||
|
|
||||||
int i ;
|
int i ;
|
||||||
int found = -1;
|
int found = -1;
|
||||||
char message[128];
|
char message[128];
|
||||||
|
|
||||||
for ( i = 0 ; i < NUM_CORETYPES; i++)
|
for ( i = 0 ; i < NUM_CORETYPES; i++)
|
||||||
{
|
{
|
||||||
if (!strncasecmp(coretype, corename[i], 20))
|
if (!strncasecmp(coretype, corename[i], 20))
|
||||||
{
|
{
|
||||||
found = i;
|
found = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (found)
|
switch (found)
|
||||||
{
|
{
|
||||||
case 1: return (&gotoblas_POWER6);
|
case 1: return (&gotoblas_POWER6);
|
||||||
case 2: return (&gotoblas_POWER8);
|
case 2: return (&gotoblas_POWER8);
|
||||||
#if (!defined __GNUC__) || ( __GNUC__ >= 6)
|
#if (!defined __GNUC__) || ( __GNUC__ >= 6)
|
||||||
case 3: return (&gotoblas_POWER9);
|
case 3: return (&gotoblas_POWER9);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_P10_SUPPORT
|
#ifdef HAVE_P10_SUPPORT
|
||||||
case 4: return (&gotoblas_POWER10);
|
case 4: return (&gotoblas_POWER10);
|
||||||
#endif
|
#endif
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
}
|
}
|
||||||
snprintf(message, 128, "Core not found: %s\n", coretype);
|
snprintf(message, 128, "Core not found: %s\n", coretype);
|
||||||
openblas_warning(1, message);
|
openblas_warning(1, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gotoblas_dynamic_init(void) {
|
void gotoblas_dynamic_init(void) {
|
||||||
|
|
||||||
char coremsg[128];
|
char coremsg[128];
|
||||||
char coren[22];
|
char coren[22];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
|
||||||
if (gotoblas) return;
|
if (gotoblas) return;
|
||||||
|
|
||||||
p = getenv("OPENBLAS_CORETYPE");
|
p = getenv("OPENBLAS_CORETYPE");
|
||||||
if ( p )
|
if ( p )
|
||||||
{
|
{
|
||||||
gotoblas = force_coretype(p);
|
gotoblas = force_coretype(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gotoblas = get_coretype();
|
gotoblas = get_coretype();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gotoblas == NULL)
|
if (gotoblas == NULL)
|
||||||
{
|
{
|
||||||
snprintf(coremsg, 128, "Falling back to POWER8 core\n");
|
snprintf(coremsg, 128, "Falling back to POWER8 core\n");
|
||||||
openblas_warning(1, coremsg);
|
openblas_warning(1, coremsg);
|
||||||
gotoblas = &gotoblas_POWER8;
|
gotoblas = &gotoblas_POWER8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gotoblas && gotoblas -> init) {
|
if (gotoblas && gotoblas -> init) {
|
||||||
strncpy(coren,gotoblas_corename(),20);
|
strncpy(coren,gotoblas_corename(),20);
|
||||||
sprintf(coremsg, "Core: %s\n",coren);
|
sprintf(coremsg, "Core: %s\n",coren);
|
||||||
openblas_warning(2, coremsg);
|
openblas_warning(2, coremsg);
|
||||||
gotoblas -> init();
|
gotoblas -> init();
|
||||||
} else {
|
} else {
|
||||||
openblas_warning(0, "OpenBLAS : Architecture Initialization failed. No initialization function found.\n");
|
openblas_warning(0, "OpenBLAS : Architecture Initialization failed. No initialization function found.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gotoblas_dynamic_quit(void) {
|
void gotoblas_dynamic_quit(void) {
|
||||||
gotoblas = NULL;
|
gotoblas = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue