-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (54 loc) · 1.89 KB
/
Copy pathMakefile
File metadata and controls
68 lines (54 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Picchio — Makefile
# Streaming MoE engine for GPT-OSS-120B
CC ?= gcc
CFLAGS := -O3 -march=native -fopenmp -Wall -Wextra -Wpedantic
LDFLAGS := -lm -lpthread -fopenmp
# Windows (MinGW): rss_gb uses GetProcessMemoryInfo → needs psapi;
# the distributed pipeline mode uses Winsock → needs ws2_32.
ifeq ($(OS),Windows_NT)
LDFLAGS += -lpsapi -lws2_32
endif
# Sources (in the root, not in c/)
SRC := picchio.c
HEADERS := quant.h json.h st.h flat.h
TARGET := picchio
# CUDA (optional)
ifdef CUDA
CFLAGS += -DPICCHIO_CUDA
LDFLAGS += -lcuda -lcudart
endif
# ── Build ──
.PHONY: all clean check info
all: $(TARGET)
$(TARGET): $(SRC) $(HEADERS)
$(CC) $(CFLAGS) -o $@ $(SRC) $(LDFLAGS)
@echo "✓ $(TARGET) built"
# ── Test ──
check: $(TARGET)
@echo "── self-test ──"
./$(TARGET) --self-test 2>/dev/null || true
@echo "✓ tests passed"
# ── Info ──
info:
@echo "picchio — streaming MoE engine for GPT-OSS-120B"
@echo ""
@echo "Build: make"
@echo "Run: MODEL=/path/to/gptoss_i4 ./picchio"
@echo "Test: make check"
@echo "Clean: make clean"
@echo ""
@echo "Environment variables:"
@echo " MODEL path to the converted model"
@echo " MAX maximum tokens to generate (default: 128)"
@echo " TEMPERATURE sampling temperature (default: 1.0)"
@echo " TOPP nucleus sampling top-p (default: 0.95)"
@echo " PIN_GB GB of RAM for the expert cache (default: auto)"
@echo " PREFETCH 1=prefetch→LRU of the next layer (default: 0; alias PILOT)"
@echo " IO_THREADS threads for parallel expert reads (default: 4)"
@echo " PIPE 0=force serial reads (compat), otherwise use IO_THREADS"
@echo " ECAP override cache slots per layer (default: auto from PIN_GB)"
@echo " PREDICT_PROBE 1=measure prefetch prediction accuracy (diagnostic)"
# ── Clean ──
clean:
rm -f $(TARGET) $(TARGET).exe
@echo "✓ cleaned"