spatial-computing 0.21.0__tar.gz → 0.24.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spatial_computing-0.21.0/spatial_computing.egg-info → spatial_computing-0.24.0}/PKG-INFO +11 -21
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/README.md +9 -11
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/pyproject.toml +2 -5
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/__init__.py +1 -1
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/cli.py +39 -22
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/compute/workloads.py +72 -58
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/core/model.py +0 -2
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/core/registry.py +1 -12
- spatial_computing-0.24.0/spatial/market/__init__.py +12 -0
- spatial_computing-0.24.0/spatial/market/vast.py +85 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/service.py +6 -5
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/app.js +1 -1
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/unified/__init__.py +1 -1
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/unified/model.py +2 -15
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/unified/providers.py +9 -54
- {spatial_computing-0.21.0 → spatial_computing-0.24.0/spatial_computing.egg-info}/PKG-INFO +11 -21
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial_computing.egg-info/SOURCES.txt +4 -23
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial_computing.egg-info/entry_points.txt +0 -1
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial_computing.egg-info/requires.txt +0 -10
- spatial_computing-0.24.0/tests/test_domains.py +16 -0
- spatial_computing-0.24.0/tests/test_engines.py +41 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_hardening.py +1 -29
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_kernel.py +15 -0
- spatial_computing-0.24.0/tests/test_market.py +72 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_unified.py +2 -39
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_v02.py +1 -65
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_v03.py +1 -25
- spatial_computing-0.24.0/tests/test_v05.py +26 -0
- spatial_computing-0.21.0/spatial/holographic/__init__.py +0 -8
- spatial_computing-0.21.0/spatial/holographic/cgh.py +0 -40
- spatial_computing-0.21.0/spatial/holographic/model.py +0 -49
- spatial_computing-0.21.0/spatial/q/__init__.py +0 -4
- spatial_computing-0.21.0/spatial/q/__main__.py +0 -9
- spatial_computing-0.21.0/spatial/q/backends/__init__.py +0 -170
- spatial_computing-0.21.0/spatial/q/codegen.py +0 -153
- spatial_computing-0.21.0/spatial/q/compiler.py +0 -341
- spatial_computing-0.21.0/spatial/q/ir.py +0 -121
- spatial_computing-0.21.0/spatial/q/lexer.py +0 -61
- spatial_computing-0.21.0/spatial/q/parser.py +0 -330
- spatial_computing-0.21.0/spatial/q/qir.py +0 -128
- spatial_computing-0.21.0/spatial/q/runtime.py +0 -275
- spatial_computing-0.21.0/spatial/q/sim.py +0 -241
- spatial_computing-0.21.0/spatial/scientific/__init__.py +0 -8
- spatial_computing-0.21.0/spatial/scientific/jobs.py +0 -80
- spatial_computing-0.21.0/spatial/simulation/__init__.py +0 -7
- spatial_computing-0.21.0/spatial/simulation/heat.py +0 -48
- spatial_computing-0.21.0/spatial/simulation/nbody.py +0 -31
- spatial_computing-0.21.0/tests/test_domains.py +0 -51
- spatial_computing-0.21.0/tests/test_engines.py +0 -75
- spatial_computing-0.21.0/tests/test_optimizer.py +0 -63
- spatial_computing-0.21.0/tests/test_q.py +0 -181
- spatial_computing-0.21.0/tests/test_v05.py +0 -72
- spatial_computing-0.21.0/tests/test_v07.py +0 -35
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/LICENSE +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/setup.cfg +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/ai/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/ai/kvcache.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/ai/llm.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/compute/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/compute/cost.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/compute/detect.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/compute/monitor.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/compute/scheduler.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/compute/taskqueue.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/compute/worker.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/core/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/core/auth.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/core/energy.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/core/ledger.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/core/protocol.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fabric/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fabric/cuda.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fabric/devices.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fabric/metal.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fabric/metal_mandel.swift +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fabric/metal_run.swift +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fleet/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fleet/agent.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fleet/alerts.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fleet/dashboard.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fleet/ha.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/fleet/hub.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/intelligence/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/intelligence/predictor.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/interconnect/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/interconnect/collectives.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/interconnect/comm.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/interconnect/model.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/interconnect/tasks.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/kernel/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/kernel/dsl.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/kernel/library.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/memory/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/memory/fararray.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/memory/pageserver.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/memory/secure.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/memory/shared.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/memory/tiered.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/billing.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/db.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/invoice_rules.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/mailer.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/oidc.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/pdf.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/qr.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/security.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/server.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/fonts/DMMono-normal-400.woff2 +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/fonts/DMMono-normal-500.woff2 +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/fonts/InstrumentSerif-italic-400.woff2 +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/fonts/InstrumentSerif-normal-400.woff2 +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/fonts/Inter-normal-400.woff2 +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/fonts/Inter-normal-500.woff2 +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/fonts/Inter-normal-600.woff2 +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/fonts.css +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/index.html +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/logo.svg +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/static/style.css +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/totp.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/ubl.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/platform/vat.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/arch.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/desktop/Dockerfile +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/desktop/__init__.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/desktop/start.sh +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/envs.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/inspect.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/microvm.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/planner.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/runner.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/runtime/toolchain.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial/unified/planner.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial_computing.egg-info/dependency_links.txt +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/spatial_computing.egg-info/top_level.txt +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_auth.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_compute.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_core.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_dashboard.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_fabric.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_fleet.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_ha.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_interconnect.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_memory.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_platform.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_platform2.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_qr.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_quorum.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_real_servers.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_runtime.py +0 -0
- {spatial_computing-0.21.0 → spatial_computing-0.24.0}/tests/test_sso.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spatial-computing
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing,
|
|
3
|
+
Version: 0.24.0
|
|
4
|
+
Summary: Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing, fleet)
|
|
5
5
|
Author: Spatial Computing contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://spatial-computing-ecru.vercel.app
|
|
@@ -17,16 +17,8 @@ Requires-Dist: psutil>=5.9
|
|
|
17
17
|
Requires-Dist: numba<0.62,>=0.59
|
|
18
18
|
Requires-Dist: lz4>=4.3
|
|
19
19
|
Requires-Dist: cryptography>=42
|
|
20
|
-
Provides-Extra: quantum
|
|
21
|
-
Requires-Dist: qiskit>=2.0; extra == "quantum"
|
|
22
|
-
Requires-Dist: qiskit-aer>=0.17; extra == "quantum"
|
|
23
|
-
Requires-Dist: qiskit-qasm3-import>=0.5; extra == "quantum"
|
|
24
|
-
Requires-Dist: pyqir>=0.10; extra == "quantum"
|
|
25
20
|
Provides-Extra: build
|
|
26
21
|
Requires-Dist: ziglang>=0.13; extra == "build"
|
|
27
|
-
Provides-Extra: qpu
|
|
28
|
-
Requires-Dist: qiskit>=2.0; extra == "qpu"
|
|
29
|
-
Requires-Dist: qiskit-ibm-runtime>=0.40; extra == "qpu"
|
|
30
22
|
Provides-Extra: dev
|
|
31
23
|
Requires-Dist: pytest>=8; extra == "dev"
|
|
32
24
|
Requires-Dist: lxml>=5; extra == "dev"
|
|
@@ -36,9 +28,9 @@ Dynamic: license-file
|
|
|
36
28
|
|
|
37
29
|
**Measure. Decide. Prove.**
|
|
38
30
|
|
|
39
|
-
One objective for the whole infrastructure: get every job done correctly at the lowest cost, and prove it. Spatial Computing prices every way to run a job across compute, memory, runtime,
|
|
31
|
+
One objective for the whole infrastructure: get every job done correctly at the lowest cost, and prove it. Spatial Computing prices every way to run a job across compute, memory, runtime, AI and a fleet of machines, picks the cheapest, and records the estimate next to what really happened. A gain is claimed only when it is measured. It does not add RAM, cores or GPUs: it compares execution strategies on the hardware you have, trades one resource for another in numbers, and says plainly what it cannot do.
|
|
40
32
|
|
|
41
|
-
> **Status: v0.
|
|
33
|
+
> **Status: v0.22.0, early-stage open-source toolkit.** Everything here was built and measured on a single 2017 MacBook Pro (Intel i7-7660U, 2 cores, 16 GB). Nothing has been proven on a second machine or a data-center GPU. See [Limitations](docs/LIMITATIONS.md) and the [site](https://spatial-computing-ecru.vercel.app).
|
|
42
34
|
|
|
43
35
|
[Français](README.fr.md)
|
|
44
36
|
|
|
@@ -48,7 +40,7 @@ Python 3.10 or newer.
|
|
|
48
40
|
|
|
49
41
|
```bash
|
|
50
42
|
python3 -m venv .venv && source .venv/bin/activate
|
|
51
|
-
pip install
|
|
43
|
+
pip install spatial-computing
|
|
52
44
|
spatial audit
|
|
53
45
|
```
|
|
54
46
|
|
|
@@ -56,7 +48,7 @@ From source, to develop:
|
|
|
56
48
|
|
|
57
49
|
```bash
|
|
58
50
|
git clone https://github.com/abraham1116/spatial-computing && cd spatial-computing
|
|
59
|
-
pip install -e ".[
|
|
51
|
+
pip install -e ".[dev]"
|
|
60
52
|
pytest
|
|
61
53
|
```
|
|
62
54
|
|
|
@@ -86,8 +78,6 @@ spatial audit # hardware, current usage, limits of this ma
|
|
|
86
78
|
spatial status # honest status of every engine
|
|
87
79
|
spatial plan app.exe # detected format + execution routes, with reasons
|
|
88
80
|
spatial run app.elf 600 300 # run through the first feasible route (micro-VM here)
|
|
89
|
-
spatial q run examples/03_vqe_hybrid.sq --trace # SPATIAL Q hybrid program
|
|
90
|
-
spatial q qasm examples/04_teleport.sq --args '[1.0]' # export OpenQASM 3
|
|
91
81
|
spatial bench all # redo every measurement and regenerate the results table
|
|
92
82
|
```
|
|
93
83
|
|
|
@@ -109,17 +99,17 @@ st.put(0, b"..." * 1000); st.get(0); print(st.stats())
|
|
|
109
99
|
| Fleet (agent on every machine + hub: measure, place, recommend, audit) | operational prototype | `tests/test_fleet.py`, `benchmarks/bench_fleet.py` |
|
|
110
100
|
| Compute Engine (detect, monitor, compare strategies, offload, cost) | operational prototype | `tests/test_compute.py`, `benchmarks/bench_cpu.py` |
|
|
111
101
|
| Tiered memory (hot / compressed / far) | operational prototype | `tests/test_memory.py`, `benchmarks/bench_memory.py` |
|
|
112
|
-
| Runtime Engine (inspect binaries, route, micro-VM, WASI) | operational prototype | `tests/test_runtime.py`, `benchmarks/bench_runtime.py` |
|
|
113
|
-
|
|
|
114
|
-
|
|
|
102
|
+
| Runtime Engine (inspect binaries, route, micro-VM, WASI, containers incl. ARM64 via emulation) | operational prototype | `tests/test_runtime.py`, `benchmarks/bench_runtime.py` |
|
|
103
|
+
| Portable kernels (one source, CPU/Metal/CUDA/HIP/Triton; market-vertical presets) | first components | `tests/test_kernel.py`, `benchmarks/bench_kernel.py` |
|
|
104
|
+
| Live GPU market prices (`spatial market`, read-only, no account) | first components | `tests/test_market.py`, [docs/MARKET.md](docs/MARKET.md) |
|
|
105
|
+
| AI, Intelligence | first components (toy model) | `tests/test_engines.py`, `tests/test_domains.py` |
|
|
115
106
|
|
|
116
|
-
Measured on the reference machine (AC power): Numba JIT ×31.6 over pure Python with an identical result; 0.88 s to boot an isolated Linux micro-VM on macOS; −75 % local RAM for a skewed-access dataset at 107× the mean access latency
|
|
107
|
+
Measured on the reference machine (AC power): Numba JIT ×31.6 over pure Python with an identical result; 0.88 s to boot an isolated Linux micro-VM on macOS; −75 % local RAM for a skewed-access dataset at 107× the mean access latency. Full table and conditions: [docs/RESULTATS.fr.md](docs/RESULTATS.fr.md).
|
|
117
108
|
|
|
118
109
|
## What it does not do
|
|
119
110
|
|
|
120
111
|
- It does not add RAM. Compressed, on-disk or remote memory is typed `far_memory`, never `ram`, and a test enforces it.
|
|
121
112
|
- It does not confuse virtualization with extra resources.
|
|
122
|
-
- It does not claim a QPU speeds anything up: everything in SPATIAL Q is classical simulation, and the `qpu` backend refuses to run until a provider is configured.
|
|
123
113
|
- It never exposes your machine: servers bind to `127.0.0.1` and refuse anything else without an explicit `--allow-remote`.
|
|
124
114
|
|
|
125
115
|
## Open core
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
**Measure. Decide. Prove.**
|
|
4
4
|
|
|
5
|
-
One objective for the whole infrastructure: get every job done correctly at the lowest cost, and prove it. Spatial Computing prices every way to run a job across compute, memory, runtime,
|
|
5
|
+
One objective for the whole infrastructure: get every job done correctly at the lowest cost, and prove it. Spatial Computing prices every way to run a job across compute, memory, runtime, AI and a fleet of machines, picks the cheapest, and records the estimate next to what really happened. A gain is claimed only when it is measured. It does not add RAM, cores or GPUs: it compares execution strategies on the hardware you have, trades one resource for another in numbers, and says plainly what it cannot do.
|
|
6
6
|
|
|
7
|
-
> **Status: v0.
|
|
7
|
+
> **Status: v0.22.0, early-stage open-source toolkit.** Everything here was built and measured on a single 2017 MacBook Pro (Intel i7-7660U, 2 cores, 16 GB). Nothing has been proven on a second machine or a data-center GPU. See [Limitations](docs/LIMITATIONS.md) and the [site](https://spatial-computing-ecru.vercel.app).
|
|
8
8
|
|
|
9
9
|
[Français](README.fr.md)
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ Python 3.10 or newer.
|
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
python3 -m venv .venv && source .venv/bin/activate
|
|
17
|
-
pip install
|
|
17
|
+
pip install spatial-computing
|
|
18
18
|
spatial audit
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ From source, to develop:
|
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
24
|
git clone https://github.com/abraham1116/spatial-computing && cd spatial-computing
|
|
25
|
-
pip install -e ".[
|
|
25
|
+
pip install -e ".[dev]"
|
|
26
26
|
pytest
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -52,8 +52,6 @@ spatial audit # hardware, current usage, limits of this ma
|
|
|
52
52
|
spatial status # honest status of every engine
|
|
53
53
|
spatial plan app.exe # detected format + execution routes, with reasons
|
|
54
54
|
spatial run app.elf 600 300 # run through the first feasible route (micro-VM here)
|
|
55
|
-
spatial q run examples/03_vqe_hybrid.sq --trace # SPATIAL Q hybrid program
|
|
56
|
-
spatial q qasm examples/04_teleport.sq --args '[1.0]' # export OpenQASM 3
|
|
57
55
|
spatial bench all # redo every measurement and regenerate the results table
|
|
58
56
|
```
|
|
59
57
|
|
|
@@ -75,17 +73,17 @@ st.put(0, b"..." * 1000); st.get(0); print(st.stats())
|
|
|
75
73
|
| Fleet (agent on every machine + hub: measure, place, recommend, audit) | operational prototype | `tests/test_fleet.py`, `benchmarks/bench_fleet.py` |
|
|
76
74
|
| Compute Engine (detect, monitor, compare strategies, offload, cost) | operational prototype | `tests/test_compute.py`, `benchmarks/bench_cpu.py` |
|
|
77
75
|
| Tiered memory (hot / compressed / far) | operational prototype | `tests/test_memory.py`, `benchmarks/bench_memory.py` |
|
|
78
|
-
| Runtime Engine (inspect binaries, route, micro-VM, WASI) | operational prototype | `tests/test_runtime.py`, `benchmarks/bench_runtime.py` |
|
|
79
|
-
|
|
|
80
|
-
|
|
|
76
|
+
| Runtime Engine (inspect binaries, route, micro-VM, WASI, containers incl. ARM64 via emulation) | operational prototype | `tests/test_runtime.py`, `benchmarks/bench_runtime.py` |
|
|
77
|
+
| Portable kernels (one source, CPU/Metal/CUDA/HIP/Triton; market-vertical presets) | first components | `tests/test_kernel.py`, `benchmarks/bench_kernel.py` |
|
|
78
|
+
| Live GPU market prices (`spatial market`, read-only, no account) | first components | `tests/test_market.py`, [docs/MARKET.md](docs/MARKET.md) |
|
|
79
|
+
| AI, Intelligence | first components (toy model) | `tests/test_engines.py`, `tests/test_domains.py` |
|
|
81
80
|
|
|
82
|
-
Measured on the reference machine (AC power): Numba JIT ×31.6 over pure Python with an identical result; 0.88 s to boot an isolated Linux micro-VM on macOS; −75 % local RAM for a skewed-access dataset at 107× the mean access latency
|
|
81
|
+
Measured on the reference machine (AC power): Numba JIT ×31.6 over pure Python with an identical result; 0.88 s to boot an isolated Linux micro-VM on macOS; −75 % local RAM for a skewed-access dataset at 107× the mean access latency. Full table and conditions: [docs/RESULTATS.fr.md](docs/RESULTATS.fr.md).
|
|
83
82
|
|
|
84
83
|
## What it does not do
|
|
85
84
|
|
|
86
85
|
- It does not add RAM. Compressed, on-disk or remote memory is typed `far_memory`, never `ram`, and a test enforces it.
|
|
87
86
|
- It does not confuse virtualization with extra resources.
|
|
88
|
-
- It does not claim a QPU speeds anything up: everything in SPATIAL Q is classical simulation, and the `qpu` backend refuses to run until a provider is configured.
|
|
89
87
|
- It never exposes your machine: servers bind to `127.0.0.1` and refuse anything else without an explicit `--allow-remote`.
|
|
90
88
|
|
|
91
89
|
## Open core
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "spatial-computing"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing,
|
|
7
|
+
version = "0.24.0"
|
|
8
|
+
description = "Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing, fleet)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
11
11
|
license-files = ["LICENSE"]
|
|
@@ -15,9 +15,7 @@ requires-python = ">=3.10"
|
|
|
15
15
|
dependencies = ["numpy>=1.26,<2.2", "psutil>=5.9", "numba>=0.59,<0.62", "lz4>=4.3", "cryptography>=42"]
|
|
16
16
|
|
|
17
17
|
[project.optional-dependencies]
|
|
18
|
-
quantum = ["qiskit>=2.0", "qiskit-aer>=0.17", "qiskit-qasm3-import>=0.5", "pyqir>=0.10"]
|
|
19
18
|
build = ["ziglang>=0.13"]
|
|
20
|
-
qpu = ["qiskit>=2.0", "qiskit-ibm-runtime>=0.40"]
|
|
21
19
|
dev = ["pytest>=8", "lxml>=5"]
|
|
22
20
|
|
|
23
21
|
[project.urls]
|
|
@@ -26,7 +24,6 @@ Repository = "https://github.com/abraham1116/spatial-computing"
|
|
|
26
24
|
|
|
27
25
|
[project.scripts]
|
|
28
26
|
spatial = "spatial.cli:main"
|
|
29
|
-
spatialq = "spatial.q.runtime:main"
|
|
30
27
|
|
|
31
28
|
[tool.setuptools.packages.find]
|
|
32
29
|
include = ["spatial*"]
|
|
@@ -10,7 +10,7 @@ from pathlib import Path
|
|
|
10
10
|
|
|
11
11
|
ROOT = Path(__file__).resolve().parents[1]
|
|
12
12
|
BENCHES = {"cpu": "bench_cpu", "memory": "bench_memory", "gpu": "bench_gpu",
|
|
13
|
-
"runtime": "bench_runtime"
|
|
13
|
+
"runtime": "bench_runtime"}
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def cmd_audit(a):
|
|
@@ -64,13 +64,6 @@ def cmd_run(a):
|
|
|
64
64
|
return 0 if e.ok else 1
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
def cmd_q(a):
|
|
68
|
-
from .q import runtime
|
|
69
|
-
sys.argv = ["spatialq", *a.rest]
|
|
70
|
-
runtime.main()
|
|
71
|
-
return 0
|
|
72
|
-
|
|
73
|
-
|
|
74
67
|
def cmd_bench(a):
|
|
75
68
|
names = list(BENCHES) if a.name == "all" else [a.name]
|
|
76
69
|
bdir = ROOT / "benchmarks"
|
|
@@ -211,17 +204,14 @@ def cmd_fleet(a):
|
|
|
211
204
|
def cmd_optimize(a):
|
|
212
205
|
import json as _json
|
|
213
206
|
from .unified import Job, Objective, Planner, PlanError, Prices
|
|
214
|
-
prices = Prices(local_usd_per_hour=a.local_usd_per_hour,
|
|
215
|
-
ram_usd_gb_hour=a.ram_usd_gb_hour, storage_usd_gb_hour=a.storage_usd_gb_hour)
|
|
207
|
+
prices = Prices(local_usd_per_hour=a.local_usd_per_hour, ram_usd_gb_hour=a.ram_usd_gb_hour, storage_usd_gb_hour=a.storage_usd_gb_hour)
|
|
216
208
|
obj = Objective(minimize=a.objective, deadline_s=a.deadline, max_ram_bytes=int(a.max_ram_gib * 2**30) if a.max_ram_gib else None,
|
|
217
|
-
require_isolation=a.isolated
|
|
209
|
+
require_isolation=a.isolated)
|
|
218
210
|
hub = _hub_client(a) if a.hub else None
|
|
219
211
|
if a.job == "compute":
|
|
220
212
|
job = Job.compute(a.family, **_json.loads(a.params))
|
|
221
213
|
elif a.job == "binary":
|
|
222
214
|
job = Job.binary(a.file, a.args, a.est_native_s)
|
|
223
|
-
elif a.job == "quantum":
|
|
224
|
-
job = Job.quantum(Path(a.file).read_text(), a.kernel, _json.loads(a.kargs), a.shots)
|
|
225
215
|
elif a.job == "dataset":
|
|
226
216
|
job = Job.dataset(int(a.gib * 2**30), a.accesses, a.locality, a.hot_fraction)
|
|
227
217
|
else:
|
|
@@ -249,6 +239,33 @@ def cmd_devices(a):
|
|
|
249
239
|
return 0
|
|
250
240
|
|
|
251
241
|
|
|
242
|
+
def cmd_market(a):
|
|
243
|
+
from .market import MarketError, cheapest, fetch_offers, spread_vs
|
|
244
|
+
try:
|
|
245
|
+
offers = fetch_offers()
|
|
246
|
+
except MarketError as e:
|
|
247
|
+
print(f"spatial: {e}", file=sys.stderr)
|
|
248
|
+
return 1
|
|
249
|
+
if a.neocloud_usd_per_hour is not None:
|
|
250
|
+
r = spread_vs(offers, a.gpu, a.neocloud_usd_per_hour, a.min_reliability)
|
|
251
|
+
if r is None:
|
|
252
|
+
print(f"spatial: no Vast.ai offer for {a.gpu!r} at reliability >= {a.min_reliability} right now", file=sys.stderr)
|
|
253
|
+
return 1
|
|
254
|
+
o = r["offer"]
|
|
255
|
+
print(f"cheapest {a.gpu} on Vast.ai right now: {r['market_usd_h']:.3f} $/h (reliability {o.reliability:.3f}, {o.geolocation})")
|
|
256
|
+
print(f"your neocloud reference: {r['neocloud_usd_h']:.3f} $/h")
|
|
257
|
+
print(f"spread: {r['spread_usd_h']:+.3f} $/h ({r['spread_pct']:+.1f} %)")
|
|
258
|
+
return 0
|
|
259
|
+
c = cheapest(offers, a.gpu, a.min_reliability)
|
|
260
|
+
if c is None:
|
|
261
|
+
print(f"spatial: no Vast.ai offer for {a.gpu!r} at reliability >= {a.min_reliability} right now", file=sys.stderr)
|
|
262
|
+
return 1
|
|
263
|
+
print(f"{c.gpu_name}: {c.usd_per_hour_per_gpu:.3f} $/h per whole GPU (listing {c.usd_per_hour:.3f} $/h at frac {c.gpu_frac:g}), "
|
|
264
|
+
f"reliability {c.reliability:.3f}, {c.geolocation}")
|
|
265
|
+
print(f"({len(offers)} live offers read from Vast.ai's public marketplace just now; no account, no money spent)")
|
|
266
|
+
return 0
|
|
267
|
+
|
|
268
|
+
|
|
252
269
|
def cmd_token(a):
|
|
253
270
|
from .core import auth
|
|
254
271
|
if a.action == "init":
|
|
@@ -292,9 +309,6 @@ def main(argv=None):
|
|
|
292
309
|
p.add_argument("--route")
|
|
293
310
|
p.add_argument("--timeout", type=float, default=300)
|
|
294
311
|
p.set_defaults(fn=cmd_run)
|
|
295
|
-
p = sub.add_parser("q", help="SPATIAL Q: run|check|qasm|ir <file.sq>")
|
|
296
|
-
p.add_argument("rest", nargs=argparse.REMAINDER)
|
|
297
|
-
p.set_defaults(fn=cmd_q)
|
|
298
312
|
p = sub.add_parser("bench", help="run benchmarks and regenerate docs/RESULTATS.md")
|
|
299
313
|
p.add_argument("name", choices=[*BENCHES, "all"])
|
|
300
314
|
p.set_defaults(fn=cmd_bench)
|
|
@@ -308,26 +322,29 @@ def main(argv=None):
|
|
|
308
322
|
p.add_argument("--allow-remote", action="store_true", help="explicit consent to accept LAN connections")
|
|
309
323
|
p.set_defaults(fn=cmd_worker)
|
|
310
324
|
p = sub.add_parser("optimize", help="ONE objective for every engine: price each way to do a job, pick the cheapest, optionally run and check")
|
|
311
|
-
p.add_argument("job", choices=["compute", "binary", "
|
|
312
|
-
p.add_argument("--family", default="mandel", help="compute: mandel|
|
|
325
|
+
p.add_argument("job", choices=["compute", "binary", "dataset", "kv"])
|
|
326
|
+
p.add_argument("--family", default="mandel", help="compute: mandel|collatz|waves|batch_score|pk_mandel|pk_collatz|pk_batch_score|pk_rtb|pk_credit|pk_claims|pk_alerts|pk_moderation|pk_telecom")
|
|
313
327
|
p.add_argument("--params", default="{}", help="compute: JSON parameters, e.g. '{\"n\":800,\"iters\":300}'")
|
|
314
|
-
p.add_argument("--file", help="binary: path
|
|
328
|
+
p.add_argument("--file", help="binary: path")
|
|
315
329
|
p.add_argument("args", nargs="*", help="binary: arguments")
|
|
316
330
|
p.add_argument("--est-native-s", type=float, default=1.0, help="binary: expected run time when native")
|
|
317
|
-
p.add_argument("--kernel", help="quantum: kernel name"); p.add_argument("--kargs", default="[]"); p.add_argument("--shots", type=int, default=1000)
|
|
318
331
|
p.add_argument("--gib", type=float, default=1.0, help="dataset: size in GiB"); p.add_argument("--accesses", type=int, default=100000)
|
|
319
332
|
p.add_argument("--locality", type=float, default=0.8); p.add_argument("--hot-fraction", type=float, default=0.2)
|
|
320
333
|
p.add_argument("--prefix-tokens", type=int, default=1000); p.add_argument("--reuse", type=float, default=0.5); p.add_argument("--horizon-h", type=float, default=1.0)
|
|
321
334
|
p.add_argument("--objective", choices=["cost", "time"], default="cost")
|
|
322
335
|
p.add_argument("--deadline", type=float); p.add_argument("--max-ram-gib", type=float)
|
|
323
|
-
p.add_argument("--isolated", action="store_true")
|
|
336
|
+
p.add_argument("--isolated", action="store_true")
|
|
324
337
|
p.add_argument("--local-usd-per-hour", type=float, default=0.134, help="price of this machine (default is an assumption)")
|
|
325
338
|
p.add_argument("--ram-usd-gb-hour", type=float, default=0.0); p.add_argument("--storage-usd-gb-hour", type=float, default=0.0)
|
|
326
|
-
p.add_argument("--qpu-usd-per-shot", type=float, default=0.0); p.add_argument("--qpu-usd-per-task", type=float, default=0.0)
|
|
327
339
|
p.add_argument("--hub", help="host:port of a fleet hub: nodes become options"); p.add_argument("--token-file")
|
|
328
340
|
p.add_argument("--execute", action="store_true", help="run the chosen option and compare with the estimate")
|
|
329
341
|
p.set_defaults(fn=cmd_optimize)
|
|
330
342
|
sub.add_parser("devices", help="compute devices the planner can use on this machine (CPU, Metal GPU, NVIDIA GPU)").set_defaults(fn=cmd_devices)
|
|
343
|
+
p = sub.add_parser("market", help="live GPU prices from Vast.ai's public marketplace (read-only, no account, no money spent)")
|
|
344
|
+
p.add_argument("--gpu", default="H100", help="substring to match in the GPU name, e.g. H100, RTX 4090, A100")
|
|
345
|
+
p.add_argument("--min-reliability", type=float, default=0.5, help="Vast.ai's own 0..1 host score; a low-reliability offer is excluded by default")
|
|
346
|
+
p.add_argument("--neocloud-usd-per-hour", type=float, default=None, help="your reference 'neocloud' price for this GPU: if given, prints the arbitrage spread instead of just the price")
|
|
347
|
+
p.set_defaults(fn=cmd_market)
|
|
331
348
|
p = sub.add_parser("agent", help="run a fleet agent: measure this machine, report to a hub, run allow-listed tasks")
|
|
332
349
|
p.add_argument("--hub", required=True, help="host:port of the hub")
|
|
333
350
|
p.add_argument("--token-file", required=True, help="shared secret file, or a scoped token with fleet:report,fleet:work")
|
|
@@ -172,6 +172,66 @@ def pk_batch_score_cpu(n: int, signals: int) -> int:
|
|
|
172
172
|
def pk_batch_score_metal(n: int, signals: int) -> int:
|
|
173
173
|
return _pk("batch_score", "metal", n, signals=signals)
|
|
174
174
|
|
|
175
|
+
def pk_rtb_cpu(n: int, signals: int) -> int:
|
|
176
|
+
"""Portable kernel (spatial.kernel): a real-time ad-bid score (RTB-shaped), on the CPU. SAME kernel as pk_batch_score (`batch_score`
|
|
177
|
+
in spatial.kernel.library), only the name and docs differ: synthetic signals, no trained model,
|
|
178
|
+
no real data for this vertical. See docs/KERNELS.md."""
|
|
179
|
+
return _pk("batch_score", "cpu", n, signals=signals)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def pk_rtb_metal(n: int, signals: int) -> int:
|
|
183
|
+
return _pk("batch_score", "metal", n, signals=signals)
|
|
184
|
+
|
|
185
|
+
def pk_credit_cpu(n: int, signals: int) -> int:
|
|
186
|
+
"""Portable kernel (spatial.kernel): a credit/loan application score, on the CPU. SAME kernel as pk_batch_score (`batch_score`
|
|
187
|
+
in spatial.kernel.library), only the name and docs differ: synthetic signals, no trained model,
|
|
188
|
+
no real data for this vertical. See docs/KERNELS.md."""
|
|
189
|
+
return _pk("batch_score", "cpu", n, signals=signals)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def pk_credit_metal(n: int, signals: int) -> int:
|
|
193
|
+
return _pk("batch_score", "metal", n, signals=signals)
|
|
194
|
+
|
|
195
|
+
def pk_claims_cpu(n: int, signals: int) -> int:
|
|
196
|
+
"""Portable kernel (spatial.kernel): an insurance claim score, on the CPU. SAME kernel as pk_batch_score (`batch_score`
|
|
197
|
+
in spatial.kernel.library), only the name and docs differ: synthetic signals, no trained model,
|
|
198
|
+
no real data for this vertical. See docs/KERNELS.md."""
|
|
199
|
+
return _pk("batch_score", "cpu", n, signals=signals)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def pk_claims_metal(n: int, signals: int) -> int:
|
|
203
|
+
return _pk("batch_score", "metal", n, signals=signals)
|
|
204
|
+
|
|
205
|
+
def pk_alerts_cpu(n: int, signals: int) -> int:
|
|
206
|
+
"""Portable kernel (spatial.kernel): a security alert score (SIEM-shaped), on the CPU. SAME kernel as pk_batch_score (`batch_score`
|
|
207
|
+
in spatial.kernel.library), only the name and docs differ: synthetic signals, no trained model,
|
|
208
|
+
no real data for this vertical. See docs/KERNELS.md."""
|
|
209
|
+
return _pk("batch_score", "cpu", n, signals=signals)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def pk_alerts_metal(n: int, signals: int) -> int:
|
|
213
|
+
return _pk("batch_score", "metal", n, signals=signals)
|
|
214
|
+
|
|
215
|
+
def pk_moderation_cpu(n: int, signals: int) -> int:
|
|
216
|
+
"""Portable kernel (spatial.kernel): a content moderation score, on the CPU. SAME kernel as pk_batch_score (`batch_score`
|
|
217
|
+
in spatial.kernel.library), only the name and docs differ: synthetic signals, no trained model,
|
|
218
|
+
no real data for this vertical. See docs/KERNELS.md."""
|
|
219
|
+
return _pk("batch_score", "cpu", n, signals=signals)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def pk_moderation_metal(n: int, signals: int) -> int:
|
|
223
|
+
return _pk("batch_score", "metal", n, signals=signals)
|
|
224
|
+
|
|
225
|
+
def pk_telecom_cpu(n: int, signals: int) -> int:
|
|
226
|
+
"""Portable kernel (spatial.kernel): a telecom billing/fraud score, on the CPU. SAME kernel as pk_batch_score (`batch_score`
|
|
227
|
+
in spatial.kernel.library), only the name and docs differ: synthetic signals, no trained model,
|
|
228
|
+
no real data for this vertical. See docs/KERNELS.md."""
|
|
229
|
+
return _pk("batch_score", "cpu", n, signals=signals)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def pk_telecom_metal(n: int, signals: int) -> int:
|
|
233
|
+
return _pk("batch_score", "metal", n, signals=signals)
|
|
234
|
+
|
|
175
235
|
|
|
176
236
|
def montecarlo_pi(samples: int, seed: int = 0) -> float:
|
|
177
237
|
rng = np.random.default_rng(seed)
|
|
@@ -201,58 +261,6 @@ def matmul(n: int, seed: int = 0) -> float:
|
|
|
201
261
|
return float((a @ b).trace())
|
|
202
262
|
|
|
203
263
|
|
|
204
|
-
def heat_numpy(n: int, steps: int, c: float = 0.2) -> float:
|
|
205
|
-
"""Simulation engine: 2-D heat diffusion from a hot square; returns the peak temperature."""
|
|
206
|
-
import numpy as np
|
|
207
|
-
from ..simulation.heat import simulate
|
|
208
|
-
u0 = np.zeros((n, n))
|
|
209
|
-
u0[n // 2 - n // 10: n // 2 + n // 10 + 1, n // 2 - n // 10: n // 2 + n // 10 + 1] = 100.0
|
|
210
|
-
return float(simulate(u0, c, steps, "numpy").max())
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
def heat_numba(n: int, steps: int, c: float = 0.2) -> float:
|
|
214
|
-
import numpy as np
|
|
215
|
-
from ..simulation.heat import simulate
|
|
216
|
-
u0 = np.zeros((n, n))
|
|
217
|
-
u0[n // 2 - n // 10: n // 2 + n // 10 + 1, n // 2 - n // 10: n // 2 + n // 10 + 1] = 100.0
|
|
218
|
-
return float(simulate(u0, c, steps, "numba").max())
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
def nbody(bodies: int, steps: int, seed: int = 1) -> float:
|
|
222
|
-
"""Simulation engine: relative energy drift of a leapfrog N-body run (should be tiny)."""
|
|
223
|
-
import numpy as np
|
|
224
|
-
from ..simulation import nbody as nb
|
|
225
|
-
rng = np.random.default_rng(seed)
|
|
226
|
-
pos, vel, mass = rng.normal(size=(bodies, 3)), rng.normal(size=(bodies, 3)) * 0.1, rng.uniform(0.5, 1.5, bodies)
|
|
227
|
-
e0 = nb.energy(pos, vel, mass, 0.05)
|
|
228
|
-
p, v = nb.leapfrog(pos, vel, mass, dt=1e-3, steps=steps, soft=0.05)
|
|
229
|
-
return float(abs(nb.energy(p, v, mass, 0.05) - e0) / abs(e0))
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
def hologram_peak(n: int, seed: int = 1) -> int:
|
|
233
|
-
"""Holographic engine: synthesise a 1-point hologram, reconstruct it, return the focus position
|
|
234
|
-
(row * n + column) of the brightest pixel (it must be the emitter's pixel)."""
|
|
235
|
-
import numpy as np
|
|
236
|
-
from ..holographic import hologram, reconstruct
|
|
237
|
-
wl, pitch = 633e-9, 8e-6
|
|
238
|
-
k = int(np.random.default_rng(seed).integers(-n // 8, n // 8 + 1))
|
|
239
|
-
H = hologram(np.array([[k * pitch, 0.0, 0.05]]), np.array([1.0]), n, pitch, wl)
|
|
240
|
-
img = reconstruct(H, 0.05, pitch, wl)
|
|
241
|
-
return int(np.argmax(img))
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
def option_mc(paths: int, seed: int = 0) -> float:
|
|
245
|
-
"""Scientific engine: Monte-Carlo European call price (Black-Scholes reference exists in tests)."""
|
|
246
|
-
from ..scientific import european_call_mc
|
|
247
|
-
return float(european_call_mc(100.0, 105.0, 0.03, 0.2, 1.0, paths, seed)[0])
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
def harmonic_rk4_x(omega: float, t_end: float, steps: int) -> float:
|
|
251
|
-
"""Scientific engine: RK4 solution of x'' = -omega^2 x at t_end (exact: cos(omega * t_end))."""
|
|
252
|
-
from ..scientific import harmonic_rk4
|
|
253
|
-
return float(harmonic_rk4(omega, t_end, steps)[0])
|
|
254
|
-
|
|
255
|
-
|
|
256
264
|
REGISTRY = {
|
|
257
265
|
"mandel_python": mandel_python,
|
|
258
266
|
"mandel_numpy": mandel_numpy,
|
|
@@ -268,12 +276,18 @@ REGISTRY = {
|
|
|
268
276
|
"pk_collatz_metal": pk_collatz_metal,
|
|
269
277
|
"pk_batch_score_cpu": pk_batch_score_cpu,
|
|
270
278
|
"pk_batch_score_metal": pk_batch_score_metal,
|
|
271
|
-
"
|
|
272
|
-
"
|
|
273
|
-
"
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
"
|
|
279
|
+
"pk_rtb_cpu": pk_rtb_cpu,
|
|
280
|
+
"pk_rtb_metal": pk_rtb_metal,
|
|
281
|
+
"pk_credit_cpu": pk_credit_cpu,
|
|
282
|
+
"pk_credit_metal": pk_credit_metal,
|
|
283
|
+
"pk_claims_cpu": pk_claims_cpu,
|
|
284
|
+
"pk_claims_metal": pk_claims_metal,
|
|
285
|
+
"pk_alerts_cpu": pk_alerts_cpu,
|
|
286
|
+
"pk_alerts_metal": pk_alerts_metal,
|
|
287
|
+
"pk_moderation_cpu": pk_moderation_cpu,
|
|
288
|
+
"pk_moderation_metal": pk_moderation_metal,
|
|
289
|
+
"pk_telecom_cpu": pk_telecom_cpu,
|
|
290
|
+
"pk_telecom_metal": pk_telecom_metal,
|
|
277
291
|
}
|
|
278
292
|
if HAVE_NUMBA:
|
|
279
293
|
REGISTRY["mandel_numba"] = mandel_numba
|
|
@@ -20,8 +20,6 @@ class ResourceKind(str, Enum):
|
|
|
20
20
|
FAR_MEMORY = "far_memory" # compressed / remote / storage-backed. Never reported as RAM.
|
|
21
21
|
STORAGE = "storage"
|
|
22
22
|
NETWORK = "network"
|
|
23
|
-
QPU = "qpu"
|
|
24
|
-
QSIM = "qsim" # classical simulator of a quantum device
|
|
25
23
|
|
|
26
24
|
|
|
27
25
|
@dataclass
|
|
@@ -43,30 +43,19 @@ ENGINES: list[Engine] = [
|
|
|
43
43
|
"one process with SQLite; no SAML; tax tools are not a compliance engine; e-mail tested against a local SMTP stand-in, payments against a fake Stripe API only"),
|
|
44
44
|
Engine("planner", "Spatial Planner (the one objective)", "spatial.unified", Status.OPERATIONAL_PROTOTYPE,
|
|
45
45
|
"tests/test_unified.py",
|
|
46
|
-
"estimates come from probes and measured constants on one machine; calibration is a median of past ratios; no learned model; fleet
|
|
46
|
+
"estimates come from probes and measured constants on one machine; calibration is a median of past ratios; no learned model; fleet pricing needs the caller's prices"),
|
|
47
47
|
Engine("fleet", "Spatial Fleet (agent + hub)", "spatial.fleet", Status.OPERATIONAL_PROTOTYPE,
|
|
48
48
|
"tests/test_fleet.py, benchmarks/bench_fleet.py",
|
|
49
49
|
"validated on one machine (agents on loopback); HA: active/standby for two hubs, majority election (election safety, no replicated log) for three or more, tested on one machine with simulated clocks; dashboard is read-only and local; recommendations are estimates; never applies changes by itself"),
|
|
50
50
|
Engine("runtime", "Spatial Runtime Engine", "spatial.runtime", Status.OPERATIONAL_PROTOTYPE,
|
|
51
51
|
"tests/test_runtime.py, benchmarks/bench_runtime.py",
|
|
52
52
|
"Windows: one console program and one GUI window (Notepad) under Wine, nothing more; containers: static Linux ELF, tested with Docker (Colima) and Podman; Linux GUI apps stream through a container and noVNC (three allow-listed apps)"),
|
|
53
|
-
Engine("q", "SPATIAL Q", "spatial.q", Status.OPERATIONAL_PROTOTYPE,
|
|
54
|
-
"tests/test_q.py, benchmarks/bench_q.py",
|
|
55
|
-
"no real QPU executed (OpenQASM 3 and QIR export only); simulator limited by RAM"),
|
|
56
53
|
Engine("ai", "Spatial AI Engine", "spatial.ai", Status.FIRST_COMPONENTS,
|
|
57
54
|
"tests/test_engines.py (toy transformer KV cache: restore equals recompute)",
|
|
58
55
|
"toy NumPy model only; no real LLM, no GPU; placement planner is in the private package"),
|
|
59
|
-
Engine("scientific", "Spatial Scientific & Industrial Engine", "spatial.scientific",
|
|
60
|
-
Status.FIRST_COMPONENTS, "tests/test_domains.py, tests/test_engines.py (validated jobs)",
|
|
61
|
-
"two reference jobs; no domain solvers"),
|
|
62
|
-
Engine("simulation", "Spatial Simulation Engine", "spatial.simulation", Status.FIRST_COMPONENTS,
|
|
63
|
-
"tests/test_domains.py, tests/test_engines.py (heat diffusion, N-body)", "two small solvers; no multiphysics"),
|
|
64
56
|
Engine("intelligence", "Spatial Intelligence Engine", "spatial.intelligence",
|
|
65
57
|
Status.FIRST_COMPONENTS, "tests/test_domains.py, tests/test_engines.py (predictor drives the scheduler)",
|
|
66
58
|
"least-squares runtime model only"),
|
|
67
|
-
Engine("holographic", "Spatial Holographic Engine", "spatial.holographic", Status.FIRST_COMPONENTS,
|
|
68
|
-
"tests/test_engines.py (hologram synthesis + numerical reconstruction)",
|
|
69
|
-
"numerical optics only; no display hardware, no real-time rendering"),
|
|
70
59
|
]
|
|
71
60
|
|
|
72
61
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Live GPU market prices, read-only, no account and no money spent.
|
|
2
|
+
|
|
3
|
+
This reads REAL current prices from a real commercial marketplace (Vast.ai's public bundle
|
|
4
|
+
listing, the same data their own search page shows a logged-out visitor). It makes the GPU
|
|
5
|
+
arbitrage pricing idea (see the private business notes) checkable against live numbers instead
|
|
6
|
+
of a hypothesis on paper.
|
|
7
|
+
|
|
8
|
+
What this module does NOT do: rent a GPU, run a job, or spend any money. Renting hardware and
|
|
9
|
+
running a real job on it is a separate, later step that needs an account on the marketplace and
|
|
10
|
+
the user's explicit go-ahead each time, since it spends real money.
|
|
11
|
+
"""
|
|
12
|
+
from .vast import MarketError, Offer, cheapest, fetch_offers, parse_offers, spread_vs # noqa: F401
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Vast.ai's public GPU marketplace: a real, live, read-only price feed. No API key is used or
|
|
2
|
+
needed for this endpoint (it is the same data their own search page shows a logged-out visitor);
|
|
3
|
+
we never authenticate, never bid, never rent. One real network call per `fetch_offers()`."""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import urllib.error
|
|
8
|
+
import urllib.request
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
|
|
11
|
+
BUNDLES_URL = "https://console.vast.ai/api/v0/bundles/"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class MarketError(Exception):
|
|
15
|
+
"""The marketplace could not be reached or its response could not be understood. Never
|
|
16
|
+
silently replaced by a stale or made-up price: callers see this and decide what to do."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(frozen=True)
|
|
20
|
+
class Offer:
|
|
21
|
+
gpu_name: str
|
|
22
|
+
num_gpus: int
|
|
23
|
+
gpu_frac: float # fraction of ONE physical GPU this listing gives you (1.0 = a whole GPU)
|
|
24
|
+
usd_per_hour: float # dph_total: Vast.ai's own all-in price for this listing (their fee included)
|
|
25
|
+
reliability: float # Vast.ai's own 0..1 host score; not independently verified here
|
|
26
|
+
geolocation: str
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def usd_per_hour_per_gpu(self) -> float:
|
|
30
|
+
"""Normalised to one whole GPU, so a fractional/shared listing compares fairly with a
|
|
31
|
+
dedicated one (a listing with gpu_frac 0.25 at $0.21/h is $0.86/h for a whole GPU)."""
|
|
32
|
+
return self.usd_per_hour / self.gpu_frac if self.gpu_frac else self.usd_per_hour
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_offers(data: dict) -> list[Offer]:
|
|
36
|
+
"""`data` is the parsed JSON body of a GET to BUNDLES_URL (or a fixture of the same shape,
|
|
37
|
+
for tests: no network, no live prices, see tests/data/vast_bundles_sample.json)."""
|
|
38
|
+
out = []
|
|
39
|
+
for o in data.get("offers") or []:
|
|
40
|
+
try:
|
|
41
|
+
out.append(Offer(
|
|
42
|
+
gpu_name=str(o["gpu_name"]), num_gpus=int(o["num_gpus"]), gpu_frac=float(o.get("gpu_frac") or 1.0),
|
|
43
|
+
usd_per_hour=float(o["dph_total"]), reliability=float(o.get("reliability") or 0.0),
|
|
44
|
+
geolocation=str(o.get("geolocation") or "?")))
|
|
45
|
+
except (KeyError, TypeError, ValueError):
|
|
46
|
+
continue # one malformed listing is skipped, not a reason to fail the whole fetch
|
|
47
|
+
return out
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def fetch_offers(timeout_s: float = 15.0) -> list[Offer]:
|
|
51
|
+
"""A real network call to Vast.ai's public marketplace endpoint. Raises MarketError on any
|
|
52
|
+
failure (network, non-200, malformed JSON) instead of returning stale or fabricated data."""
|
|
53
|
+
req = urllib.request.Request(BUNDLES_URL, headers={"Accept": "application/json", "User-Agent": "spatial-computing-market/1"})
|
|
54
|
+
try:
|
|
55
|
+
with urllib.request.urlopen(req, timeout=timeout_s) as r:
|
|
56
|
+
if r.status != 200:
|
|
57
|
+
raise MarketError(f"Vast.ai returned HTTP {r.status}")
|
|
58
|
+
data = json.loads(r.read())
|
|
59
|
+
except MarketError:
|
|
60
|
+
raise
|
|
61
|
+
except (urllib.error.URLError, TimeoutError, json.JSONDecodeError, OSError) as e:
|
|
62
|
+
raise MarketError(f"could not reach or parse Vast.ai's marketplace ({type(e).__name__}: {e})") from e
|
|
63
|
+
return parse_offers(data)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def cheapest(offers: list[Offer], gpu_name_contains: str, min_reliability: float = 0.5) -> Offer | None:
|
|
67
|
+
"""The lowest per-whole-GPU price among offers whose name contains `gpu_name_contains`
|
|
68
|
+
(case-insensitive) and whose reliability is at least `min_reliability` (default 0.5: an
|
|
69
|
+
unreliable host is not a fair price to quote as THE price). None if nothing matches."""
|
|
70
|
+
cand = [o for o in offers if gpu_name_contains.lower() in o.gpu_name.lower() and o.reliability >= min_reliability]
|
|
71
|
+
return min(cand, key=lambda o: o.usd_per_hour_per_gpu) if cand else None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def spread_vs(offers: list[Offer], gpu_name_contains: str, neocloud_usd_per_hour: float,
|
|
75
|
+
min_reliability: float = 0.5) -> dict | None:
|
|
76
|
+
"""The arbitrage spread: the gap between the cheapest sufficiently-reliable marketplace price
|
|
77
|
+
for this GPU and a 'neocloud'/list price the CALLER supplies (never invented here). None if no
|
|
78
|
+
offer matches. `min_reliability` defaults to 0.5: an unreliable host is not a fair price to quote."""
|
|
79
|
+
c = cheapest(offers, gpu_name_contains, min_reliability)
|
|
80
|
+
if c is None:
|
|
81
|
+
return None
|
|
82
|
+
spread = neocloud_usd_per_hour - c.usd_per_hour_per_gpu
|
|
83
|
+
return {"market_usd_h": c.usd_per_hour_per_gpu, "neocloud_usd_h": neocloud_usd_per_hour,
|
|
84
|
+
"spread_usd_h": spread, "spread_pct": (spread / neocloud_usd_per_hour * 100) if neocloud_usd_per_hour else None,
|
|
85
|
+
"offer": c}
|
|
@@ -32,12 +32,13 @@ CATALOG = {
|
|
|
32
32
|
"mandel_numba_parallel": dict(title="Mandelbrot (multi-core)", doc="Iteration counts of the Mandelbrot set on a grid, Numba on all cores.", params={"n": (600, 16, 3000), "iters": (200, 10, 2000)}),
|
|
33
33
|
"pk_mandel_cpu": dict(title="Portable kernel: Mandelbrot", doc="The same kernel source that also runs on a Metal GPU, on the CPU.", params={"n": (512, 16, 2048), "iters": (200, 10, 2000)}),
|
|
34
34
|
"pk_batch_score_cpu": dict(title="Portable kernel: batch scoring", doc="Fraud/risk/ranking/anomaly-shaped batch scoring (synthetic signals, no real model) on the CPU.", params={"n": (512, 16, 2048), "signals": (16, 1, 200)}),
|
|
35
|
+
"pk_rtb_cpu": dict(title="Portable kernel: Real-time ad-bid score", doc="RTB-shaped batch scoring (synthetic signals, no real model) on the CPU.", params={"n": (512, 16, 2048), "signals": (16, 1, 200)}),
|
|
36
|
+
"pk_credit_cpu": dict(title="Portable kernel: Credit application score", doc="Credit/loan-application-shaped batch scoring (synthetic signals, no real model) on the CPU.", params={"n": (512, 16, 2048), "signals": (16, 1, 200)}),
|
|
37
|
+
"pk_claims_cpu": dict(title="Portable kernel: Insurance claim score", doc="Insurance-claim-shaped batch scoring (synthetic signals, no real model) on the CPU.", params={"n": (512, 16, 2048), "signals": (16, 1, 200)}),
|
|
38
|
+
"pk_alerts_cpu": dict(title="Portable kernel: Security alert score", doc="SIEM-alert-shaped batch scoring (synthetic signals, no real model) on the CPU.", params={"n": (512, 16, 2048), "signals": (16, 1, 200)}),
|
|
39
|
+
"pk_moderation_cpu": dict(title="Portable kernel: Content moderation score", doc="Content-moderation-shaped batch scoring (synthetic signals, no real model) on the CPU.", params={"n": (512, 16, 2048), "signals": (16, 1, 200)}),
|
|
40
|
+
"pk_telecom_cpu": dict(title="Portable kernel: Telecom fraud/billing score", doc="Telecom-fraud/billing-shaped batch scoring (synthetic signals, no real model) on the CPU.", params={"n": (512, 16, 2048), "signals": (16, 1, 200)}),
|
|
35
41
|
"matmul": dict(title="Matrix multiply", doc="Dense float64 matrix product of size n.", params={"n": (600, 16, 1500)}),
|
|
36
|
-
"heat_numba": dict(title="Heat diffusion", doc="2-D heat diffusion from a hot square (simulation engine, Numba).", params={"n": (200, 16, 800), "steps": (500, 1, 5000)}),
|
|
37
|
-
"nbody": dict(title="N-body", doc="Leapfrog N-body integration; returns the relative energy drift.", params={"bodies": (100, 2, 300), "steps": (400, 1, 2000)}),
|
|
38
|
-
"option_mc": dict(title="Option pricing (Monte Carlo)", doc="European call price by Monte Carlo (scientific engine).", params={"paths": (1_000_000, 1000, 5_000_000)}),
|
|
39
|
-
"harmonic_rk4": dict(title="Harmonic oscillator (RK4)", doc="Runge-Kutta solution of x'' = -omega^2 x, compared with the exact answer.", params={"omega": (1.0, 0.01, 100.0), "t_end": (6.0, 0.1, 1000.0), "steps": (2000, 10, 1_000_000)}),
|
|
40
|
-
"hologram_peak": dict(title="Hologram synthesis", doc="Synthesise a one-point hologram and reconstruct it (holographic engine).", params={"n": (256, 32, 1024)}),
|
|
41
42
|
"sha256_chain": dict(title="SHA-256 chain", doc="Hash-bound workload: memory bandwidth and SHA throughput.", params={"rounds": (200, 1, 2000)}),
|
|
42
43
|
}
|
|
43
44
|
|