setNumThreads

fun setNumThreads(nThreads: Int)

Sets the CPU thread count before openModelFile. The default is 0 when this method is not called. On Android, automatic selection uses performance (big/prime) cores, falling back to the existing core-count heuristic when topology is unavailable. Target decode/prefill, assistant and VLM/ALM CPU inference threads share this value.

Parameters

nThreads

Thread count (0 selects automatically)

Throws

if nThreads is negative

if the model is already open or the operation fails