interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / mk / reservoir.mk

60 lines · 3617 bytes Raw Blame History
1# omega#440 ionic-droplet reservoir, Gate 1 & Gate 2 (docs/reservoir/RESERVOIR_REFERENCE.md):
2# Pure seeded OM-2 CPU simulator of the droplet-network model of Armendarez et al.
3# (Sci. Adv. 2026) plus binary64 ridge readout, tests, and Gate 2 CLI tool.
4# Picked up by `-include mk/*.mk`; not part of `all` or `test`.
5# CPU only: opens no device, no CUDA, never touches the GB10.
6#
7# test-reservoir purity check on src/reservoir/reservoir.om, then builds and
8# runs test_reservoir, test_res_mat, and res_qualify via
9# seed/out/omc (checking docs/reservoir/gate2_config.json)
10# reservoir-purity src/reservoir/reservoir.om contains no allocator, host I/O,
11# socket, device, clock, or process words (after stripping
12# OM-2 `note` comments)
13# qualify-reservoir RES_ARCHIVE=<unpacked project-zenodo-ready_with-paper dir>
14# [RES_V2_RESULTS=<v2 results .mat>]: runs qualify_reservoir.sh
15ifndef RESERVOIR_MK
16RESERVOIR_MK := 1
17.PHONY: test-reservoir test-res-mat reservoir-purity qualify-reservoir
18
19RES_OMC ?= seed/out/omc
20OUT_DIR ?= build
21RES_DIR = $(OUT_DIR)/tests-reservoir
22RES_CORE_OM = src/reservoir/reservoir.om
23RES_MAT_OM = tools/reservoir/res_inflate.om tools/reservoir/res_mat.om
24RES_TOOL_OM = $(RES_MAT_OM) tools/reservoir/res_common.om tools/reservoir/res_bench.om tools/reservoir/res_qualify.om
25RES_TEST_OM = tests/reservoir/test_reservoir.om
26RES_MAT_TEST_OM = tests/reservoir/test_res_mat.om
27
28# Forbidden host / allocator / I/O / device / clock / process words in pure reservoir.om
29RES_FORBIDDEN_OM = '\b(enlarge|fopen|fclose|read|write|fseek|ftell|unlink|rename|mkdir|rmdir|stat|lstat|fork|execprog|execenv|execpure|waitpid|kill|socknew|sockbind|sockconn|socklisten|sockaccept|devctl|mapnew|mapfree|monons|realns|sleepns|random|argcnt|argread|envcnt|envread|cpuset|cpuget|cpunow|setprio|getprio)\b'
30
31reservoir-purity: $(RES_CORE_OM)
32 @if sed -E '/^[[:space:]]*note([[:space:]].*)?$$/d' $(RES_CORE_OM) | grep -En $(RES_FORBIDDEN_OM) ; then \
33 echo "reservoir-purity: $(RES_CORE_OM) references a forbidden host/allocator/I/O/process word"; exit 1; fi
34 @echo "reservoir-purity: $(RES_CORE_OM) is 100% pure seeded OM-2 (zero host/alloc/I/O/process words)"
35
36$(RES_DIR)/test_reservoir: $(RES_CORE_OM) $(RES_TEST_OM) $(RES_OMC)
37 @mkdir -p $(RES_DIR)
38 cat $(RES_CORE_OM) $(RES_TEST_OM) | $(RES_OMC) > $@.tmp.$$$$ && chmod +x $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@ || { rm -f $@.tmp.$$$$; exit 1; }
39
40$(RES_DIR)/test_res_mat: $(RES_CORE_OM) $(RES_MAT_OM) $(RES_MAT_TEST_OM) $(RES_OMC)
41 @mkdir -p $(RES_DIR)
42 cat $(RES_CORE_OM) $(RES_MAT_OM) $(RES_MAT_TEST_OM) | $(RES_OMC) > $@.tmp.$$$$ && chmod +x $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@ || { rm -f $@.tmp.$$$$; exit 1; }
43
44$(RES_DIR)/res_qualify: $(RES_CORE_OM) $(RES_TOOL_OM) $(RES_OMC)
45 @mkdir -p $(RES_DIR)
46 cat $(RES_CORE_OM) $(RES_TOOL_OM) | $(RES_OMC) > $@.tmp.$$$$ && chmod +x $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@ || { rm -f $@.tmp.$$$$; exit 1; }
47
48test-res-mat: $(RES_DIR)/test_res_mat
49 $(RES_DIR)/test_res_mat
50
51test-reservoir: reservoir-purity $(RES_DIR)/test_reservoir $(RES_DIR)/test_res_mat $(RES_DIR)/res_qualify
52 $(RES_DIR)/test_reservoir
53 $(RES_DIR)/test_res_mat
54 $(RES_DIR)/res_qualify config | cmp - docs/reservoir/gate2_config.json
55 @echo "test-reservoir: pure OM-2 reservoir checks pass; Gate 2 config unchanged"
56
57qualify-reservoir:
58 @test -n "$(RES_ARCHIVE)" || { echo "qualify-reservoir: set RES_ARCHIVE=<unpacked project-zenodo-ready_with-paper dir>"; exit 2; }
59 RES_ARCHIVE="$(RES_ARCHIVE)" RES_V2_RESULTS="$(RES_V2_RESULTS)" tools/reservoir/qualify_reservoir.sh
60endif