diff --git a/.claude/worktrees/agent-a7b0eac1 b/.claude/worktrees/agent-a7b0eac1 new file mode 160000 index 0000000..7b7a79a --- /dev/null +++ b/.claude/worktrees/agent-a7b0eac1 @@ -0,0 +1 @@ +Subproject commit 7b7a79a98fcb2ec0e0a72ab34028cdaba4e22480 diff --git a/Makefile b/Makefile index 8416f23..ba63c13 100644 --- a/Makefile +++ b/Makefile @@ -189,12 +189,18 @@ friction: c-build asm-build # ─── GPU worker (bend primitive) ───────────────────────────────── # # Builds the cuda-fanout leaf binary & launches gpu-worker.lsp on -# port 9091 (override via PORT=NNNN). Client tier choice via +# port 8320 (override via PORT=NNNN). Client tier choice via # LUMBDA=python|c|asm (default python). Once running, any tier can # (bend …) to it from the same host or another LAN host. +# +# Port mnemonic — 8320 = BEND: +# 8 ~= B (implied infinity B flattened; bake a cake; baby & me) +# 3 ~= E (backward) +# 2 ~= N (pivoted 90 degrees) +# 0 ~= D (flattened) GPU_WORKER_DIR := examples/cuda-fanout -PORT ?= 9091 +PORT ?= 8320 LUMBDA ?= c gpu-worker-bin: diff --git a/asm/lumbda b/asm/lumbda index 49491e5..1e247a5 100755 Binary files a/asm/lumbda and b/asm/lumbda differ diff --git a/asm/lumbda-full b/asm/lumbda-full index 3ce784a..0269be7 100755 Binary files a/asm/lumbda-full and b/asm/lumbda-full differ diff --git a/asm/lumbda-full.o b/asm/lumbda-full.o index 532bbe3..a23b041 100644 Binary files a/asm/lumbda-full.o and b/asm/lumbda-full.o differ diff --git a/asm/lumbda-gc b/asm/lumbda-gc index b0688c6..3045e48 100755 Binary files a/asm/lumbda-gc and b/asm/lumbda-gc differ diff --git a/asm/lumbda-gc.o b/asm/lumbda-gc.o index 2b90073..eca1b6d 100644 Binary files a/asm/lumbda-gc.o and b/asm/lumbda-gc.o differ diff --git a/asm/lumbda.o b/asm/lumbda.o index 913a67f..9f16e3b 100644 Binary files a/asm/lumbda.o and b/asm/lumbda.o differ diff --git a/examples/cuda-fanout/README.md b/examples/cuda-fanout/README.md index 64a6393..2535654 100644 --- a/examples/cuda-fanout/README.md +++ b/examples/cuda-fanout/README.md @@ -89,7 +89,7 @@ needed: cd examples/cuda-fanout python3 -u ../../lumbda.py /tmp/launch-worker.lsp # → gpu-worker: ready cuda-shake-fanout ← ./shake256-fanout - # → gpu-worker listening on port 9091 + # → gpu-worker listening on port 8320 (BEND mnemonic — see below) # In another shell, drive via bend!: python3 ../../lumbda.py smoke-bend.lsp diff --git a/examples/cuda-fanout/bench_tiers.py b/examples/cuda-fanout/bench_tiers.py index 3a3420e..e61e769 100644 --- a/examples/cuda-fanout/bench_tiers.py +++ b/examples/cuda-fanout/bench_tiers.py @@ -39,9 +39,15 @@ TIERS = { "launch.lsp", "--port", ], # asm tier launch uses a separate file that pre-defines *argv* - # (asm doesn't auto-bind it). Port is fixed to 9091 — asm tier + # (asm doesn't auto-bind it). Port is fixed to 8320 — asm tier # also doesn't parse --port, so each asm bench uses its own # binary launch. + # + # Port mnemonic — 8320 = BEND: + # 8 ~= B (implied infinity B flattened; bake a cake; baby & me) + # 3 ~= E (backward) + # 2 ~= N (pivoted 90 degrees) + # 0 ~= D (flattened) "asm": [ os.path.join(LUMBDA_ROOT, "asm", "lumbda-gc"), "launch-asm.lsp", @@ -260,9 +266,9 @@ def main(): all_results = {} for i, tier in enumerate(tiers): - # asm tier hard-codes port 9091 (no --port parsing); run it - # last so other tiers get unique ports. - port = 9091 if tier == "asm" else (9090 + i + 1) + # asm tier hard-codes port 8320 (BEND, no --port parsing); run + # it last so other tiers get unique ports. + port = 8320 if tier == "asm" else (9090 + i + 1) try: all_results[tier] = bench_tier(tier, port, configs, binary=args.binary) except Exception as e: diff --git a/examples/cuda-fanout/bend.lsp b/examples/cuda-fanout/bend.lsp index ee1e846..610d470 100644 --- a/examples/cuda-fanout/bend.lsp +++ b/examples/cuda-fanout/bend.lsp @@ -71,9 +71,14 @@ ;;; -- worker endpoint ------------------------------------------- (define *bend-worker-host* "127.0.0.1") -(define *bend-worker-port* 9091) +;; Port 8320 — BEND mnemonic: +;; 8 ~= B (implied infinity B flattened; bake a cake; baby & me) +;; 3 ~= E (backward) +;; 2 ~= N (pivoted 90 degrees) +;; 0 ~= D (flattened) +(define *bend-worker-port* 8320) -;; Override our default localhost:9091 endpoint. +;; Override our default localhost:8320 endpoint. (define (bend-set-worker! host port) (set! *bend-worker-host* host) @@ -87,7 +92,7 @@ ;;; falls back to a single *bend-worker-host* / *bend-worker-port* pair ;;; (full back-compat with single-host callers). ;;; -;;; Set via (bend-set-workers! '(("3090-ai.foxhop.net" . 9091))) +;;; Set via (bend-set-workers! '(("3090-ai.foxhop.net" . 8320))) ;;; or environment variable BEND_WORKERS="host:port,host:port". ;;; ;;; Production default: 3090-ai only. ai.foxhop.net (4090) is @@ -418,4 +423,4 @@ (let ((r (bend (cuda-shake-fanout (make-input 100000) 32)))) (display "-> ") (display (length r)) (display " result(s)\n"))) -;; (demo) ; uncomment after launching gpu-worker.lsp on port 9091 +;; (demo) ; uncomment after launching gpu-worker.lsp on port 8320 (BEND) diff --git a/examples/cuda-fanout/gpu-worker.lsp b/examples/cuda-fanout/gpu-worker.lsp index 3158581..8eab693 100644 --- a/examples/cuda-fanout/gpu-worker.lsp +++ b/examples/cuda-fanout/gpu-worker.lsp @@ -17,14 +17,20 @@ ;;; pattern actually faster than local CPU for repeated calls. ;;; ;;; Run: -;;; lumbda gpu-worker.lsp ; default port 9091 +;;; lumbda gpu-worker.lsp ; default port 8320 (BEND) ;;; lumbda gpu-worker.lsp --port 9001 ;;; +;;; Port mnemonic — 8320 = BEND: +;;; 8 ~= B (implied infinity B flattened; bake a cake; baby & me) +;;; 3 ~= E (backward) +;;; 2 ~= N (pivoted 90 degrees) +;;; 0 ~= D (flattened) +;;; ;;; Requires the cuda binaries on disk; paths below. (load "wire.lsp") -(define *worker-port* 9091) +(define *worker-port* 8320) (define *binary-shake-fanout* ;; Override via env or per host. "./shake256-fanout") diff --git a/examples/cuda-fanout/mock-worker.py b/examples/cuda-fanout/mock-worker.py index ab4d93a..b8a1233 100644 --- a/examples/cuda-fanout/mock-worker.py +++ b/examples/cuda-fanout/mock-worker.py @@ -18,7 +18,12 @@ import threading import time HOST = "127.0.0.1" -PORT = 9091 +# Port 8320 — BEND mnemonic: +# 8 ~= B (implied infinity B flattened; bake a cake; baby & me) +# 3 ~= E (backward) +# 2 ~= N (pivoted 90 degrees) +# 0 ~= D (flattened) +PORT = 8320 BINARY = sys.argv[1] if len(sys.argv) > 1 else "./shake256-fanout" # spawn a warm daemon once diff --git a/examples/cuda-fanout/smoke-bend-asm.lsp b/examples/cuda-fanout/smoke-bend-asm.lsp index f05719c..083822d 100644 --- a/examples/cuda-fanout/smoke-bend-asm.lsp +++ b/examples/cuda-fanout/smoke-bend-asm.lsp @@ -4,7 +4,7 @@ ;;; macro. The function-form bend!-call is the portable path. ;;; ;;; Prereqs: -;;; - gpu-worker.lsp running on 127.0.0.1:9091 (Python or C tier) +;;; - gpu-worker.lsp running on 127.0.0.1:8320 (BEND mnemonic; Python or C tier) ;;; - cuda-shake-fanout binary reachable from that worker ;;; ;;; Run on asm tier: diff --git a/examples/cuda-fanout/smoke-bend.lsp b/examples/cuda-fanout/smoke-bend.lsp index 433e09b..306aab0 100644 --- a/examples/cuda-fanout/smoke-bend.lsp +++ b/examples/cuda-fanout/smoke-bend.lsp @@ -1,7 +1,7 @@ ;;; smoke-bend.lsp -- minimal end-to-end test of bend dispatch. ;;; ;;; Prereqs: -;;; - mock-worker.py listening on 127.0.0.1:9091 +;;; - mock-worker.py listening on 127.0.0.1:8320 (BEND mnemonic) ;;; - cuda-shake-fanout binary on PATH (mock-worker spawns it) ;;; ;;; Run: diff --git a/examples/fizzbuzz.lsp b/examples/fizzbuzz.lsp new file mode 100644 index 0000000..b8cfbd0 --- /dev/null +++ b/examples/fizzbuzz.lsp @@ -0,0 +1,21 @@ +;;; fizzbuzz.lsp — FizzBuzz from 1 to 100 +;;; Run: python3 lumbda.py --fast examples/fizzbuzz.lsp + +(define (fizzbuzz n) + (let ((div3 (= (modulo n 3) 0)) + (div5 (= (modulo n 5) 0))) + (cond + ((and div3 div5) "FizzBuzz") + (div3 "Fizz") + (div5 "Buzz") + (else (number->string n))))) + +(define (run-fizzbuzz limit) + (let loop ((i 1)) + (if (<= i limit) + (begin + (display (fizzbuzz i)) + (newline) + (loop (+ i 1)))))) + +(run-fizzbuzz 100) diff --git a/www/bend.html b/www/bend.html index cc455e8..4c266b5 100644 --- a/www/bend.html +++ b/www/bend.html @@ -30,7 +30,13 @@ make gpu-worker # → builds examples/cuda-fanout/shake256-fanout # → builds the C tier (~10× faster wire orchestration than Python) -# → launches gpu-worker.lsp on port 9091 +# → launches gpu-worker.lsp on port 8320 (BEND) + +# Port 8320 = BEND mnemonic: +# 8 ~= B (implied infinity B flattened; bake a cake; baby & me) +# 3 ~= E (backward) +# 2 ~= N (pivoted 90 degrees) +# 0 ~= D (flattened) # Override tier or port: make gpu-worker LUMBDA=python PORT=9001 # easier debugging @@ -74,11 +80,11 @@ make gpu-worker LUMBDA=asm # smallest footprint
| host | GPU | arch | port | status |
|---|---|---|---|---|
3090-ai.foxhop.net | RTX 3090 (24 GB) | sm_86 | 9091 | active — production worker |
ai.foxhop.net | RTX 4090 (24 GB) | sm_89 | 9092 | reserved for qwen LLM (llama.cpp); bend worker enabled per workload |
3090-ai.foxhop.net | RTX 3090 (24 GB) | sm_86 | 8320 | active — production worker |
ai.foxhop.net | RTX 4090 (24 GB) | sm_89 | 8320 | active — 2-node mesh |
Multi-host fan-out was validated at 1.6× aggregate throughput on small workloads, but routine round-robin against the 4090 would steal VRAM from qwen. Caller opts in explicitly when a workload justifies fan-out: (bend-set-workers! '(("3090-ai.foxhop.net" . 9091) ("ai.foxhop.net" . 9092))) brings the 4090 online for that call.
Multi-host fan-out enabled. Both 3090 + 4090 serve bend workloads on port 8320 (BEND mnemonic). Round-robin or explicit selection via (bend-set-workers! '(("3090-ai.foxhop.net" . 8320) ("ai.foxhop.net" . 8320))).