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
omega-mv / mk / turing_yield_energy.mk
| 1 | # TURING Yield TY-4/TY-5: energy measurement reuse and concurrent attribution. |
| 2 | # docs/turing/TURING_YIELD_ENERGY_PROTOCOL_V0.md |
| 3 | # |
| 4 | # Picked up by the top-level `-include mk/*.mk` (no Makefile edit). This file is |
| 5 | # read before most of the Makefile, so it uses only its own variables plus |
| 6 | # CC and OUT_DIR (both set before the include). |
| 7 | # |
| 8 | # Targets: |
| 9 | # test-turing-energy hostile tests, plain + ASan/UBSan; no meter, no timing, |
| 10 | # runs in CI on recorded fixtures (tests/turing/fixtures/ty_energy) |
| 11 | # ty-energy-tools the workload, window tool and reducer |
| 12 | # ty-energy-run the timed stage 1 + stage 2 run, detached (setsid nohup); |
| 13 | # waits for an idle machine and holds its own quiet flag |
| 14 | ifndef TURING_YIELD_ENERGY_MK |
| 15 | TURING_YIELD_ENERGY_MK := 1 |
| 16 | |
| 17 | TYE_DIR = $(OUT_DIR)/ty |
| 18 | TYE_CFLAGS = -std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -O2 -Isrc -Itests/runtime |
| 19 | # -Wno-pedantic: generated binding src/omega_om_units.c uses GNU range designators; see mk/estimation.mk. |
| 20 | TYE_LIB_CFLAGS = -std=c11 -Wall -Wextra -Werror -pedantic -O2 -Isrc -Wno-pedantic |
| 21 | TYE_ARCH = -march=armv8.6-a+dotprod+i8mm+sve |
| 22 | TYE_ASAN = -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all |
| 23 | TYE_ALG_SRCS = src/algebra/realize_common.c src/algebra/realize_binary.c src/algebra/realize_bitplane.c \ |
| 24 | src/algebra/realize_sparse.c src/algebra/realize_rns.c src/algebra/realize_dense.c |
| 25 | TYE_OM_LIB = src/turing/ty_energy.om |
| 26 | TYE_WORKLOAD = $(TYE_DIR)/ty_workload |
| 27 | TYE_WINDOW = $(TYE_DIR)/ty_energy_window |
| 28 | TYE_REDUCE = $(TYE_DIR)/ty_energy_reduce |
| 29 | TYE_TEST = $(TYE_DIR)/test_ty_energy |
| 30 | TYE_FIXTURE = $(TYE_DIR)/ty_energy_fixture |
| 31 | |
| 32 | $(TYE_WORKLOAD): tests/turing/ty_workload.c tests/runtime/r15_measure.c tests/runtime/r15_measure.h $(TYE_ALG_SRCS) src/algebra/realize_common.h |
| 33 | @mkdir -p $(dir $@) |
| 34 | $(CC) $(TYE_CFLAGS) $(TYE_ARCH) -o $@ tests/turing/ty_workload.c tests/runtime/r15_measure.c $(TYE_ALG_SRCS) -lpthread -ldl |
| 35 | |
| 36 | $(TYE_WINDOW): tests/turing/ty_energy_window.c tests/runtime/r15_measure.c tests/runtime/r15_measure.h |
| 37 | @mkdir -p $(dir $@) |
| 38 | $(CC) $(TYE_CFLAGS) -o $@ tests/turing/ty_energy_window.c tests/runtime/r15_measure.c -lpthread -ldl |
| 39 | |
| 40 | $(TYE_REDUCE): $(TYE_OM_LIB) tools/ty_energy_reduce.om seed/out/omc |
| 41 | @mkdir -p $(dir $@) |
| 42 | cat $(TYE_OM_LIB) tools/ty_energy_reduce.om | seed/out/omc > $@ && chmod +x $@ |
| 43 | |
| 44 | $(TYE_TEST): $(TYE_OM_LIB) tests/turing/test_ty_energy.om seed/out/omc |
| 45 | @mkdir -p $(dir $@) |
| 46 | cat $(TYE_OM_LIB) tests/turing/test_ty_energy.om | seed/out/omc > $@ && chmod +x $@ |
| 47 | |
| 48 | .PHONY: test-turing-energy ty-energy-tools ty-energy-run |
| 49 | $(TYE_FIXTURE): tests/turing/ty_energy_fixture.om seed/out/omc |
| 50 | @mkdir -p $(dir $@) |
| 51 | seed/out/omc < $< > $@ && chmod +x $@ |
| 52 | |
| 53 | ty-energy-tools: $(TYE_WORKLOAD) $(TYE_WINDOW) $(TYE_REDUCE) |
| 54 | |
| 55 | test-turing-energy: $(TYE_TEST) $(TYE_REDUCE) $(TYE_FIXTURE) |
| 56 | ./$(TYE_TEST) |
| 57 | sh tests/turing/test_ty_energy_fixtures.sh ./$(TYE_REDUCE) $(TYE_DIR)/fixtures ./$(TYE_FIXTURE) |
| 58 | |
| 59 | TYE_RUN_ID ?= $(shell date -u +%Y%m%dT%H%M%SZ) |
| 60 | ty-energy-run: ty-energy-tools |
| 61 | @mkdir -p evidence/TURING_YIELD/energy/$(TYE_RUN_ID) |
| 62 | setsid nohup sh tools/ty_energy_run.sh all evidence/TURING_YIELD/energy/$(TYE_RUN_ID) $(TYE_DIR) \ |
| 63 | > evidence/TURING_YIELD/energy/$(TYE_RUN_ID)/run.log 2>&1 < /dev/null & |
| 64 | @echo "detached: evidence/TURING_YIELD/energy/$(TYE_RUN_ID)/run.log" |
| 65 | |
| 66 | endif |