spatial-computing 0.19.0__tar.gz → 0.21.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.19.0/spatial_computing.egg-info → spatial_computing-0.21.0}/PKG-INFO +1 -1
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/pyproject.toml +1 -1
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/__init__.py +1 -1
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/compute/workloads.py +11 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/kernel/library.py +24 -2
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/service.py +1 -0
- spatial_computing-0.21.0/spatial/runtime/arch.py +12 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/microvm.py +8 -1
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/planner.py +56 -8
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/runner.py +4 -2
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/unified/providers.py +3 -1
- {spatial_computing-0.19.0 → spatial_computing-0.21.0/spatial_computing.egg-info}/PKG-INFO +1 -1
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial_computing.egg-info/SOURCES.txt +1 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_kernel.py +13 -2
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_runtime.py +108 -1
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/LICENSE +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/README.md +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/setup.cfg +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/ai/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/ai/kvcache.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/ai/llm.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/cli.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/compute/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/compute/cost.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/compute/detect.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/compute/monitor.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/compute/scheduler.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/compute/taskqueue.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/compute/worker.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/core/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/core/auth.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/core/energy.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/core/ledger.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/core/model.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/core/protocol.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/core/registry.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fabric/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fabric/cuda.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fabric/devices.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fabric/metal.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fabric/metal_mandel.swift +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fabric/metal_run.swift +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fleet/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fleet/agent.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fleet/alerts.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fleet/dashboard.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fleet/ha.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/fleet/hub.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/holographic/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/holographic/cgh.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/holographic/model.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/intelligence/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/intelligence/predictor.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/interconnect/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/interconnect/collectives.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/interconnect/comm.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/interconnect/model.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/interconnect/tasks.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/kernel/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/kernel/dsl.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/memory/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/memory/fararray.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/memory/pageserver.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/memory/secure.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/memory/shared.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/memory/tiered.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/billing.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/db.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/invoice_rules.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/mailer.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/oidc.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/pdf.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/qr.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/security.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/server.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/app.js +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/fonts/DMMono-normal-400.woff2 +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/fonts/DMMono-normal-500.woff2 +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/fonts/InstrumentSerif-italic-400.woff2 +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/fonts/InstrumentSerif-normal-400.woff2 +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/fonts/Inter-normal-400.woff2 +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/fonts/Inter-normal-500.woff2 +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/fonts/Inter-normal-600.woff2 +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/fonts.css +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/index.html +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/logo.svg +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/static/style.css +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/totp.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/ubl.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/platform/vat.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/__main__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/backends/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/codegen.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/compiler.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/ir.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/lexer.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/parser.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/qir.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/runtime.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/q/sim.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/desktop/Dockerfile +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/desktop/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/desktop/start.sh +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/envs.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/inspect.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/runtime/toolchain.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/scientific/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/scientific/jobs.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/simulation/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/simulation/heat.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/simulation/nbody.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/unified/__init__.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/unified/model.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial/unified/planner.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial_computing.egg-info/dependency_links.txt +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial_computing.egg-info/entry_points.txt +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial_computing.egg-info/requires.txt +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial_computing.egg-info/top_level.txt +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_auth.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_compute.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_core.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_dashboard.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_domains.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_engines.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_fabric.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_fleet.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_ha.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_hardening.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_interconnect.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_memory.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_optimizer.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_platform.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_platform2.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_q.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_qr.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_quorum.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_real_servers.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_sso.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_unified.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_v02.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_v03.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_v05.py +0 -0
- {spatial_computing-0.19.0 → spatial_computing-0.21.0}/tests/test_v07.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spatial-computing
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.0
|
|
4
4
|
Summary: Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing, hybrid quantum language)
|
|
5
5
|
Author: Spatial Computing contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "spatial-computing"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.21.0"
|
|
8
8
|
description = "Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing, hybrid quantum language)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -164,6 +164,15 @@ def pk_collatz_metal(n: int, limit: int) -> int:
|
|
|
164
164
|
return _pk("collatz", "metal", n, limit=limit)
|
|
165
165
|
|
|
166
166
|
|
|
167
|
+
def pk_batch_score_cpu(n: int, signals: int) -> int:
|
|
168
|
+
"""Portable kernel (spatial.kernel): a batch-scoring workload (fraud/risk/ranking-shaped), on the CPU."""
|
|
169
|
+
return _pk("batch_score", "cpu", n, signals=signals)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def pk_batch_score_metal(n: int, signals: int) -> int:
|
|
173
|
+
return _pk("batch_score", "metal", n, signals=signals)
|
|
174
|
+
|
|
175
|
+
|
|
167
176
|
def montecarlo_pi(samples: int, seed: int = 0) -> float:
|
|
168
177
|
rng = np.random.default_rng(seed)
|
|
169
178
|
inside = 0
|
|
@@ -257,6 +266,8 @@ REGISTRY = {
|
|
|
257
266
|
"pk_mandel_metal": pk_mandel_metal,
|
|
258
267
|
"pk_collatz_cpu": pk_collatz_cpu,
|
|
259
268
|
"pk_collatz_metal": pk_collatz_metal,
|
|
269
|
+
"pk_batch_score_cpu": pk_batch_score_cpu,
|
|
270
|
+
"pk_batch_score_metal": pk_batch_score_metal,
|
|
260
271
|
"heat_numpy": heat_numpy,
|
|
261
272
|
"heat_numba": heat_numba,
|
|
262
273
|
"nbody": nbody,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Kernels written in the portable language. Each runs unchanged on CPU and Metal; CUDA C
|
|
1
|
+
"""Kernels written in the portable language. Each runs unchanged on CPU and Metal; CUDA C, HIP, and Triton are generated."""
|
|
2
2
|
from .dsl import kernel
|
|
3
3
|
|
|
4
4
|
|
|
@@ -43,4 +43,26 @@ def waves(i: int, j: int, n: int, terms: int):
|
|
|
43
43
|
return int((s + 8.0) * 1000.0)
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
@kernel
|
|
47
|
+
def batch_score(i: int, j: int, n: int, signals: int):
|
|
48
|
+
"""A batch-scoring kernel: element (i, j) is one of n*n independent items, scored by combining
|
|
49
|
+
`signals` weighted features through a logistic sum — the same shape as scoring a transaction for
|
|
50
|
+
fraud/credit risk, ranking a search or ad result, flagging an anomaly, or filtering content, whichever
|
|
51
|
+
software already does that scoring in a batch or a stream. The features and weights here are SYNTHETIC
|
|
52
|
+
(no real data, no trained model): this demonstrates that the planner places and measures a batch-scoring
|
|
53
|
+
job exactly like it places Mandelbrot or Collatz, not a validated scoring model for any one domain.
|
|
54
|
+
Returns the score quantised to [0, 10000] (hundredths of a percent)."""
|
|
55
|
+
idx = i * n + j
|
|
56
|
+
x1 = float(idx % 2000) / 20.0 - 50.0
|
|
57
|
+
x2 = float(i) / float(n) - 0.5
|
|
58
|
+
z = 0.0
|
|
59
|
+
k = 0
|
|
60
|
+
while k < signals:
|
|
61
|
+
w = sin(float(k + 1) * 0.37) * 1.3
|
|
62
|
+
z += w * (x1 / (float(k) + 1.0) + x2)
|
|
63
|
+
k += 1
|
|
64
|
+
p = 1.0 / (1.0 + exp(-z))
|
|
65
|
+
return int(p * 10000.0)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
LIBRARY = {"mandelbrot": mandelbrot, "collatz": collatz, "waves": waves, "batch_score": batch_score}
|
|
@@ -31,6 +31,7 @@ CATALOG = {
|
|
|
31
31
|
"montecarlo_pi": dict(title="Monte Carlo pi", doc="Estimate pi by random sampling (CPU-bound, embarrassingly parallel).", params={"samples": (1_000_000, 1000, 50_000_000)}),
|
|
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
|
+
"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)}),
|
|
34
35
|
"matmul": dict(title="Matrix multiply", doc="Dense float64 matrix product of size n.", params={"n": (600, 16, 1500)}),
|
|
35
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)}),
|
|
36
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)}),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""The one place that maps `platform.machine()` to the architecture names used everywhere else in this
|
|
2
|
+
package (matching `inspect.py`'s ELF/Mach-O/PE architecture names: x86_64, aarch64, i386, arm). A separate
|
|
3
|
+
module so `planner.py`, `microvm.py` and `runner.py` can all import it without a circular import."""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import platform
|
|
7
|
+
|
|
8
|
+
_MACHINE = {"AMD64": "x86_64", "arm64": "aarch64"}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def host_arch() -> str:
|
|
12
|
+
return _MACHINE.get(platform.machine(), platform.machine())
|
|
@@ -18,6 +18,8 @@ import time
|
|
|
18
18
|
from dataclasses import dataclass
|
|
19
19
|
from pathlib import Path
|
|
20
20
|
|
|
21
|
+
from .arch import host_arch
|
|
22
|
+
|
|
21
23
|
VENDOR = Path(__file__).resolve().parents[2] / "vendor"
|
|
22
24
|
KERNEL = VENDOR / "vmlinuz-virt"
|
|
23
25
|
BUSYBOX = VENDOR / "busybox-x86_64"
|
|
@@ -77,7 +79,12 @@ class VmResult:
|
|
|
77
79
|
|
|
78
80
|
|
|
79
81
|
def available() -> dict:
|
|
80
|
-
|
|
82
|
+
"""This micro-VM is x86_64-only (vendored kernel and busybox, qemu-system-x86_64): on a different host
|
|
83
|
+
architecture it is correctly unavailable, not silently wrong (there is no aarch64 kernel/busybox vendored
|
|
84
|
+
here, so a host_arch() == "aarch64" node would otherwise look for an x86_64 emulator it cannot use as a
|
|
85
|
+
same-architecture micro-VM)."""
|
|
86
|
+
x86 = host_arch() == "x86_64"
|
|
87
|
+
return {"qemu": x86 and shutil.which("qemu-system-x86_64"), "kernel": x86 and KERNEL.exists(), "busybox": x86 and BUSYBOX.exists()}
|
|
81
88
|
|
|
82
89
|
|
|
83
90
|
def run_elf(elf_path: str, args: list[str] | None = None, accel: str = "hvf", mem_mb: int = 256,
|
|
@@ -14,6 +14,7 @@ from dataclasses import dataclass, field
|
|
|
14
14
|
from pathlib import Path
|
|
15
15
|
|
|
16
16
|
from . import microvm
|
|
17
|
+
from .arch import host_arch
|
|
17
18
|
from .inspect import Artifact, inspect
|
|
18
19
|
|
|
19
20
|
|
|
@@ -78,7 +79,7 @@ def find_oci() -> tuple[str, str, dict] | None:
|
|
|
78
79
|
def host_caps(node=None) -> dict:
|
|
79
80
|
import platform
|
|
80
81
|
caps = {"os": {"Darwin": "macos", "Linux": "linux", "Windows": "windows"}.get(platform.system(), "?"),
|
|
81
|
-
"arch":
|
|
82
|
+
"arch": host_arch(),
|
|
82
83
|
"node": shutil.which("node"), "wine": find_wine(),
|
|
83
84
|
"docker": (find_oci() or (None,))[0], # only a daemon that answers counts
|
|
84
85
|
"qemu_x86": shutil.which("qemu-system-x86_64"),
|
|
@@ -112,9 +113,24 @@ def plan(art: Artifact, caps: dict | None = None) -> list[Route]:
|
|
|
112
113
|
"software emulation (works without HVF or across CPU families)" if tcg else
|
|
113
114
|
"no kernel/emulator available for this guest architecture",
|
|
114
115
|
"5-30x slower CPU", "emulated VM"))
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
if same_arch:
|
|
117
|
+
R.append(Route("container", bool(caps["docker"]),
|
|
118
|
+
f"{caps['docker']} reachable" if caps["docker"] else "no Docker/Podman with a running daemon",
|
|
119
|
+
"Linux VM shared by containers on macOS", "container: no network, read-only root, no capabilities, 256 MiB, shares the VM kernel"))
|
|
120
|
+
else:
|
|
121
|
+
plat = _oci_platform(art.arch)
|
|
122
|
+
if not plat:
|
|
123
|
+
emulated, reason = False, f"unrecognised architecture {art.arch} for container emulation"
|
|
124
|
+
elif not caps["docker"]:
|
|
125
|
+
emulated, reason = False, "no Docker/Podman with a running daemon"
|
|
126
|
+
else:
|
|
127
|
+
oci = find_oci()
|
|
128
|
+
emulated = bool(oci) and _cross_arch_runnable(oci[1], oci[2], plat)
|
|
129
|
+
reason = (f"{caps['docker']} reachable, {plat} binary run through QEMU user-mode emulation (binfmt_misc)" if emulated
|
|
130
|
+
else f"Docker/Podman reachable but no QEMU binfmt_misc handler registered for linux/{plat}")
|
|
131
|
+
R.append(Route("container", emulated, reason,
|
|
132
|
+
"Linux VM shared by containers on macOS, PLUS QEMU user-mode emulation: 5-20x slower, not measured here" if emulated else "none",
|
|
133
|
+
"container: no network, read-only root, no capabilities, 256 MiB, shares the VM kernel, emulated CPU" if emulated else ""))
|
|
118
134
|
elif art.format == "pe":
|
|
119
135
|
R.append(Route("native", caps["os"] == "windows" and same_arch,
|
|
120
136
|
"same OS" if caps["os"] == "windows" else "host is not Windows", "none", "none"))
|
|
@@ -139,6 +155,34 @@ def plan(art: Artifact, caps: dict | None = None) -> list[Route]:
|
|
|
139
155
|
|
|
140
156
|
OCI_IMAGE = "alpine:3.20"
|
|
141
157
|
|
|
158
|
+
# ELF/Mach-O/PE architecture name (see inspect.py) -> the --platform suffix the OCI daemon expects
|
|
159
|
+
_OCI_PLATFORM = {"x86_64": "amd64", "aarch64": "arm64"}
|
|
160
|
+
_BINFMT_CACHE: dict[tuple[str, str], bool] = {}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _oci_platform(arch: list[str]) -> str | None:
|
|
164
|
+
for a in arch:
|
|
165
|
+
if a in _OCI_PLATFORM:
|
|
166
|
+
return _OCI_PLATFORM[a]
|
|
167
|
+
return None
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _cross_arch_runnable(exe: str, env: dict, plat: str) -> bool:
|
|
171
|
+
"""True if this OCI daemon can run a foreign-architecture ("amd64"/"arm64"...) container RIGHT NOW: QEMU
|
|
172
|
+
user-mode emulation registered via binfmt_misc inside the daemon's Linux VM (standard Docker/Podman
|
|
173
|
+
mechanism). This is a real, tiny container run, cached per (daemon, platform) for this process:
|
|
174
|
+
binfmt_misc lives inside the daemon's own VM, which we cannot inspect as a file from macOS, so we test
|
|
175
|
+
it instead of guessing."""
|
|
176
|
+
key = (exe, env.get("DOCKER_HOST", ""), plat)
|
|
177
|
+
if key not in _BINFMT_CACHE:
|
|
178
|
+
try:
|
|
179
|
+
r = subprocess.run([exe, "run", "--rm", "--platform", f"linux/{plat}", OCI_IMAGE, "true"],
|
|
180
|
+
capture_output=True, timeout=60, env=env)
|
|
181
|
+
_BINFMT_CACHE[key] = r.returncode == 0
|
|
182
|
+
except Exception:
|
|
183
|
+
_BINFMT_CACHE[key] = False
|
|
184
|
+
return _BINFMT_CACHE[key]
|
|
185
|
+
|
|
142
186
|
|
|
143
187
|
MAX_SHARE_BYTES = 64 * 2 ** 20
|
|
144
188
|
|
|
@@ -171,12 +215,14 @@ def _untar_into(data: bytes, d: str) -> int:
|
|
|
171
215
|
return n
|
|
172
216
|
|
|
173
217
|
|
|
174
|
-
def _run_container(path: str, args: list[str], timeout_s: float, t0: float, allow_network: bool = False, share_dir: str | None = None) -> Execution:
|
|
218
|
+
def _run_container(path: str, args: list[str], timeout_s: float, t0: float, allow_network: bool = False, share_dir: str | None = None, platform: str | None = None) -> Execution:
|
|
175
219
|
"""Run a static Linux ELF in a locked-down container. The file is streamed in through stdin (works with remote
|
|
176
220
|
daemons such as Colima) into a small exec tmpfs; the root filesystem stays read-only. No network, no capabilities,
|
|
177
221
|
non-root user, 256 MiB, 64 processes. Network and a writable shared folder are OFF unless asked for:
|
|
178
222
|
`allow_network`, and `share_dir`, a host folder that is copied into a volume mounted at /work before the run and
|
|
179
|
-
whose changes are copied back afterwards (a copy, not a live mount: it works with remote daemons).
|
|
223
|
+
whose changes are copied back afterwards (a copy, not a live mount: it works with remote daemons).
|
|
224
|
+
`platform` ("amd64"/"arm64"...) runs a foreign architecture through QEMU user-mode emulation (binfmt_misc);
|
|
225
|
+
leave it None for the host's own architecture."""
|
|
180
226
|
oci = find_oci()
|
|
181
227
|
if oci is None:
|
|
182
228
|
return Execution("container", False, "", 0.0, {"not_runnable": "no container daemon reachable"})
|
|
@@ -194,7 +240,8 @@ def _run_container(path: str, args: list[str], timeout_s: float, t0: float, allo
|
|
|
194
240
|
subprocess.run([exe, "run", "--rm", "-i", "--network", "none", "-v", f"{vol}:/work", OCI_IMAGE, "sh", "-c", "cd /work && tar x && chmod -R a+rwX ."],
|
|
195
241
|
input=_tar_dir(d), capture_output=True, check=True, timeout=120, env=env)
|
|
196
242
|
mounts = ["-v", f"{vol}:/work:rw", "-w", "/work"]
|
|
197
|
-
cmd = [exe, "run", "--rm", "-i", "--
|
|
243
|
+
cmd = [exe, "run", "--rm", "-i", *(["--platform", f"linux/{platform}"] if platform else []),
|
|
244
|
+
"--network", "bridge" if allow_network else "none", *mounts, "--read-only", "--tmpfs", "/app:rw,exec,nosuid,mode=1777,size=64m",
|
|
198
245
|
"--cap-drop", "ALL", "--security-opt", "no-new-privileges", "--memory", "256m", "--pids-limit", "64", "--user", "65534:65534",
|
|
199
246
|
OCI_IMAGE, "sh", "-c", f"cat > /app/{prog} && chmod +x /app/{prog} && exec /app/{prog} \"$@\"", "sh", *args]
|
|
200
247
|
try:
|
|
@@ -256,7 +303,8 @@ def execute(path: str, args: list[str] | None = None, route: str | None = None,
|
|
|
256
303
|
return Execution(chosen.name, r.returncode == 0, r.stdout.strip(), time.perf_counter() - t0,
|
|
257
304
|
{"stderr": r.stderr[-300:]})
|
|
258
305
|
if chosen.name == "container":
|
|
259
|
-
|
|
306
|
+
plat = None if host_arch() in art.arch else _oci_platform(art.arch)
|
|
307
|
+
return _run_container(path, args, timeout_s, t0, allow_network, share_dir, platform=plat)
|
|
260
308
|
if chosen.name == "wine":
|
|
261
309
|
env = {**os.environ, "WINEDEBUG": "-all", "WINEPREFIX": str(Path.home() / ".local/share/spatial/wineprefix")}
|
|
262
310
|
r = subprocess.run([find_wine(), path, *args], capture_output=True, text=True, timeout=timeout_s, env=env)
|
|
@@ -17,6 +17,7 @@ from pathlib import Path
|
|
|
17
17
|
from ..core.auth import authorizer_from_file, require
|
|
18
18
|
from ..core.protocol import RpcClient, RpcServer
|
|
19
19
|
from . import microvm
|
|
20
|
+
from .arch import host_arch
|
|
20
21
|
from .inspect import inspect
|
|
21
22
|
|
|
22
23
|
MAX_ELF = 64 * 1024 * 1024
|
|
@@ -40,8 +41,9 @@ def _handler(h: dict, blob: bytes):
|
|
|
40
41
|
path = f.name
|
|
41
42
|
try:
|
|
42
43
|
art = inspect(path)
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
harch = host_arch()
|
|
45
|
+
if art.format != "elf" or harch not in art.arch:
|
|
46
|
+
raise ValueError(f"runner only accepts Linux {harch} ELF binaries (this node's own architecture), got {art.format}/{art.arch}")
|
|
45
47
|
accel = "hvf" if h.get("accel", "hvf") == "hvf" else "tcg"
|
|
46
48
|
r = microvm.run_elf(path, args, accel=accel, mem_mb=min(int(h.get("mem_mb", 256)), 1024),
|
|
47
49
|
timeout_s=min(float(h.get("timeout_s", 120)), MAX_TIMEOUT))
|
|
@@ -36,6 +36,8 @@ FAMILIES = {
|
|
|
36
36
|
# but has no run path here, so it is not offered as an option.
|
|
37
37
|
"pk_mandel": dict(variants={"cpu": "pk_mandel_cpu", "gpu_metal": "pk_mandel_metal"}, scale="n", exp=2.0, min=8, exact=False, tol=1e-3),
|
|
38
38
|
"pk_collatz": dict(variants={"cpu": "pk_collatz_cpu", "gpu_metal": "pk_collatz_metal"}, scale="n", exp=2.0, min=8, exact=True),
|
|
39
|
+
# batch scoring (fraud/risk/ranking/anomaly-shaped): same "one job, several devices" idea, a different work shape
|
|
40
|
+
"pk_batch_score": dict(variants={"cpu": "pk_batch_score_cpu", "gpu_metal": "pk_batch_score_metal"}, scale="n", exp=2.0, min=8, exact=False, tol=1e-3),
|
|
39
41
|
"heat": dict(variants={"numpy": "heat_numpy", "numba": "heat_numba"}, scale="steps", exp=1.0, min=2, exact=False),
|
|
40
42
|
"nbody": dict(variants={"cpu": "nbody"}, scale="steps", exp=1.0, min=2, exact=False),
|
|
41
43
|
"hologram": dict(variants={"cpu": "hologram_peak"}, scale="n", exp=2.0, min=32, exact=True),
|
|
@@ -50,7 +52,7 @@ def _same(a, b, exact: bool, tol: float = 1e-6) -> bool:
|
|
|
50
52
|
|
|
51
53
|
def _variant_available(workload: str) -> str | None:
|
|
52
54
|
"""None if the variant can run here, else why not."""
|
|
53
|
-
if workload in ("mandel_f32_metal", "pk_mandel_metal", "pk_collatz_metal"):
|
|
55
|
+
if workload in ("mandel_f32_metal", "pk_mandel_metal", "pk_collatz_metal", "pk_batch_score_metal"):
|
|
54
56
|
from ..fabric import metal
|
|
55
57
|
return None if metal.available() else "no Metal GPU (macOS with swiftc is required)"
|
|
56
58
|
if workload == "mandel_f32_cuda":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spatial-computing
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.0
|
|
4
4
|
Summary: Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing, hybrid quantum language)
|
|
5
5
|
Author: Spatial Computing contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -4,7 +4,7 @@ import pytest
|
|
|
4
4
|
|
|
5
5
|
from spatial.fabric import metal
|
|
6
6
|
from spatial.kernel import KernelError, kernel
|
|
7
|
-
from spatial.kernel.library import LIBRARY, collatz, mandelbrot, waves
|
|
7
|
+
from spatial.kernel.library import LIBRARY, batch_score, collatz, mandelbrot, waves
|
|
8
8
|
|
|
9
9
|
needs_metal = pytest.mark.skipif(not metal.available(), reason="no Metal")
|
|
10
10
|
|
|
@@ -46,6 +46,8 @@ def test_float_kernels_agree_within_tolerance():
|
|
|
46
46
|
assert np.mean(a != b) < 0.01 # float32 chaos at the set's boundary: a few pixels may differ
|
|
47
47
|
w1, w2 = waves.run("cpu", 64, terms=8), waves.run("metal", 64, terms=8)
|
|
48
48
|
assert np.abs(w1.astype(np.int64) - w2.astype(np.int64)).max() <= 3 # GPU sin/cos differ in the last bits
|
|
49
|
+
r1, r2 = batch_score.run("cpu", 64, signals=16), batch_score.run("metal", 64, signals=16)
|
|
50
|
+
assert np.abs(r1.astype(np.int64) - r2.astype(np.int64)).max() <= 5
|
|
49
51
|
|
|
50
52
|
|
|
51
53
|
def test_unsupported_constructs_are_refused():
|
|
@@ -100,7 +102,16 @@ def test_triton_source_handles_ints_floats_and_control_flow_syntactically():
|
|
|
100
102
|
|
|
101
103
|
|
|
102
104
|
def test_library_complete():
|
|
103
|
-
assert set(LIBRARY) == {"mandelbrot", "collatz", "waves"}
|
|
105
|
+
assert set(LIBRARY) == {"mandelbrot", "collatz", "waves", "batch_score"}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_batch_score_is_a_plausible_probability_and_matches_cpu_metal():
|
|
109
|
+
out = batch_score.run("cpu", 64, signals=16)
|
|
110
|
+
assert out.min() >= 0 and out.max() <= 10000 and out.std() > 0 # quantised probability, not a constant
|
|
111
|
+
tl = batch_score.to_triton()
|
|
112
|
+
assert "@triton.jit" in tl and "while" in tl and "tl.exp" in tl
|
|
113
|
+
compile(tl, "<triton batch_score>", "exec")
|
|
114
|
+
|
|
104
115
|
|
|
105
116
|
|
|
106
117
|
def test_planner_offers_portable_kernel_families():
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import shutil
|
|
2
|
+
import subprocess
|
|
3
|
+
import time
|
|
2
4
|
from pathlib import Path
|
|
3
5
|
|
|
4
6
|
import pytest
|
|
@@ -6,8 +8,10 @@ import pytest
|
|
|
6
8
|
from spatial.compute import workloads
|
|
7
9
|
from spatial.runtime import execute, inspect, plan
|
|
8
10
|
from spatial.runtime import microvm
|
|
11
|
+
from spatial.runtime.arch import host_arch
|
|
9
12
|
from spatial.runtime.envs import IsolatedEnv, detect_interpreters
|
|
10
|
-
from spatial.runtime.
|
|
13
|
+
from spatial.runtime.inspect import Artifact
|
|
14
|
+
from spatial.runtime.planner import find_oci, find_wine, host_caps
|
|
11
15
|
|
|
12
16
|
BUILD = Path(__file__).resolve().parents[1] / "benchmarks" / "build"
|
|
13
17
|
needs_build = pytest.mark.skipif(not (BUILD / "bench.wasm").exists(),
|
|
@@ -277,3 +281,106 @@ def test_remote_desktop_moves_single_files_both_ways_with_a_size_limit_and_safe_
|
|
|
277
281
|
d.upload(str(big))
|
|
278
282
|
finally:
|
|
279
283
|
d.stop()
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
# ------------------------------------------------------------------------------------------------ ARM64 / cross-arch (robotics, automotive, consoles: mostly ARM edge hardware)
|
|
287
|
+
needs_docker = pytest.mark.skipif(find_oci() is None, reason="no reachable container daemon")
|
|
288
|
+
_ELF_MACHINE_CODE = {"x86_64": 0x3E, "aarch64": 0xB7}
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def _foreign_arch() -> str:
|
|
292
|
+
"""An architecture this host is NOT, so the cross-arch branch is exercised rather than the native one."""
|
|
293
|
+
return "x86_64" if host_arch() == "aarch64" else "aarch64"
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def _fake_elf(machine_code: int) -> bytes:
|
|
297
|
+
"""Just enough of an ELF header for inspect() to report format='elf' and this machine code: no real
|
|
298
|
+
code, so it only exercises the architecture gate, never an actual execution."""
|
|
299
|
+
import struct
|
|
300
|
+
b = bytearray(20)
|
|
301
|
+
b[0:4] = b"\x7fELF"
|
|
302
|
+
b[4], b[5], b[6], b[7] = 2, 1, 1, 0 # 64-bit, little-endian, version 1, SYSV (-> linux)
|
|
303
|
+
b[16:18] = struct.pack("<H", 2) # e_type (unused by inspect())
|
|
304
|
+
b[18:20] = struct.pack("<H", machine_code) # e_machine
|
|
305
|
+
return bytes(b)
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def test_cross_arch_elf_is_refused_without_a_daemon_with_a_clear_reason():
|
|
309
|
+
art = Artifact(path="x", format="elf", os="linux", arch=[_foreign_arch()])
|
|
310
|
+
r = next(x for x in plan(art, {**host_caps(), "docker": None}) if x.name == "container")
|
|
311
|
+
assert not r.feasible and "no Docker/Podman" in r.reason
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def test_unrecognised_cross_arch_is_named_not_silently_refused_or_allowed():
|
|
315
|
+
art = Artifact(path="x", format="elf", os="linux", arch=["riscv"])
|
|
316
|
+
r = next(x for x in plan(art, {**host_caps(), "docker": "docker"}) if x.name == "container") # recognised-arch check comes first: no daemon probe needed
|
|
317
|
+
assert not r.feasible and "unrecognised architecture" in r.reason
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def test_cross_arch_reason_never_claims_native_and_distinguishes_emulated_from_same_arch():
|
|
321
|
+
foreign, native = Artifact(path="x", format="elf", os="linux", arch=[_foreign_arch()]), Artifact(path="x", format="elf", os="linux", arch=[host_arch()])
|
|
322
|
+
rf, rn = next(x for x in plan(foreign) if x.name == "container"), next(x for x in plan(native) if x.name == "container")
|
|
323
|
+
assert "emulat" not in rn.reason.lower() # same-arch route never mentions emulation
|
|
324
|
+
assert "same CPU" not in rf.reason and "native" not in rf.reason.lower() # cross-arch route never claims to be native
|
|
325
|
+
if rf.feasible:
|
|
326
|
+
assert "emulat" in rf.isolation.lower() and "emulat" in rf.expected_overhead.lower()
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
@needs_docker
|
|
330
|
+
def test_cross_arch_route_against_the_real_daemon_is_emulated_or_names_the_missing_handler():
|
|
331
|
+
art = Artifact(path="x", format="elf", os="linux", arch=[_foreign_arch()])
|
|
332
|
+
r = next(x for x in plan(art) if x.name == "container")
|
|
333
|
+
assert r.feasible == ("emulat" in r.reason.lower())
|
|
334
|
+
assert r.feasible or "binfmt_misc handler" in r.reason # daemon reachable, arch recognised: must be one or the other
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
@needs_docker
|
|
338
|
+
def test_cross_arch_container_run_passes_the_same_lockdown_flags_as_the_native_route():
|
|
339
|
+
from spatial.runtime import planner as _p
|
|
340
|
+
art = Artifact(path="x", format="elf", os="linux", arch=[_foreign_arch()])
|
|
341
|
+
r = next(x for x in plan(art) if x.name == "container")
|
|
342
|
+
if not r.feasible:
|
|
343
|
+
pytest.skip("no QEMU binfmt_misc handler registered for " + _foreign_arch())
|
|
344
|
+
calls = []
|
|
345
|
+
real_run = subprocess.run
|
|
346
|
+
def spy(cmd, *a, **k):
|
|
347
|
+
calls.append(cmd)
|
|
348
|
+
return real_run(cmd, *a, **k)
|
|
349
|
+
subprocess.run = spy
|
|
350
|
+
try:
|
|
351
|
+
_p._run_container(str(Path(__file__)), [], 30, time.perf_counter(), platform=_p._oci_platform([_foreign_arch()]))
|
|
352
|
+
finally:
|
|
353
|
+
subprocess.run = real_run
|
|
354
|
+
run_cmd = next(c for c in calls if len(c) > 2 and c[1:3] == ["run", "--rm"])
|
|
355
|
+
for flag in ("--read-only", "--cap-drop", "ALL", "--platform", f"linux/{_p._oci_platform([_foreign_arch()])}"):
|
|
356
|
+
assert flag in run_cmd
|
|
357
|
+
assert "--network" in run_cmd and "none" in run_cmd[run_cmd.index("--network") + 1]
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
# ------------------------------------------------------------------------------------------------ fleet node architecture (runner.py no longer hardcodes x86_64)
|
|
361
|
+
def test_runner_refuses_an_elf_of_a_foreign_architecture_and_names_its_own():
|
|
362
|
+
from spatial.runtime.runner import _handler
|
|
363
|
+
foreign = _foreign_arch()
|
|
364
|
+
with pytest.raises(ValueError) as e:
|
|
365
|
+
_handler({"op": "run_elf"}, _fake_elf(_ELF_MACHINE_CODE[foreign]))
|
|
366
|
+
msg = str(e.value)
|
|
367
|
+
assert host_arch() in msg and foreign in msg and "this node's own architecture" in msg
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
def test_runner_passes_the_arch_gate_for_its_own_architecture(monkeypatch):
|
|
371
|
+
from spatial.runtime import runner as _r
|
|
372
|
+
# stop short of actually booting a micro-VM: the gate under test is the arch check, not execution
|
|
373
|
+
def stub(*a, **k):
|
|
374
|
+
raise RuntimeError("stub: arch gate passed")
|
|
375
|
+
monkeypatch.setattr(_r.microvm, "run_elf", stub)
|
|
376
|
+
with pytest.raises(RuntimeError, match="stub: arch gate passed"):
|
|
377
|
+
_r._handler({"op": "run_elf"}, _fake_elf(_ELF_MACHINE_CODE[host_arch()]))
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def test_microvm_is_correctly_unavailable_on_a_non_x86_64_host(monkeypatch):
|
|
381
|
+
"""This micro-VM only ever vendored x86_64 (busybox, kernel, qemu-system-x86_64): on any other host
|
|
382
|
+
architecture it must say so, not silently look for an x86_64 emulator it cannot use as a same-arch VM."""
|
|
383
|
+
from spatial.runtime import microvm as _m
|
|
384
|
+
monkeypatch.setattr(_m, "host_arch", lambda: "aarch64")
|
|
385
|
+
avail = _m.available()
|
|
386
|
+
assert not avail["qemu"] and not avail["kernel"] and not avail["busybox"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial_computing.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial_computing.egg-info/requires.txt
RENAMED
|
File without changes
|
{spatial_computing-0.19.0 → spatial_computing-0.21.0}/spatial_computing.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|