nx_swarm_pack.nx
buildroot/runtime/nx_swarm_pack.nx
about
nx_swarm_pack.nx -- SWARM FABRIC heterogeneous MAX-UTILIZATION scheduler (SF-R-PACK): get the MOST out
of EVERY participant by exploiting ALL of its resources at once -- RAM, CPU cores, GPU, VRAM -- not routing
a job to one class (operator 2026-07-15: "gpu was just an example ... use the ram cpu gpu whatever is
available to get the most out of what participates in the supercomputer", the NIST/heterogeneous-compute
model). A single participant can host MANY demands using DIFFERENT resources concurrently; work spreads to
fill every participant's spare capacity.
RESOURCE VECTOR (aligned to the beacon telemetry = the FEED): per participant
pcpu = spare CPU milli-cores (beacon: (1000-lpc)*ncpu) · pram = free RAM MB (beacon mem_avail_mb)
pgpu = GPU present 0/1 · pvram = free VRAM MB (the axis to wire from a GPU collector)
DEMAND VECTOR: per chunk dcpu (milli-cores) · dram (MB) · dgpu (needs GPU 0/1) · dvram (MB)
COMPOSES (check-before-build 2026-07-15): nx_resource_arbiter ALREADY models VRAM/RAM/CPU/GPU/net/disk as
first-class allocatable kinds with fairness+preempt -- but is "fed by nothing". This packer IS that feed +
the placement loop; the fairness/preempt/treaty LAYER wires to nx_resource_arbiter (nx_ra_request/grant)
as the allocation policy SSOT. Hard-constraint classify = nx_swarm_coord. Telemetry = nx_node_beacon.
★★THE LIAR-KILLERS (the operator's principle, mechanized): (1) NO participant is ever over-allocated on ANY
resource (sum assigned <= supply, per axis). (2) a demand is NEVER placed on a participant that lacks its
REQUIRED resource -- a needs-GPU chunk never lands on a GPU-less node (GPU generalized to "whatever it
requires"). (3) packing beats naive round-robin on placed-count (measured). (4) HETEROGENEOUS EXPLOITATION
proven: one participant hosts DIFFERENT resource-type demands at once; no participant sits idle while a
demand it could serve is queued.
pack <poolfile> <jobsfile> -- pool line "name cpu_milli ram_mb gpu vram_mb"; job line "id cpu ram gpu vram"
[gate] -- self-gate: the heterogeneous scenario + all four liar-killers
license_tier: ORIGINAL expect_exit:0
dependencies 1 imports · 0 importers
imports: nx_swarm_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 29 | const SK_MAGIC_8000: i64 = 8000 |
| 30 | const SK_MAGIC_16000: i64 = 16000 |
| 31 | const SK_MAGIC_12000: i64 = 12000 |
| 32 | const SK_MAGIC_3000: i64 = 3000 |
| 33 | const SK_MAGIC_32000: i64 = 32000 |
| 34 | const SK_MAGIC_4000: i64 = 4000 |
| 35 | const SK_MAGIC_5000: i64 = 5000 |
| 36 | const SK_MAGIC_20000: i64 = 20000 |
| 37 | const SK_MAGIC_2000: i64 = 2000 |
| 38 | const SK_MAGIC_65536: i64 = 65536 |
| 39 | const SK_MAGIC_8192: i64 = 8192 |
| 40 | const SK_MAGIC_1000000: i64 = 1000000 |
| 42 | const SK_MAXP: i64 = 256 |
| 43 | const SK_MAXD: i64 = 4096 |
functions
| 45 | func sk_puts(s: *u8) -> i64 { sys_write(1, s, fa_len(s)); return 0 } |
| 51 | func sk_place_one(pcpu: *i64, pram: *i64, pgpu: *i64, pvram: *i64, n: i64, dcpu: i64, dram: i64, dgpu: i64, dvram: i64) -> i64 called by 1: sk_pack |
| 79 | func sk_pack(pcpu: *i64, pram: *i64, pgpu: *i64, pvram: *i64, n: i64, |
| 118 | func sk_naive(pcpu: *i64, pram: *i64, pgpu: *i64, pvram: *i64, n: i64, called by 1: sk_gate |
| 140 | func sk_report(names: *i64, pcpu0: *i64, pram0: *i64, pgpu: *i64, pcpu: *i64, pram: *i64, n: i64, |
| 170 | func sk_types_on(part: i64, dram: *i64, dgpu: *i64, m: i64, assign: *i64) -> i64 called by 1: sk_gate |
| 184 | func sk_gate() -> i64 |
| 301 | func sk_skipsp(buf: *u8, n: i64, p: i64) -> i64 called by 1: sk_load_jobs |
| 309 | func sk_roster_has(roster: *u8, name: *u8, nl: i64) -> i64 |
| 331 | func sk_load_pool(snap: *u8, roster: *u8, names: *i64, pcpu: *i64, pram: *i64, pgpu: *i64, pvram: *i64, maxn: i64) -> i64 |
| 375 | func sk_load_jobs(jobs: *u8, dcpu: *i64, dram: *i64, dgpu: *i64, dvram: *i64, maxm: i64) -> i64 |
| 400 | func sk_live(snap: *u8, jobs: *u8, roster: *u8) -> i64 |
| 437 | func main(argc: i64, argv: *i64) -> i64 |