]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml : add GGML_DEFAULT_N_THREADS
authorGeorgi Gerganov <redacted>
Thu, 13 Apr 2023 15:36:40 +0000 (18:36 +0300)
committerGeorgi Gerganov <redacted>
Thu, 13 Apr 2023 15:36:48 +0000 (18:36 +0300)
ggml.c
ggml.h

diff --git a/ggml.c b/ggml.c
index b6a24b40c52fc6b239dbc643df5e894d2bb698da..42e3ee314424d5f8dada77990a03c79ef24b6c58 100644 (file)
--- a/ggml.c
+++ b/ggml.c
@@ -9363,7 +9363,7 @@ struct ggml_cgraph ggml_build_forward(struct ggml_tensor * tensor) {
     struct ggml_cgraph result = {
         /*.n_nodes      =*/ 0,
         /*.n_leafs      =*/ 0,
-        /*.n_threads    =*/ 0,
+        /*.n_threads    =*/ GGML_DEFAULT_N_THREADS,
         /*.work_size    =*/ 0,
         /*.work         =*/ NULL,
         /*.nodes        =*/ { NULL },
@@ -9983,8 +9983,8 @@ void ggml_graph_print(const struct ggml_cgraph * cgraph) {
 
     GGML_PRINT("=== GRAPH ===\n");
 
-    GGML_PRINT_DEBUG("n_threads       = %d\n",       cgraph->n_threads);
-    GGML_PRINT_DEBUG("total work size = %zu bytes\n",cgraph->work_size);
+    GGML_PRINT_DEBUG("n_threads       = %d\n",        cgraph->n_threads);
+    GGML_PRINT_DEBUG("total work size = %zu bytes\n", cgraph->work_size);
 
     GGML_PRINT("n_nodes = %d\n", cgraph->n_nodes);
     for (int i = 0; i < cgraph->n_nodes; i++) {
diff --git a/ggml.h b/ggml.h
index 7d8b7a1829dd0110aa9182866dbe19830658d6f5..c06c09e060db5ee127465e4b993e839300bb7be4 100644 (file)
--- a/ggml.h
+++ b/ggml.h
@@ -177,11 +177,12 @@ extern "C" {
 #include <stddef.h>
 #include <stdbool.h>
 
-#define GGML_MAX_DIMS     4
-#define GGML_MAX_NODES    4096
-#define GGML_MAX_PARAMS   16
-#define GGML_MAX_CONTEXTS 64
-#define GGML_MAX_OPT      4
+#define GGML_MAX_DIMS          4
+#define GGML_MAX_NODES         4096
+#define GGML_MAX_PARAMS        16
+#define GGML_MAX_CONTEXTS      64
+#define GGML_MAX_OPT           4
+#define GGML_DEFAULT_N_THREADS 4
 
 #ifdef __ARM_NEON
 // we use the built-in 16-bit float type