wren runs its model on one BLAS thread

threadpoolctl scopes the limit to wren.act, so other numpy calls in the
engine keep their threads.
This commit is contained in:
2026-10-15 09:55:02 +02:00
parent f2a823218a
commit 5e5f1836cb
4 changed files with 48 additions and 1 deletions
+6 -1
View File
@@ -14,6 +14,7 @@ from collections.abc import Iterable
from typing import Any
from pydantic import BaseModel, ConfigDict, Field
from threadpoolctl import threadpool_limits
from fluksio.flow.messages import DType, MessageSpec
from fluksio.flow.nodes.base import Node
@@ -306,7 +307,11 @@ class WrenNode(Node):
wren = _wren()
specs = {spec.port: spec for spec in self.output_ports}
house = self._house(wren, specs, presence, outdoor, dark)
calls, confidence = wren.act(prompt, house)
# One BLAS thread answers in about half the time for a model this
# small. Scoped to the call, so numpy elsewhere in the process keeps
# its threads.
with threadpool_limits(1):
calls, confidence = wren.act(prompt, house)
confidence = round(float(confidence), 3)
write = self.cfg.apply and confidence >= self.cfg.min_confidence
writes: dict[str, Any] = {}