GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(gpu_ops): role dispatch over owned GPU hosts with reviewed two-s… · CortexLM/hypertrain@1281885

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • experiments/gpu_network_v2
    • orchestrate.py
  • scripts
    • network_gpu_operation.py
    • network_gpu_prepare.py
    • prepare_record.py
    • prepare_runtime.py
  • src/hypertrain
    • aggregator
      • rollback_v2.py
    • auditor
      • __main__.py
      • replay.py
      • worker.py
    • beacon
      • drand.py
    • challenge
      • admission.py
      • app.py
      • store.py
    • data
      • store.py
    • gpu_ops
      • budget.py
      • launcher.py
      • network_qualification.py
      • role_dispatch.py
      • supervisor.py
      • work_screen.py
    • miner
      • core.py
    • protocol
      • messages_v2.py
    • public_api
      • __init__.py
      • views.py
  • tests
    • auditor
      • test_auditor_cli.py
      • test_island_replay_v2.py
    • beacon
      • test_beacon.py
    • challenge
      • test_indexed_transport_v2.py
      • test_role_dispatch_consumers_v2.py
      • test_subnet_gate_v2.py
    • data
      • test_parts.py
    • e2e
      • test_network_gpu_prepare.py
    • gpu_ops
      • test_network_admit_cli.py
      • test_network_gpu_qualification.py
      • test_network_lifecycle.py
      • test_network_role_dispatch.py
    • miner
      • test_client_network_v2.py
      • test_island_launch_v2.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎experiments/gpu_network_v2/orchestrate.py‎

Copy file name to clipboardExpand all lines: experiments/gpu_network_v2/orchestrate.py
+851-162Lines changed: 851 additions & 162 deletions
Large diffs are not rendered by default.
Collapse file

‎scripts/network_gpu_operation.py‎

Copy file name to clipboardExpand all lines: scripts/network_gpu_operation.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ def execution_environment(op: Operation) -> dict:
190190
):
191191
raise ValueError("custody CUDA driver differs")
192192
observed["drivers"] = [d.strip() for d in drivers]
193+
from hypertrain.miner.island_launch import gpu_uuid
194+
195+
observed["gpu_uuids"] = [
196+
gpu_uuid(torch.cuda.get_device_properties(i).uuid) for i in range(layout.n_gpus)
197+
]
193198
observed["sm_counts"] = [
194199
torch.cuda.get_device_properties(i).multi_processor_count for i in range(layout.n_gpus)
195200
]
Collapse file

‎scripts/network_gpu_prepare.py‎

Copy file name to clipboardExpand all lines: scripts/network_gpu_prepare.py
+175-1Lines changed: 175 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,26 @@
77
import importlib.util
88
import io
99
import json
10+
import math
1011
import os
1112
import secrets
1213
import sys
1314
import tarfile
1415
from pathlib import Path
16+
from types import ModuleType
17+
18+
# ponytail: mission bandwidth floor (Mbit/s) lives here, not in the signed profile; move it into
19+
# profile["admission"] when the profile schema is next re-signed.
20+
MIN_INET_MBPS = 800
21+
22+
23+
def fast_link(value: object) -> bool:
24+
return (
25+
isinstance(value, (int, float))
26+
and not isinstance(value, bool)
27+
and math.isfinite(value)
28+
and value >= MIN_INET_MBPS
29+
)
1530

1631

1732
def digest(path: Path) -> str:
@@ -227,9 +242,158 @@ def candidate_freeze(original: Path, destination: Path, candidates: list[str]) -
227242
return destination / "freeze.json"
228243

229244

