Skip to content

Commit

Permalink
llama : print timings on ctrl+c exit (#1021)
Browse files Browse the repository at this point in the history
* print timings on ctrl+c exit

* remove redundant free memory call.

* add global pointer to ctx.
  • Loading branch information
wbpxre150 authored Apr 22, 2023
1 parent 10f19c1 commit 36b4f7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#endif

static console_state con_st;
static llama_context ** g_ctx;

static bool is_interacting = false;

Expand All @@ -36,6 +37,7 @@ void sigint_handler(int signo) {
if (!is_interacting) {
is_interacting=true;
} else {
llama_print_timings(*g_ctx);
_exit(130);
}
}
Expand Down Expand Up @@ -92,8 +94,9 @@ int main(int argc, char ** argv) {

// params.prompt = R"(// this function checks if the number n is prime
//bool is_prime(int n) {)";

llama_context * ctx;
g_ctx = &ctx;

// load the model
{
Expand Down

0 comments on commit 36b4f7e

Please sign in to comment.