Skip to content

Commit 4497ad8

Browse files
committed
Print system information
1 parent ed6849c commit 4497ad8

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

main.cpp

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,26 @@ void sigint_handler(int signo) {
765765
}
766766
#endif
767767

768+
const char * llama_print_system_info(void) {
769+
static std::string s;
770+
771+
s = "";
772+
s += "AVX = " + std::to_string(ggml_cpu_has_avx()) + " | ";
773+
s += "AVX2 = " + std::to_string(ggml_cpu_has_avx2()) + " | ";
774+
s += "AVX512 = " + std::to_string(ggml_cpu_has_avx512()) + " | ";
775+
s += "FMA = " + std::to_string(ggml_cpu_has_fma()) + " | ";
776+
s += "NEON = " + std::to_string(ggml_cpu_has_neon()) + " | ";
777+
s += "ARM_FMA = " + std::to_string(ggml_cpu_has_arm_fma()) + " | ";
778+
s += "F16C = " + std::to_string(ggml_cpu_has_f16c()) + " | ";
779+
s += "FP16_VA = " + std::to_string(ggml_cpu_has_fp16_va()) + " | ";
780+
s += "WASM_SIMD = " + std::to_string(ggml_cpu_has_wasm_simd()) + " | ";
781+
s += "BLAS = " + std::to_string(ggml_cpu_has_blas()) + " | ";
782+
s += "SSE3 = " + std::to_string(ggml_cpu_has_sse3()) + " | ";
783+
s += "VSX = " + std::to_string(ggml_cpu_has_vsx()) + " | ";
784+
785+
return s.c_str();
786+
}
787+
768788
int main(int argc, char ** argv) {
769789
ggml_time_init();
770790
const int64_t t_main_start_us = ggml_time_us();
@@ -807,6 +827,13 @@ int main(int argc, char ** argv) {
807827
t_load_us = ggml_time_us() - t_start_us;
808828
}
809829

830+
// print system information
831+
{
832+
fprintf(stderr, "\n");
833+
fprintf(stderr, "system_info: n_threads = %d / %d | %s\n",
834+
params.n_threads, std::thread::hardware_concurrency(), llama_print_system_info());
835+
}
836+
810837
int n_past = 0;
811838

812839
int64_t t_sample_us = 0;
@@ -834,7 +861,7 @@ int main(int argc, char ** argv) {
834861
struct sigaction sigint_action;
835862
sigint_action.sa_handler = sigint_handler;
836863
sigemptyset (&sigint_action.sa_mask);
837-
sigint_action.sa_flags = 0;
864+
sigint_action.sa_flags = 0;
838865
sigaction(SIGINT, &sigint_action, NULL);
839866
#endif
840867

@@ -967,7 +994,7 @@ int main(int argc, char ** argv) {
967994
is_interacting = true;
968995
}
969996
if (is_interacting) {
970-
// currently being interactive
997+
// currently being interactive
971998
bool another_line=true;
972999
while (another_line) {
9731000
fflush(stdout);
@@ -999,7 +1026,7 @@ int main(int argc, char ** argv) {
9991026
input_noecho = true; // do not echo this again
10001027
}
10011028

1002-
is_interacting = false;
1029+
is_interacting = false;
10031030
}
10041031
}
10051032

0 commit comments

Comments
 (0)