llama_set_threads: Set the number of threads for a context

View source: R/llama.R

llama_set_threadsR Documentation

Set the number of threads for a context

Description

Set the number of threads for a context

Usage

llama_set_threads(ctx, n_threads, n_threads_batch = n_threads)

Arguments

ctx

Context handle returned by [llama_new_context]

n_threads

Number of threads for single-token generation

n_threads_batch

Number of threads for batch processing (prompt encoding). Defaults to the same value as n_threads.

Value

No return value, called for side effects.

Examples

## Not run: 
model <- llama_load_model("model.gguf")
ctx <- llama_new_context(model)
llama_set_threads(ctx, n_threads = 8L)

## End(Not run)

llamaR documentation built on May 28, 2026, 1:06 a.m.