code wiki / _hdl_build / nx_cloud_deploy_ready.nx
nx_cloud_deploy_ready.nx source
↩ module page · 56 lines · 4115 B
1// nx_cloud_deploy_ready.nx -- VULTR/CLOUD DEPLOY PRE-FLIGHT (operator 2026-06-20: "getting us ready for vultr").
2// Verifies the deploy bundle (deploy_bundle.tsv) is COMPLETE -- every file the native-Linux GPU instance needs to
3// build + run the sovereign GPU stack is present (liar-killed: a missing component -> RED). Emits the turnkey
4// RUNBOOK so the moment the operator drops a Vultr API key, Claude executes a known sequence. When GREEN = ready.
5// No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
6import "nx_syscalls.nx"
7const DR_MAGIC_65536: i64 = 65536
8const DR_MAGIC_65535: i64 = 65535
9
10const DR_REF: *u8 = "knowledge/registry/deploy_bundle.tsv"
11
12func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
13func wn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m==0{sys_write(1,"0" as *u8,1);return 0} let t: *u8=sys_mmap(28); var k: i64=0; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 }
14func exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
15func rdfile(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0{return 0} var t: i64=0; var r: i64=1; while r>0 { r=sys_read(fd,(buf as i64+t) as *u8,cap-t); if r>0{t=t+r} } sys_close(fd); return t }
16func scan_to(buf: *u8, n: i64, start: i64, delim: i64) -> i64 { var i: i64=start; var s: i64=1; while s==1 { if i>=n {s=0} else { if buf[i]==(delim as u8){s=0} else {i=i+1} } } return i }
17
18func main() -> i64 {
19 w("=== nx_cloud_deploy_ready -- VULTR deploy PRE-FLIGHT (bundle check + runbook) ===\n" as *u8)
20 let rb: *u8 = sys_mmap(DR_MAGIC_65536)
21 let n: i64 = rdfile(DR_REF, rb, DR_MAGIC_65535)
22 if n <= 0 { w("DEPLOYREADY verdict=RED reason=bundle-manifest-unreadable\n" as *u8); sys_exit(1); return 1 }
23
24 var total: i64 = 0
25 var present: i64 = 0
26 var p: i64 = 0
27 while p < n {
28 if rb[p] == (35 as u8) { let e: i64 = scan_to(rb, n, p, 10); p = e + 1 }
29 else { if rb[p] == (10 as u8) { p = p + 1 }
30 else {
31 let a0: i64 = p
32 let t1: i64 = scan_to(rb, n, a0, 9); rb[t1] = 0 as u8
33 let a1: i64 = t1 + 1
34 let t2: i64 = scan_to(rb, n, a1, 10); rb[t2] = 0 as u8
35 total = total + 1
36 let ex: i64 = exists(((rb as i64) + a1) as *u8)
37 if ex == 1 { w(" [OK] " as *u8); present = present + 1 } else { w(" [MISSING] " as *u8) }
38 w(((rb as i64) + a0) as *u8); w(" (" as *u8); w(((rb as i64) + a1) as *u8); w(")\n" as *u8)
39 p = t2 + 1
40 } }
41 }
42
43 w("\n --- VULTR RUNBOOK (Claude executes from this session once the operator pastes an API key) ---\n" as *u8)
44 w(" 1. OPERATOR: Vultr signup + payment + scoped API key -> paste here (the only UI step, ~5 min)\n" as *u8)
45 w(" 2. CLAUDE: install vultr-cli; provision a native-Linux GPU instance (NVIDIA for nx_nv; or bare-metal+ISO for NishiOS Stage-2)\n" as *u8)
46 w(" 3. CLAUDE: rsync/scp the nxc2 repo to the instance (this bundle + the _offc toolchain)\n" as *u8)
47 w(" 4. CLAUDE: nx_sov_build_run on the instance (verifies the sovereign toolchain runs native-Linux)\n" as *u8)
48 w(" 5. CLAUDE: nx_gpu_power -> CAP power + LOCK clocks (never-fry, reproducible) BEFORE any kernel\n" as *u8)
49 w(" 6. CLAUDE: nx_device_probe -> auto-routes to /dev/nvidia* (or /dev/kfd); nx_nv/nx_kfd complete the RM/KFD tree -> BM-GPU-6 EXECUTES on real silicon\n" as *u8)
50 w(" 7. CLAUDE: nx_gpu_bench -> first REAL ours-GPU number vs cuBLAS -> the measured exceed scorecard\n" as *u8)
51 w(" 8. CLAUDE: collect results -> DESTROY the instance (pay only for the test hour)\n" as *u8)
52
53 w("\nDEPLOYREADY bundle present=" as *u8); wn(present); w("/" as *u8); wn(total)
54 if present == total { w(" verdict=GREEN (deploy bundle COMPLETE -- ready for Vultr; give Claude a key and go)\n" as *u8); sys_exit(0); return 0 }
55 w(" verdict=RED (missing components above -- not deploy-ready)\n" as *u8); sys_exit(1); return 1
56}