Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Fix #3417: the hardware report counts physical cores, so the Work profile no longer asks for more CPU workers than the CPU has cores

Niko1221c6a0e739becc
diff --git a/tools/strata_mcp.py b/tools/strata_mcp.py
index 9993a1858..3ccfe1e2f 100644
--- a/tools/strata_mcp.py
+++ b/tools/strata_mcp.py
@@ -890,9 +890,9 @@ class Strata:
name, avx2, avx512 = S.cpu_info()
else:
name, avx2, avx512 = platform.processor() or "unknown CPU", None, None
- hw["cpu"] = {"name": name, "cores": os.cpu_count(), "avx2": avx2, "avx512": avx512}
+ hw["cpu"] = {"name": name, "cores": physical_cores(), "threads": os.cpu_count(), "avx2": avx2, "avx512": avx512}
except Exception: # noqa: BLE001
- hw["cpu"] = {"name": platform.processor(), "cores": os.cpu_count()}
+ hw["cpu"] = {"name": platform.processor(), "cores": physical_cores(), "threads": os.cpu_count()}
if sys.platform == "darwin": # a Mac: one pool of unified memory, the Metal engine (strata_control/mac_fit.py)
return self._mac_hardware(hw)
nv = []
@@ -1511,6 +1511,19 @@ def install_progress(lines: list[str]) -> dict:
return out
+def physical_cores() -> int | None:
+ """The CPU's physical cores (os.cpu_count() counts logical threads: 16 on an 8-core SMT chip, and the app's Work profile took
+ 80% of that for --pool-workers, more than the cores, #3417). Falls back to the thread count when the machine cannot say."""
+ try:
+ from strata_control import tune_machine
+ n = tune_machine.cpu().get("physical")
+ if isinstance(n, int) and n > 0:
+ return n
+ except Exception: # noqa: BLE001 - a hardware report must never fail on this
+ pass
+ return os.cpu_count()
+
+
def own_ram_gb() -> float:
if WIN:
class MS(ctypes.Structure):
diff --git a/tools/test_strata_mcp.py b/tools/test_strata_mcp.py
index 2cec253b9..8f0c15408 100644
--- a/tools/test_strata_mcp.py
+++ b/tools/test_strata_mcp.py
@@ -653,6 +653,22 @@ class Helpers(unittest.TestCase):
self.assertEqual(r["context"], 32768)
+class PhysicalCores(unittest.TestCase):
+ """#3417: the hardware report's cpu.cores is the physical cores; the Work profile takes 80% of it for --pool-workers."""
+
+ def test_physical_not_logical(self):
+ from strata_control import tune_machine
+ with mock.patch.object(tune_machine, "cpu", return_value={"model": "x", "logical": 16, "physical": 8, "hybrid": False}), mock.patch.object(M.os, "cpu_count", return_value=16):
+ self.assertEqual(M.physical_cores(), 8)
+
+ def test_unknown_falls_back_to_threads(self):
+ from strata_control import tune_machine
+ with mock.patch.object(tune_machine, "cpu", return_value={"physical": None}), mock.patch.object(M.os, "cpu_count", return_value=16):
+ self.assertEqual(M.physical_cores(), 16)
+ with mock.patch.object(tune_machine, "cpu", side_effect=OSError("no")), mock.patch.object(M.os, "cpu_count", return_value=4):
+ self.assertEqual(M.physical_cores(), 4)
+
+
class MacCatalog(unittest.TestCase):
"""A Mac (Apple Silicon): one pool of unified memory, judged by strata_control/mac_fit.py (the rules metal/setup_mac.py uses)."""