Skip to content

Commit

Permalink
Print system information
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Mar 13, 2023
1 parent ed6849c commit 4497ad8
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,26 @@ void sigint_handler(int signo) {
}
#endif

const char * llama_print_system_info(void) {
static std::string s;

s = "";
s += "AVX = " + std::to_string(ggml_cpu_has_avx()) + " | ";
s += "AVX2 = " + std::to_string(ggml_cpu_has_avx2()) + " | ";
s += "AVX512 = " + std::to_string(ggml_cpu_has_avx512()) + " | ";
s += "FMA = " + std::to_string(ggml_cpu_has_fma()) + " | ";
s += "NEON = " + std::to_string(ggml_cpu_has_neon()) + " | ";
s += "ARM_FMA = " + std::to_string(ggml_cpu_has_arm_fma()) + " | ";
s += "F16C = " + std::to_string(ggml_cpu_has_f16c()) + " | ";
s += "FP16_VA = " + std::to_string(ggml_cpu_has_fp16_va()) + " | ";
s += "WASM_SIMD = " + std::to_string(ggml_cpu_has_wasm_simd()) + " | ";
s += "BLAS = " + std::to_string(ggml_cpu_has_blas()) + " | ";
s += "SSE3 = " + std::to_string(ggml_cpu_has_sse3()) + " | ";
s += "VSX = " + std::to_string(ggml_cpu_has_vsx()) + " | ";

return s.c_str();
}

int main(int argc, char ** argv) {
ggml_time_init();
const int64_t t_main_start_us = ggml_time_us();
Expand Down Expand Up @@ -807,6 +827,13 @@ int main(int argc, char ** argv) {
t_load_us = ggml_time_us() - t_start_us;
}

// print system information
{
fprintf(stderr, "\n");
fprintf(stderr, "system_info: n_threads = %d / %d | %s\n",
params.n_threads, std::thread::hardware_concurrency(), llama_print_system_info());
}

int n_past = 0;

int64_t t_sample_us = 0;
Expand Down Expand Up @@ -834,7 +861,7 @@ int main(int argc, char ** argv) {
struct sigaction sigint_action;
sigint_action.sa_handler = sigint_handler;
sigemptyset (&sigint_action.sa_mask);
sigint_action.sa_flags = 0;
sigint_action.sa_flags = 0;
sigaction(SIGINT, &sigint_action, NULL);
#endif

Expand Down Expand Up @@ -967,7 +994,7 @@ int main(int argc, char ** argv) {
is_interacting = true;
}
if (is_interacting) {
// currently being interactive
// currently being interactive
bool another_line=true;
while (another_line) {
fflush(stdout);
Expand Down Expand Up @@ -999,7 +1026,7 @@ int main(int argc, char ** argv) {
input_noecho = true; // do not echo this again
}

is_interacting = false;
is_interacting = false;
}
}

Expand Down

0 comments on commit 4497ad8

Please sign in to comment.