245+
def prepare_qualification_base(
246+
freeze: dict,
247+
tree: Path,
248+
maps: dict,
249+
controller: ModuleType,
250+
output: Path,
251+
out: Path,
252+
job_dir: Path,
253+
ownership: Path,
254+
registry: Path,
255+
platform: Path,
256+
) -> dict:
257+
"""prune_rescued qualification base only: reuses the generated V2 manifest/job/objects and the
258+
task-4 hosts by reference. No synthetic roles, joins, genesis, relay, TLS or services: the real
259+
uid247 join and seed context are signed at run time with the existing keys."""
260+
profile_path, job_path = out / "profile.json", job_dir / "job.json"
261+
profile = json.loads(profile_path.read_bytes())
262+
job = json.loads(job_path.read_bytes())
263+
if profile["artifacts"].get("remote_retention") != "prune_rescued":
264+
raise ValueError("qualification base requires the generated prune_rescued profile")
265+
if "sha256:" + digest(registry) != profile["runtime"]["image_digest"]:
266+
raise ValueError("registry index must be the pinned image digest")
267+
controller.registry_layers(json.loads(registry.read_bytes()), platform)
268+
objects = {key: job_dir / rel for key, rel in job["object_paths"].items()}
269+
from hypertrain.gpu_ops import network_qualification
270+
271+
# Exactly what reviewed_launch recomputes: raw tree map with the qualification profile
272+
# overlaid at experiments/gpu_network_v2/profile.json (the remote check sees the same tree).
273+
overlay, bundle_bytes = controller.effective_bundle(network_qualification, tree, profile_path)
274+
source = json.loads(ownership.read_bytes())
275+
if isinstance(source, list):
276+
# Fresh admit: the measured GET offer rows select two distinct exact-shape machines.
277+
limits = controller.admission_limits(profile)
278+
if len(source) != 2 or not all(isinstance(o, dict) for o in source):
279+
raise ValueError("fresh offers must be two distinct exact-shape pinned-driver machines")
280+
hosts = [
281+
{"role": r, "machine_id": o.get("machine_id")}
282+
for r, o in zip(("h0", "h1"), source, strict=True)
283+
]
284+
if (
285+
any(type(h["machine_id"]) is not int for h in hosts)
286+
or len({h["machine_id"] for h in hosts}) != 2
287+
or any(
288+
type(o.get("id")) is not int
289+
or o.get("num_gpus") != limits["gpus"]
290+
or o.get("gpu_name") != limits["gpu_name"]
291+
or o.get("driver_version") not in profile["runtime"]["driver_allowlist"]
292+
or not fast_link(o.get("inet_up"))
293+
or not fast_link(o.get("inet_down"))
294+
for o in source
295+
)
296+
):
297+
raise ValueError("fresh offers must be two distinct exact-shape pinned-driver machines")
298+
else:
299+
hosts = [
300+
{"role": role, "machine_id": source["api_lookup"][s]["machine_id"]}
301+
for role, s in (("h0", "hostA"), ("h1", "hostB"))
302+
]
303+
if any(type(h["machine_id"]) is not int for h in hosts):
304+
raise ValueError("task-4 ownership must name hostA/hostB machine ids")
305+
output.mkdir(mode=0o700)
306+
private, public = output / "private", output / "public"
307+
save(public / "qualification-sources.json", overlay)
308+
bundle = public / "qualification-source.tar"
309+
save(bundle, bundle_bytes)
310+
save(
311+
private / "lifecycle-config.json",
312+
{
313+
"hosts": hosts,
314+
"cleanup_contract": "network-v2",
315+
"tree": str(tree),
316+
"network_profile_file": str(profile_path),
317+
"image": freeze["image_candidate"]["ref"],
318+
"remote_python": profile["runtime"]["remote_python"],
319+
"disk_gb": controller.admission_limits(profile)["disk_gb"],
320+
"hard_deadline_seconds": controller.lifecycle_timing(profile)["horizon"],
321+
"hard_grace_seconds": 0,
322+
"base_url": "https://console.vast.ai",
323+
"boot_timeout_seconds": 300,
324+
"keyscan_attempts": 1,
325+
"create_margin_seconds": 600,
326+
# ponytail: fixed remote layout; prepare_record adds key_file + cleanup_deadline_unix.
327+
"remote_root": "/data/hypertrain-{role}",
328+
"evidence_path": str(output / "private/evidence-run.json"),
329+
},
330+
True,
331+
)
332+
save(
333+
public / "lifecycle-hashes.json",
334+
{
335+
name: maps["qualification-sources.json"][name]
336+
for name in (
337+
"src/hypertrain/gpu_ops/launcher.py",
338+
"src/hypertrain/gpu_ops/supervisor.py",
339+
)
340+
},
341+
)
342+
paths = {
343+
"config": private / "lifecycle-config.json",
344+
"profile": profile_path,
345+
"sources": public / "qualification-sources.json",
346+
"bundle": bundle,
347+
"manifest": out / "manifest-envelope.json",
348+
"lifecycle_hashes": public / "lifecycle-hashes.json",
349+
"registry": registry,
350+
"registry_platform": platform,
351+
"ownership": ownership,
352+
"job": job_path,
353+
**{"object_" + key: path for key, path in objects.items()},
354+
}
355+
staged = sum(p.stat().st_size for p in [bundle, job_path, *objects.values()])
356+
record = {
357+
"tree": str(tree),
358+
"files": {name: {"path": str(p), "sha256": digest(p)} for name, p in sorted(paths.items())},
359+
"quota": controller.execution_quota(profile),
360+
"staging_bytes": staged,
361+
"public_dataset_reviewed": True,
362+
"full_genesis_reviewed": True,
363+
"preparation_only": True,
364+
# Per-role join/seed_context (one real uid247 identity on both hosts) and every fresh
365+
# provider/authority file are added by scripts/prepare_record.py at run time.
366+
"role_inputs": {
367+
"job": "job",
368+
"objects": {key: "object_" + key for key in objects},
369+
},
370+
"remaining": ["roles", "action", "owner", "parent_pid", "cutoff_unix", "admitted_unix"],
371+
}
372+
save(private / "review-base.json", {"record": record}, True)
373+
result = {
374+
"status": "QUALIFICATION_BASE_NOT_LAUNCHABLE",
375+
"run_id": job["run_id"],
376+
"review_base": str(private / "review-base.json"),
377+
"review_base_sha256": digest(private / "review-base.json"),
378+
"staging_bytes": staged,
379+
"quota": record["quota"],
380+
"kernels_executed": 0,
381+
"provider_calls": 0,
382+
}
383+
save(output / "prepared.json", result)
384+
return result
385+
386+
230387
def prepare(
231-
freeze_path: Path, output: Path, genesis: int, candidates: list[str] | None = None
388+
freeze_path: Path,
389+
output: Path,
390+
genesis: int,
391+
candidates: list[str] | None = None,
392+
qualification: tuple[Path, Path, Path, Path, Path] | None = None,
232393
) -> dict:
394+
if qualification is not None:
395+
freeze, tree, maps, _, _, controller = load_frozen(freeze_path)
396+
return prepare_qualification_base(freeze, tree, maps, controller, output, *qualification)
233397
if output.exists() or genesis < 1:
234398
raise ValueError("new output and positive deterministic CPU genesis required")
235399
if candidates is not None and candidates != ["580.95.05", "580.159.03"]:
@@ -627,6 +791,13 @@ def main() -> None:
627791
parser.add_argument("--output", type=Path, required=True)
628792
parser.add_argument("--cpu-genesis-unix", type=int, required=True)
629793
parser.add_argument("--candidate-driver", action="append")
794+
parser.add_argument(
795+
"--qualification-base",
796+
nargs=5,
797+
type=Path,
798+
metavar=("OUT_DIR", "JOB_DIR", "OWNERSHIP", "REGISTRY_INDEX", "REGISTRY_PLATFORM"),
799+
help="prune_rescued qualification-only base from generated V2 assets",
800+
)
630801
args = parser.parse_args()
631802
os.umask(0o077)
632803
print(
@@ -636,6 +807,9 @@ def main() -> None:
636807
args.output.resolve(),
637808
args.cpu_genesis_unix,
638809
args.candidate_driver,
810+
tuple(p.resolve() for p in args.qualification_base)
811+
if args.qualification_base
812+
else None,
639813
),
640814
sort_keys=True,
641815
)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.