Unify supercomputer mesh into one virtual machine via cluster-fabric

Add hyper-p2p-cluster-fabric: aggregates every peer's CPU, RAM, GPU, disk,
and bandwidth into a single logical supercomputer (clusterId, asOneMachine).

- getVirtualMachine() — total vs available capacity across all nodes
- publishNode() — join the giant computer; syncs attached pool modules
- reserveCluster() — greedy multi-peer allocation for one workload
- runClusterJob() — reserve + fan-out jobs across slices
- Gossip cluster-node / cluster-reserve / cluster-run on Protomux

Enhance hyper-p2p-capacity-registry with clusterTotals() for the same
aggregate view at the registry layer.

Update SUPERCOMPUTER_LAYERS, category README, demo (3 racks → 44 cores,
155 GB RAM, 5 GPUs as one machine). Registry now 165 modules.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-21 00:41:57 -04:00
co-authored by Cursor
parent 693385bd7c
commit 03151a4cfc
17 changed files with 2442 additions and 22 deletions
@@ -0,0 +1,52 @@
require('bare-process/global')
const test = require('brittle')
const { HyperP2PClusterFabric } = require('../index.js')
const { HyperP2PCapacityRegistry } = require('../../hyper-p2p-capacity-registry/index.js')
const { HyperP2PCpuShare } = require('../../hyper-p2p-cpu-share/index.js')
const { HyperP2PJobDispatcher } = require('../../hyper-p2p-job-dispatcher/index.js')
test('cluster-fabric: combines nodes into one VM', async (t) => {
const reg = new HyperP2PCapacityRegistry()
const cpu = new HyperP2PCpuShare()
const jobs = new HyperP2PJobDispatcher()
const fabric = new HyperP2PClusterFabric({ registry: reg, cpu, jobs })
fabric.publishNode({ cpuCores: 8, ramMb: 16384, gpuSlots: 1, cpuMsDonated: 60_000 }, 'node-a')
fabric.publishNode({ cpuCores: 16, ramMb: 32768, gpuSlots: 2, cpuMsDonated: 120_000 }, 'node-b')
const vm = fabric.getVirtualMachine()
t.is(vm.asOneMachine, true)
t.is(vm.nodes, 2)
t.is(vm.total.cpuCores, 24)
t.is(vm.total.ramMb, 49152)
t.is(vm.total.gpuSlots, 3)
const run = fabric.runClusterJob({ kind: 'render', cpuMs: 5000, ramMb: 4096 })
t.ok(run.jobIds.length >= 1)
t.ok(run.slices.length >= 1)
await fabric.close()
await reg.close()
await cpu.close()
await jobs.close()
})
test('cluster-fabric: clusterTotals standalone', async (t) => {
const f = new HyperP2PClusterFabric()
f.publishNode({ cpuCores: 4, ramMb: 8192 })
f.publishNode({ cpuCores: 4, ramMb: 8192 }, 'peer-2')
t.is(f.clusterTotals().cpuCores, 8)
await f.close()
})
test('cluster-fabric: validation', async (t) => {
const f = new HyperP2PClusterFabric()
f.publishNode({ cpuCores: 1, ramMb: 512, cpuMsDonated: 100 })
try {
f.reserveCluster({ cpuMs: 999_999_999 })
t.fail('expected throw')
} catch (e) {
t.ok(e instanceof Error)
}
await f.close()
})