spatial-computing 0.24.0__tar.gz → 0.25.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.24.0 → spatial_computing-0.25.0}/PKG-INFO +1 -1
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/pyproject.toml +1 -1
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/__init__.py +1 -1
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/cli.py +17 -7
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/market/__init__.py +4 -1
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/market/vast.py +46 -7
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/PKG-INFO +1 -1
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_market.py +45 -9
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/LICENSE +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/README.md +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/setup.cfg +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/ai/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/ai/kvcache.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/ai/llm.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/compute/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/compute/cost.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/compute/detect.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/compute/monitor.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/compute/scheduler.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/compute/taskqueue.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/compute/worker.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/compute/workloads.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/core/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/core/auth.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/core/energy.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/core/ledger.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/core/model.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/core/protocol.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/core/registry.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fabric/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fabric/cuda.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fabric/devices.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fabric/metal.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fabric/metal_mandel.swift +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fabric/metal_run.swift +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fleet/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fleet/agent.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fleet/alerts.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fleet/dashboard.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fleet/ha.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/fleet/hub.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/intelligence/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/intelligence/predictor.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/interconnect/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/interconnect/collectives.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/interconnect/comm.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/interconnect/model.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/interconnect/tasks.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/kernel/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/kernel/dsl.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/kernel/library.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/memory/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/memory/fararray.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/memory/pageserver.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/memory/secure.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/memory/shared.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/memory/tiered.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/billing.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/db.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/invoice_rules.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/mailer.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/oidc.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/pdf.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/qr.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/security.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/server.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/service.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/app.js +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/fonts/DMMono-normal-400.woff2 +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/fonts/DMMono-normal-500.woff2 +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/fonts/InstrumentSerif-italic-400.woff2 +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/fonts/InstrumentSerif-normal-400.woff2 +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/fonts/Inter-normal-400.woff2 +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/fonts/Inter-normal-500.woff2 +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/fonts/Inter-normal-600.woff2 +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/fonts.css +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/index.html +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/logo.svg +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/static/style.css +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/totp.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/ubl.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/platform/vat.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/arch.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/desktop/Dockerfile +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/desktop/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/desktop/start.sh +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/envs.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/inspect.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/microvm.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/planner.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/runner.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/runtime/toolchain.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/unified/__init__.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/unified/model.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/unified/planner.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial/unified/providers.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/SOURCES.txt +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/dependency_links.txt +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/entry_points.txt +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/requires.txt +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/top_level.txt +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_auth.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_compute.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_core.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_dashboard.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_domains.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_engines.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_fabric.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_fleet.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_ha.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_hardening.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_interconnect.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_kernel.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_memory.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_platform.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_platform2.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_qr.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_quorum.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_real_servers.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_runtime.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_sso.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_unified.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_v02.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_v03.py +0 -0
- {spatial_computing-0.24.0 → spatial_computing-0.25.0}/tests/test_v05.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spatial-computing
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.0
|
|
4
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
|
|
@@ -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.25.0"
|
|
8
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"
|
|
@@ -240,25 +240,34 @@ def cmd_devices(a):
|
|
|
240
240
|
|
|
241
241
|
|
|
242
242
|
def cmd_market(a):
|
|
243
|
-
from .market import MarketError, cheapest, fetch_offers, spread_vs
|
|
243
|
+
from .market import MarketError, cheapest, cheapest_for, fetch_offers, spread_for, spread_vs
|
|
244
244
|
try:
|
|
245
245
|
offers = fetch_offers()
|
|
246
246
|
except MarketError as e:
|
|
247
247
|
print(f"spatial: {e}", file=sys.stderr)
|
|
248
248
|
return 1
|
|
249
|
+
label = f"vertical {a.vertical!r}" if a.vertical else a.gpu
|
|
250
|
+
try:
|
|
251
|
+
if a.neocloud_usd_per_hour is not None:
|
|
252
|
+
r = spread_for(offers, a.vertical, a.neocloud_usd_per_hour, a.min_reliability) if a.vertical else \
|
|
253
|
+
spread_vs(offers, a.gpu, a.neocloud_usd_per_hour, a.min_reliability)
|
|
254
|
+
else:
|
|
255
|
+
r = None
|
|
256
|
+
c = cheapest_for(offers, a.vertical, a.min_reliability) if a.vertical else cheapest(offers, a.gpu, a.min_reliability)
|
|
257
|
+
except MarketError as e:
|
|
258
|
+
print(f"spatial: {e}", file=sys.stderr)
|
|
259
|
+
return 1
|
|
249
260
|
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
261
|
if r is None:
|
|
252
|
-
print(f"spatial: no Vast.ai offer for {
|
|
262
|
+
print(f"spatial: no Vast.ai offer for {label} at reliability >= {a.min_reliability} right now", file=sys.stderr)
|
|
253
263
|
return 1
|
|
254
264
|
o = r["offer"]
|
|
255
|
-
print(f"cheapest {
|
|
265
|
+
print(f"cheapest {label} on Vast.ai right now: {r['market_usd_h']:.3f} $/h ({o.gpu_name}, reliability {o.reliability:.3f}, {o.geolocation})")
|
|
256
266
|
print(f"your neocloud reference: {r['neocloud_usd_h']:.3f} $/h")
|
|
257
267
|
print(f"spread: {r['spread_usd_h']:+.3f} $/h ({r['spread_pct']:+.1f} %)")
|
|
258
268
|
return 0
|
|
259
|
-
c = cheapest(offers, a.gpu, a.min_reliability)
|
|
260
269
|
if c is None:
|
|
261
|
-
print(f"spatial: no Vast.ai offer for {
|
|
270
|
+
print(f"spatial: no Vast.ai offer for {label} at reliability >= {a.min_reliability} right now", file=sys.stderr)
|
|
262
271
|
return 1
|
|
263
272
|
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
273
|
f"reliability {c.reliability:.3f}, {c.geolocation}")
|
|
@@ -341,7 +350,8 @@ def main(argv=None):
|
|
|
341
350
|
p.set_defaults(fn=cmd_optimize)
|
|
342
351
|
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
352
|
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")
|
|
353
|
+
p.add_argument("--gpu", default="H100", help="substring to match in the GPU name, e.g. H100, RTX 4090, A100 (ignored if --vertical is given)")
|
|
354
|
+
p.add_argument("--vertical", choices=["render"], help="a preset list of interchangeable GPUs for a market instead of one chip (currently: render = 3D rendering/VFX render-farm cards)")
|
|
345
355
|
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
356
|
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
357
|
p.set_defaults(fn=cmd_market)
|
|
@@ -9,4 +9,7 @@ What this module does NOT do: rent a GPU, run a job, or spend any money. Renting
|
|
|
9
9
|
running a real job on it is a separate, later step that needs an account on the marketplace and
|
|
10
10
|
the user's explicit go-ahead each time, since it spends real money.
|
|
11
11
|
"""
|
|
12
|
-
from .vast import
|
|
12
|
+
from .vast import ( # noqa: F401
|
|
13
|
+
VERTICALS, MarketError, Offer, cheapest, cheapest_among, cheapest_for, fetch_offers,
|
|
14
|
+
parse_offers, spread_among, spread_for, spread_vs,
|
|
15
|
+
)
|
|
@@ -67,19 +67,58 @@ def cheapest(offers: list[Offer], gpu_name_contains: str, min_reliability: float
|
|
|
67
67
|
"""The lowest per-whole-GPU price among offers whose name contains `gpu_name_contains`
|
|
68
68
|
(case-insensitive) and whose reliability is at least `min_reliability` (default 0.5: an
|
|
69
69
|
unreliable host is not a fair price to quote as THE price). None if nothing matches."""
|
|
70
|
-
|
|
70
|
+
return cheapest_among(offers, (gpu_name_contains,), min_reliability)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def cheapest_among(offers: list[Offer], gpu_names: tuple[str, ...], min_reliability: float = 0.5) -> Offer | None:
|
|
74
|
+
"""Like `cheapest()`, but matches ANY of several GPU names (case-insensitive substring): for a
|
|
75
|
+
market made of several interchangeable models — e.g. render/VFX render-farm cards — rather
|
|
76
|
+
than one specific chip. None if nothing matches."""
|
|
77
|
+
cand = [o for o in offers if any(n.lower() in o.gpu_name.lower() for n in gpu_names) and o.reliability >= min_reliability]
|
|
71
78
|
return min(cand, key=lambda o: o.usd_per_hour_per_gpu) if cand else None
|
|
72
79
|
|
|
73
80
|
|
|
74
|
-
def
|
|
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)
|
|
81
|
+
def _spread(c: Offer | None, neocloud_usd_per_hour: float) -> dict | None:
|
|
80
82
|
if c is None:
|
|
81
83
|
return None
|
|
82
84
|
spread = neocloud_usd_per_hour - c.usd_per_hour_per_gpu
|
|
83
85
|
return {"market_usd_h": c.usd_per_hour_per_gpu, "neocloud_usd_h": neocloud_usd_per_hour,
|
|
84
86
|
"spread_usd_h": spread, "spread_pct": (spread / neocloud_usd_per_hour * 100) if neocloud_usd_per_hour else None,
|
|
85
87
|
"offer": c}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def spread_vs(offers: list[Offer], gpu_name_contains: str, neocloud_usd_per_hour: float,
|
|
91
|
+
min_reliability: float = 0.5) -> dict | None:
|
|
92
|
+
"""The arbitrage spread: the gap between the cheapest sufficiently-reliable marketplace price
|
|
93
|
+
for this GPU and a 'neocloud'/list price the CALLER supplies (never invented here). None if no
|
|
94
|
+
offer matches. `min_reliability` defaults to 0.5: an unreliable host is not a fair price to quote."""
|
|
95
|
+
return _spread(cheapest(offers, gpu_name_contains, min_reliability), neocloud_usd_per_hour)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def spread_among(offers: list[Offer], gpu_names: tuple[str, ...], neocloud_usd_per_hour: float,
|
|
99
|
+
min_reliability: float = 0.5) -> dict | None:
|
|
100
|
+
"""The arbitrage spread over `cheapest_among()` instead of one specific chip."""
|
|
101
|
+
return _spread(cheapest_among(offers, gpu_names, min_reliability), neocloud_usd_per_hour)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# Presentation presets, same pattern as pk_rtb/pk_credit/... over batch_score (spatial.kernel):
|
|
105
|
+
# a name over the SAME mechanism (cheapest_among/spread_among), not a different one. No code is
|
|
106
|
+
# duplicated per vertical; only the list of GPU names differs.
|
|
107
|
+
VERTICALS: dict[str, tuple[str, ...]] = {
|
|
108
|
+
# 3D rendering / VFX render farms: the cards render engines (Octane, Redshift, V-Ray) are
|
|
109
|
+
# commonly benchmarked and sold against. Not the datacenter chips (H100/A100/B200).
|
|
110
|
+
"render": ("RTX 4090", "RTX 5090", "RTX 4080", "RTX 5080", "RTX PRO 6000", "RTX PRO 5000", "RTX A6000", "RTX 6000 Ada"),
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def cheapest_for(offers: list[Offer], vertical: str, min_reliability: float = 0.5) -> Offer | None:
|
|
115
|
+
"""`vertical` is a key of VERTICALS (currently: "render")."""
|
|
116
|
+
if vertical not in VERTICALS:
|
|
117
|
+
raise MarketError(f"unknown vertical {vertical!r}; known: {', '.join(VERTICALS)}")
|
|
118
|
+
return cheapest_among(offers, VERTICALS[vertical], min_reliability)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def spread_for(offers: list[Offer], vertical: str, neocloud_usd_per_hour: float, min_reliability: float = 0.5) -> dict | None:
|
|
122
|
+
if vertical not in VERTICALS:
|
|
123
|
+
raise MarketError(f"unknown vertical {vertical!r}; known: {', '.join(VERTICALS)}")
|
|
124
|
+
return spread_among(offers, VERTICALS[vertical], neocloud_usd_per_hour, min_reliability)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spatial-computing
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.0
|
|
4
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
|
|
@@ -6,7 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
8
|
|
|
9
|
-
from spatial.market import MarketError, cheapest, fetch_offers, parse_offers, spread_vs
|
|
9
|
+
from spatial.market import VERTICALS, MarketError, cheapest, cheapest_among, cheapest_for, fetch_offers, parse_offers, spread_among, spread_for, spread_vs
|
|
10
10
|
|
|
11
11
|
FIXTURE = json.loads((Path(__file__).parent / "data" / "vast_bundles_sample.json").read_text())
|
|
12
12
|
|
|
@@ -55,18 +55,54 @@ def test_spread_vs_computes_the_arbitrage_gap_against_a_caller_supplied_price():
|
|
|
55
55
|
assert spread_vs(offers, "H100", 0.0) is not None and spread_vs(offers, "H100", 0.0)["spread_pct"] is None # no division by zero
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
def
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
def test_cheapest_among_matches_any_of_several_gpu_names():
|
|
59
|
+
offers = parse_offers(FIXTURE)
|
|
60
|
+
c = cheapest_among(offers, ("RTX 4090", "RTX 5090"))
|
|
61
|
+
assert c is not None and c.gpu_name in ("RTX 4090", "RTX 5090", "RTX 4090D") # substring match: "RTX 4090" also matches "RTX 4090D"
|
|
62
|
+
assert cheapest_among(offers, ("no such gpu",)) is None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_render_vertical_is_the_same_mechanism_as_cheapest_among():
|
|
66
|
+
offers = parse_offers(FIXTURE)
|
|
67
|
+
assert "render" in VERTICALS and len(VERTICALS["render"]) > 1
|
|
68
|
+
direct = cheapest_among(offers, VERTICALS["render"])
|
|
69
|
+
via_name = cheapest_for(offers, "render")
|
|
70
|
+
assert direct == via_name # cheapest_for("render") is NOT a different algorithm, just this preset
|
|
71
|
+
with pytest.raises(MarketError, match="unknown vertical"):
|
|
72
|
+
cheapest_for(offers, "no-such-vertical")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_spread_for_render_matches_spread_among_the_same_preset():
|
|
76
|
+
offers = parse_offers(FIXTURE)
|
|
77
|
+
a = spread_among(offers, VERTICALS["render"], neocloud_usd_per_hour=1.5)
|
|
78
|
+
b = spread_for(offers, "render", neocloud_usd_per_hour=1.5)
|
|
79
|
+
assert a == b
|
|
80
|
+
with pytest.raises(MarketError, match="unknown vertical"):
|
|
81
|
+
spread_for(offers, "no-such-vertical", 1.5)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# One real network call for the whole module (not one per test): avoids the flakiness of hitting
|
|
85
|
+
# a live third-party endpoint twice in quick succession, which happened in practice (TLS handshake
|
|
86
|
+
# timeouts under load). Every "live" assertion below reuses this single fetch.
|
|
87
|
+
try:
|
|
88
|
+
_LIVE_OFFERS = fetch_offers(timeout_s=20.0)
|
|
89
|
+
except MarketError:
|
|
90
|
+
_LIVE_OFFERS = None
|
|
64
91
|
|
|
92
|
+
needs_live_market = pytest.mark.skipif(_LIVE_OFFERS is None, reason="Vast.ai's public marketplace is not reachable from here right now")
|
|
65
93
|
|
|
66
|
-
|
|
94
|
+
|
|
95
|
+
@needs_live_market
|
|
67
96
|
def test_fetch_offers_is_a_real_live_call_with_plausible_prices():
|
|
68
|
-
offers =
|
|
97
|
+
offers = _LIVE_OFFERS
|
|
69
98
|
assert len(offers) > 0
|
|
70
99
|
assert all(o.usd_per_hour >= 0 and 0.0 <= o.reliability <= 1.0 for o in offers)
|
|
71
100
|
gpu_names = {o.gpu_name for o in offers}
|
|
72
101
|
assert any("RTX" in n or "A100" in n or "H100" in n or "L4" in n or "4090" in n for n in gpu_names) # a real marketplace, not an empty shell
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@needs_live_market
|
|
105
|
+
def test_render_vertical_finds_a_real_live_offer():
|
|
106
|
+
c = cheapest_for(_LIVE_OFFERS, "render")
|
|
107
|
+
if c is not None: # a real marketplace can genuinely have none in stock right now
|
|
108
|
+
assert c.usd_per_hour_per_gpu > 0 and c.reliability >= 0.5
|
|
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.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{spatial_computing-0.24.0 → spatial_computing-0.25.0}/spatial_computing.egg-info/requires.txt
RENAMED
|
File without changes
|
{spatial_computing-0.24.0 → spatial_computing-0.25.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
|