Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb4c979

Browse files
committed
Enable multi-threading support
1 parent 0c7e6a9 commit bb4c979

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

binding.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ int llama_predict(void *params_ptr, void *state_pr, char *result, bool debug)
142142
{
143143
gpt_params *params_p = (gpt_params *)params_ptr;
144144
llama_context *ctx = (llama_context *)state_pr;
145+
146+
llama_set_n_threads(ctx, params_p->n_threads, params_p->n_threads_batch);
145147

146148
const int n_ctx = llama_n_ctx(ctx);
147149

@@ -631,6 +633,7 @@ void *llama_allocate_params(const char *prompt, int seed, int threads, int token
631633
gpt_params *params = new gpt_params;
632634
params->seed = seed;
633635
params->n_threads = threads;
636+
params->n_threads_batch = threads;
634637
params->n_predict = tokens;
635638
params->repeat_last_n = repeat_last_n;
636639
params->prompt_cache_ro = prompt_cache_ro;

0 commit comments

Comments
 (0)