Revamp hardware tester to print to stdout the result in single word.

This commit is contained in:
Adam Treat 2023-04-21 07:36:05 -04:00
parent aecac945dd
commit 1beaf3bbbd

View File

@ -5,21 +5,25 @@ int main(int argc, char *argv[])
{ {
static bool avx = __builtin_cpu_supports("avx"); static bool avx = __builtin_cpu_supports("avx");
static bool avx2 = __builtin_cpu_supports("avx2"); static bool avx2 = __builtin_cpu_supports("avx2");
static bool avx512f = __builtin_cpu_supports("avx512f");
static bool avx512vbmi = __builtin_cpu_supports("avx512vbmi");
static bool avx512vnni = __builtin_cpu_supports("avx512vnni");
static bool fma = __builtin_cpu_supports("fma"); static bool fma = __builtin_cpu_supports("fma");
static bool sse3 = __builtin_cpu_supports("sse3"); static bool sse3 = __builtin_cpu_supports("sse3");
static std::string s; static std::string s;
s = "My hardware supports:\n"; s = "gpt4all hardware test results:\n";
s += "AVX = " + std::to_string(avx) + "\n"; s += " AVX = " + std::to_string(avx) + "\n";
s += "AVX2 = " + std::to_string(avx2) + "\n"; s += " AVX2 = " + std::to_string(avx2) + "\n";
s += "AVX512 = " + std::to_string(avx512f) + "\n"; s += " FMA = " + std::to_string(fma) + "\n";
s += "AVX512_VBMI = " + std::to_string(avx512vbmi) + "\n"; s += " SSE3 = " + std::to_string(sse3) + "\n";
s += "AVX512_VNNI = " + std::to_string(avx512vnni) + "\n"; fprintf(stderr, "%s", s.c_str());
s += "FMA = " + std::to_string(fma) + "\n"; fprintf(stderr, "your hardware supports the \"");
s += "SSE3 = " + std::to_string(sse3) + "\n"; fflush(stderr);
printf("%s", s.c_str()); if (avx2)
printf("full");
else if (avx && fma)
printf("avx_only");
else
printf("bare_minimum");
fflush(stdout); fflush(stdout);
fprintf(stderr, "\" version of gpt4all.\n");
fflush(stderr);
return 0; return 0;
} }