spatial-computing 0.24.0__py3-none-any.whl → 0.26.0__py3-none-any.whl

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/__init__.py CHANGED
@@ -3,4 +3,4 @@
3
3
  Status of every engine is declared in spatial.core.registry and must be backed
4
4
  by a test or benchmark before being set to OPERATIONAL.
5
5
  """
6
- __version__ = "0.24.0"
6
+ __version__ = "0.26.0"
spatial/cli.py CHANGED
@@ -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 {a.gpu!r} at reliability >= {a.min_reliability} right now", file=sys.stderr)
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 {a.gpu} on Vast.ai right now: {r['market_usd_h']:.3f} $/h (reliability {o.reliability:.3f}, {o.geolocation})")
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 {a.gpu!r} at reliability >= {a.min_reliability} right now", file=sys.stderr)
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", "cloud_gaming"], help="a preset list of interchangeable GPUs for a market instead of one chip (render = 3D rendering/VFX render-farm cards; cloud_gaming = game-streaming rig 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 MarketError, Offer, cheapest, fetch_offers, parse_offers, spread_vs # noqa: F401
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
+ )
spatial/market/vast.py CHANGED
@@ -67,19 +67,63 @@ 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
- cand = [o for o in offers if gpu_name_contains.lower() in o.gpu_name.lower() and o.reliability >= min_reliability]
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 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)
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
+ # Cloud gaming / game streaming (the software side of the "consoles" market, see note in
112
+ # docs/MARKET.md): the gaming-tier cards a streaming rig needs (not the workstation RTX PRO
113
+ # line, not the datacenter chips). This is NOT a console chip and never will be; it is where
114
+ # to place a streamed game session at the lowest measured cost.
115
+ "cloud_gaming": ("RTX 4070", "RTX 4080", "RTX 4090", "RTX 5070", "RTX 5080", "RTX 5090"),
116
+ }
117
+
118
+
119
+ def cheapest_for(offers: list[Offer], vertical: str, min_reliability: float = 0.5) -> Offer | None:
120
+ """`vertical` is a key of VERTICALS (currently: "render", "cloud_gaming")."""
121
+ if vertical not in VERTICALS:
122
+ raise MarketError(f"unknown vertical {vertical!r}; known: {', '.join(VERTICALS)}")
123
+ return cheapest_among(offers, VERTICALS[vertical], min_reliability)
124
+
125
+
126
+ def spread_for(offers: list[Offer], vertical: str, neocloud_usd_per_hour: float, min_reliability: float = 0.5) -> dict | None:
127
+ if vertical not in VERTICALS:
128
+ raise MarketError(f"unknown vertical {vertical!r}; known: {', '.join(VERTICALS)}")
129
+ 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.24.0
3
+ Version: 0.26.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
@@ -1,5 +1,5 @@
1
- spatial/__init__.py,sha256=UM23kHihRx3KnI1ETHh4IA7kStVQP32l26KpatpUyo0,208
2
- spatial/cli.py,sha256=dpZ_NjCQPtq1x71lst9Zl21Qph4WwNfEcIjUSUpmg1E,21604
1
+ spatial/__init__.py,sha256=XKD14u9YiMdeHLdivzJ60xBIyG_ChJWicuUw4TYbqLg,208
2
+ spatial/cli.py,sha256=YCxakFHX64nJTpQvtmjEF-QeyDPjN21OEcpptMi7TZo,22353
3
3
  spatial/ai/__init__.py,sha256=qrQZBRNCGwnMp_Rx7HNblvGfgmLApVrdIAPcYVmZdCg,926
4
4
  spatial/ai/kvcache.py,sha256=7xrNI3zBKSoLA9ZjI1U2TZQ7GdXMZDzZq50qBrbWAWY,4054
5
5
  spatial/ai/llm.py,sha256=-e_F4giPVlc_R9AiDX0LT4LFf-gmnAIhlfNZDW07Sig,2292
@@ -40,8 +40,8 @@ spatial/interconnect/tasks.py,sha256=oUl1sY7F8mJtZ3rzqkfsrJXvyvG2xgDunspif8vnqwI
40
40
  spatial/kernel/__init__.py,sha256=YVCZ8MIaKf4f-fdjpdMnAPrjVfR-PdHfVxyAUTH3l_E,215
41
41
  spatial/kernel/dsl.py,sha256=-a_JFBzpJvrlIgdhwdho9b2Prx6S5V7KRUucxn8fMCI,30592
42
42
  spatial/kernel/library.py,sha256=MUPv0llZxwaUkD-Tgi-PX2n9asd_JlyFIqZuuQMvQ9c,2381
43
- spatial/market/__init__.py,sha256=DS66kQfa2WdBQ5b3QXUvYZJjcUza44E9s9Q5WcnwHuM,736
44
- spatial/market/vast.py,sha256=6FiOwZNQMLataGfHPhtZHeArbTozJikPnSz_1ON5CH8,4491
43
+ spatial/market/__init__.py,sha256=3M-DbknckgheCpy6r6IZRWpgV0LwKLvZ1i598iTvpp4,816
44
+ spatial/market/vast.py,sha256=g8Db3DBK0Zxoa_e3cUOODQlyAlUc6omixNzLmAF-I-w,7180
45
45
  spatial/memory/__init__.py,sha256=Jy5xVfm9mmLaE6qaJ-UhIfqrOPJJFA9kDc-pvexJo0k,335
46
46
  spatial/memory/fararray.py,sha256=USpFPorGveZ2LVc_2JkePD2dHJKBl9gyfxb5lbwp2HI,1689
47
47
  spatial/memory/pageserver.py,sha256=mIMmvoQRAFYPwRdZqy3YAatfkiI-XzOMUkFoihJl8Hw,5767
@@ -89,9 +89,9 @@ spatial/unified/__init__.py,sha256=-pRHK15GyeXStIKLHLxDQMN72pelTaBHJMaPpT-MODI,6
89
89
  spatial/unified/model.py,sha256=Glban2XOL48_262IKtBR2ESMrFrvImHDHbDo2B8GK8I,6336
90
90
  spatial/unified/planner.py,sha256=kdpzCpZJ-RdjCj8MNaES4TPdSug0skSQ53pKUi2Q-Bo,5429
91
91
  spatial/unified/providers.py,sha256=M6To5xg6jNBsxWk6f68m7pRT6-KVcY5B6oj-v5Toots,19976
92
- spatial_computing-0.24.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
93
- spatial_computing-0.24.0.dist-info/METADATA,sha256=DAKwQ9jpR341M1brAegz6CJ1fURjbjeDeHRYvBEFGTs,6780
94
- spatial_computing-0.24.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
95
- spatial_computing-0.24.0.dist-info/entry_points.txt,sha256=2o6Kjkd0lkEd-qQgFuW-ptYOh4RmnHFPyvwzP2KiMS0,45
96
- spatial_computing-0.24.0.dist-info/top_level.txt,sha256=ZHke8hWgy4qIqEGq7omus3O-T7AhmPoc-cqr7JdGGxQ,8
97
- spatial_computing-0.24.0.dist-info/RECORD,,
92
+ spatial_computing-0.26.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
93
+ spatial_computing-0.26.0.dist-info/METADATA,sha256=-s2LNKteQD1E6z4hkWhe_xX6YxQL8_4acAsvaEvKDFU,6780
94
+ spatial_computing-0.26.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
95
+ spatial_computing-0.26.0.dist-info/entry_points.txt,sha256=2o6Kjkd0lkEd-qQgFuW-ptYOh4RmnHFPyvwzP2KiMS0,45
96
+ spatial_computing-0.26.0.dist-info/top_level.txt,sha256=ZHke8hWgy4qIqEGq7omus3O-T7AhmPoc-cqr7JdGGxQ,8
97
+ spatial_computing-0.26.0.dist-info/RECORD,,