]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : print timings on ctrl+c exit (#1021)
authorwbpxre150 <redacted>
Sat, 22 Apr 2023 08:56:35 +0000 (16:56 +0800)
committerGitHub <redacted>
Sat, 22 Apr 2023 08:56:35 +0000 (11:56 +0300)
* print timings on ctrl+c exit

* remove redundant free memory call.

* add global pointer to ctx.

examples/main/main.cpp

index 65db792631f36ab0b9fc28545d7a437543a1a9aa..6d79a7e6fed35fe4bbc5e9761b71761e2cf22b74 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 static console_state con_st;
+static llama_context ** g_ctx;
 
 static bool is_interacting = false;
 
@@ -36,6 +37,7 @@ void sigint_handler(int signo) {
         if (!is_interacting) {
             is_interacting=true;
         } else {
+            llama_print_timings(*g_ctx);
             _exit(130);
         }
     }
@@ -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
     {