Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

fix(omp): size direct Inkling runs by physical cores

Blake353638d95cee
diff --git a/c/inkling.c b/c/inkling.c
index 3a15b7be..5066d942 100644
--- a/c/inkling.c
+++ b/c/inkling.c
@@ -33,6 +33,10 @@
#endif
#include "st.h"
#include "tok.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+#include "omp_tune.h"
#include "route_trace.h"
#include "kv_prefix.h" /* KV prefix reuse (shared) */ /* shared routing telemetry (#700) */
#ifdef COLI_CUDA
@@ -2058,6 +2062,7 @@ int main(int argc, char **argv) {
#endif
}
#endif /* !COLI_CUDA && !__APPLE__ */
+ coli_omp_tune_threads("inkling");
const char *snap = getenv("SNAP");
if (!snap) { fprintf(stderr, "set SNAP=<snapshot directory>\n"); return 1; }
g_topp = getenv("TOPP") ? (float)atof(getenv("TOPP")) : 0.f;
diff --git a/c/tests/test_inkling_omp_source.py b/c/tests/test_inkling_omp_source.py
new file mode 100644
index 00000000..f98ef3b8
--- /dev/null
+++ b/c/tests/test_inkling_omp_source.py
@@ -0,0 +1,18 @@
+import unittest
+from pathlib import Path
+
+
+ROOT = Path(__file__).resolve().parent.parent
+
+
+class InklingOpenMPWiringTest(unittest.TestCase):
+ def test_direct_engine_uses_shared_physical_core_sizing(self):
+ source = (ROOT / "inkling.c").read_text(encoding="utf-8")
+ self.assertTrue('#include "omp_tune.h"' in source,
+ "inkling.c does not include the shared OpenMP sizing helper")
+ self.assertTrue('coli_omp_tune_threads("inkling")' in source,
+ "Inkling direct execution does not size its OpenMP team")
+
+
+if __name__ == "__main__":
+ unittest.main()