Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
make: find MacPorts libomp on macOS, in both Darwin probes
Courtney Andrew Richardson833502ce00b9
diff --git a/c/Makefile b/c/Makefileindex 6cfa5cf7..3d81868e 100644--- a/c/Makefile+++ b/c/Makefile@@ -51,6 +51,11 @@ ifneq (,$(DARWIN))# (brew install libomp), altrimenti compila single-thread (i pragma omp sono ignorati).# Niente -march: su arm64 NEON e' baseline (i kernel __ARM_NEON si attivano da soli).CC = clang+# An OMPDIR from the command line survives the assignments below; one from the+# environment would be overwritten by them. Both are the user's choice: record+# that first, and probe nothing for it.+OMP_EXPLICIT := $(filter command line environment,$(origin OMPDIR))+ifeq ($(OMP_EXPLICIT),)OMPDIR := $(shell brew --prefix libomp 2>/dev/null)# CLT-only Macs routinely have Homebrew installed but off the non-interactive# PATH (`make` from scripts, SSH, CI), which turned this probe into a silent@@ -59,13 +64,28 @@ OMPDIR := $(shell brew --prefix libomp 2>/dev/null)ifeq ($(OMPDIR),)OMPDIR := $(firstword $(wildcard /opt/homebrew/opt/libomp /usr/local/opt/libomp))endif+endif# `brew --prefix libomp` can print the formula's prospective path even when it# is not installed, so verify both artifacts before adding unusable flags.ifneq ($(and $(OMPDIR),$(wildcard $(OMPDIR)/include/omp.h),$(wildcard $(OMPDIR)/lib/libomp.*)),)-OMPC = -Xclang -fopenmp -I$(OMPDIR)/include-OMPL = -L$(OMPDIR)/lib -lomp+OMPINC := $(OMPDIR)/include+OMPLIB := $(OMPDIR)/lib+# MacPorts (`port install libomp`) nests both artifacts one level deeper than+# Homebrew -- include/libomp/omp.h and lib/libomp/libomp.dylib -- so no single+# prefix can pass the check above: probe its two directories directly. Not+# when OMPDIR was the user's choice: one that holds no libomp means+# single-threaded (tests/test_makefile_platform.py pins that).+else ifeq ($(OMP_EXPLICIT),)+ifneq ($(and $(wildcard /opt/local/include/libomp/omp.h),$(wildcard /opt/local/lib/libomp/libomp.*)),)+OMPINC := /opt/local/include/libomp+OMPLIB := /opt/local/lib/libomp+endif+endif+ifneq ($(OMPINC),)+OMPC = -Xclang -fopenmp -I$(OMPINC)+OMPL = -L$(OMPLIB) -lompelse-$(warning libomp not found: building single-threaded. For multithreading: brew install libomp)+$(warning libomp not found: building single-threaded. For multithreading: brew install libomp (or port install libomp))OMPC =OMPL =endifdiff --git a/c/Makefile.deepseek-v4 b/c/Makefile.deepseek-v4index 7ac19f46..a7858363 100644--- a/c/Makefile.deepseek-v4+++ b/c/Makefile.deepseek-v4@@ -65,12 +65,30 @@ else ifeq ($(UNAME_S),Darwin)# ignored). No -march: NEON is baseline on arm64 and the per-feature gates in# the sources do the rest. Mirrors the parent Makefile's Darwin block.CC = clang+# An OMPDIR from the command line survives the assignments below; one from the+# environment would be overwritten by them. Both are the user's choice: record+# that first, and probe nothing for it.+OMP_EXPLICIT := $(filter command line environment,$(origin OMPDIR))+ifeq ($(OMP_EXPLICIT),)OMPDIR := $(shell brew --prefix libomp 2>/dev/null)+ifeq ($(OMPDIR),)+OMPDIR := $(firstword $(wildcard /opt/homebrew/opt/libomp /usr/local/opt/libomp))+endif+endififneq ($(and $(OMPDIR),$(wildcard $(OMPDIR)/include/omp.h),$(wildcard $(OMPDIR)/lib/libomp.*)),)-OMPC = -Xclang -fopenmp -I$(OMPDIR)/include-OMPL = -L$(OMPDIR)/lib -lomp+OMPINC := $(OMPDIR)/include+OMPLIB := $(OMPDIR)/lib+else ifeq ($(OMP_EXPLICIT),)+ifneq ($(and $(wildcard /opt/local/include/libomp/omp.h),$(wildcard /opt/local/lib/libomp/libomp.*)),)+OMPINC := /opt/local/include/libomp+OMPLIB := /opt/local/lib/libomp+endif+endif+ifneq ($(OMPINC),)+OMPC = -Xclang -fopenmp -I$(OMPINC)+OMPL = -L$(OMPLIB) -lompelse-$(warning libomp not found: building deepseek_v4 single-threaded. brew install libomp)+$(warning libomp not found: building deepseek_v4 single-threaded. brew install libomp (or port install libomp))OMPC =OMPL =endifdiff --git a/docs/quickstart.md b/docs/quickstart.mdindex 4e183b6a..74f4597d 100644--- a/docs/quickstart.md+++ b/docs/quickstart.md@@ -109,6 +109,7 @@ pacman -S --needed mingw-w64-ucrt-x86_64-gcc make git python```bashxcode-select --install # C compiler (clang)brew install libomp git python # OpenMP for multithreading+# MacPorts works too: sudo port install libomp (the Makefile finds either)```---