From 420198ecdfe06d4efe316c56124846db1122fc8a Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 26 Oct 2026 15:07:40 +0000 Subject: [PATCH 01/16] walltime: validate the additive profiling-join fields (stays @1) implied_s_per_eval, profiling_per_call_s finite|null; profiling_record_id, profiling_unmatched_reason, profiling_per_call_source, profiling_status str|null; size_match bool|null; source_pixels, profiling_source_pixels int>=0|null. Checked only when present. Fixture gains mass_total[1], another-stage, unmatched and uncaptured-link rows. Co-Authored-By: Claude Opus 5.5 --- REFERENCE.md | 13 ++- pulse/walltime.py | 35 ++++++ tests/fixtures/walltime_validation_v1.json | 128 ++++++++++++++++++++- tests/test_ingest.py | 2 +- tests/test_summary.py | 26 +++++ 5 files changed, 197 insertions(+), 7 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index ee0c61f..f911321 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -353,9 +353,18 @@ example; validation is stdlib-only in `pulse/walltime.py`. `release_pin`, `slurm_job_id`: string or `null`. - `parity_status` ∈ `match | diverged | not_assessed`. +Additive optional fields (still `@1`; absent is valid, present they are +type-checked): the producer's join of the run to a profiling runtime record — +`implied_s_per_eval` and `profiling_per_call_s` (finite number or `null`); +`profiling_record_id` (the matched `profiling-summary@3` record id), +`profiling_unmatched_reason`, `profiling_per_call_source`, `profiling_status` +(string or `null`); `size_match` (boolean or `null`: whether the run's source +pixels equal the profiling record's size bin); `source_pixels`, +`profiling_source_pixels` (non-negative integer or `null`). + Every derived number is computed and declared by the producer. Pulse renders -the records as their own table under Profiling Results and computes nothing; -the instance has no qualification flag, so it raises no "unqualified" item. +the records under **Inference Timings** and computes nothing (see Board); the +instance has no qualification flag, so it raises no "unqualified" item. ## Ingest diff --git a/pulse/walltime.py b/pulse/walltime.py index d2ab711..7e3e8b0 100644 --- a/pulse/walltime.py +++ b/pulse/walltime.py @@ -8,6 +8,10 @@ declared by the producer; Pulse validates the shape and renders the values. It computes no ratio, infers no optimal setup and never reads a full-fit time as a per-likelihood measurement (or the reverse). Stdlib only. See REFERENCE.md. + +The producer's join to a profiling runtime record (``profiling_record_id``, +``profiling_per_call_s``, ``size_match`` and friends) and ``implied_s_per_eval`` +are additive optional fields: absent is valid; present, they are type-checked. """ from __future__ import annotations @@ -27,6 +31,15 @@ "parallel_efficiency", "max_log_likelihood", ) +# Additive optional fields (still walltime-validation@1): checked only when present. +OPTIONAL_NUMERIC = ("implied_s_per_eval", "profiling_per_call_s") +OPTIONAL_TEXT = ( + "profiling_record_id", + "profiling_unmatched_reason", + "profiling_per_call_source", + "profiling_status", +) +OPTIONAL_COUNT = ("source_pixels", "profiling_source_pixels") KEY_FIELDS = ( "likelihood", "instrument", @@ -72,6 +85,28 @@ def _record(check, item, where): value = item.get(field) check.require(value is None or summary._text(value), f"{where}.{field}", "string or null") check.choice(item.get("parity_status"), PARITY_STATUSES, f"{where}.parity_status") + for field in OPTIONAL_NUMERIC: + if field in item: + check.require( + summary._finite_or_null(item[field]), f"{where}.{field}", "finite number or null" + ) + for field in OPTIONAL_TEXT: + if field in item: + value = item[field] + check.require( + value is None or summary._text(value), f"{where}.{field}", "string or null" + ) + for field in OPTIONAL_COUNT: + if field in item: + value = item[field] + check.require( + value is None or _count(value), f"{where}.{field}", "non-negative integer or null" + ) + if "size_match" in item: + value = item["size_match"] + check.require( + value is None or isinstance(value, bool), f"{where}.size_match", "boolean or null" + ) def validate(doc) -> list[str]: diff --git a/tests/fixtures/walltime_validation_v1.json b/tests/fixtures/walltime_validation_v1.json index ce24b34..1b124ba 100644 --- a/tests/fixtures/walltime_validation_v1.json +++ b/tests/fixtures/walltime_validation_v1.json @@ -18,7 +18,7 @@ "setup_id": "numba_cpu_sparse_fp64", "host_class": "hpc_ral_cpu", "model_variant": "default", - "sampler": "nautilus", + "sampler": "nautilus:mass_total[1]", "seed": 0, "wall_s": 4200.0, "likelihood_evals": 20000, @@ -31,7 +31,16 @@ "release_pin": "2026.10.16.2", "slurm_job_id": "412000", "max_log_likelihood": 12345.6, - "parity_status": "match" + "parity_status": "match", + "implied_s_per_eval": 0.21, + "profiling_record_id": "imaging-delaunay-hst-ral-runtime", + "profiling_per_call_s": 0.21, + "profiling_per_call_source": "warm_iid_median_s", + "profiling_status": "current", + "profiling_unmatched_reason": null, + "size_match": true, + "source_pixels": 1250, + "profiling_source_pixels": 1250 }, { "id": "nautilus-16core-s0", @@ -43,7 +52,7 @@ "setup_id": "numba_cpu_sparse_fp64", "host_class": "hpc_ral_cpu", "model_variant": "default", - "sampler": "nautilus", + "sampler": "nautilus:mass_total[1]", "seed": 1, "wall_s": 330.0, "likelihood_evals": 20000, @@ -56,7 +65,118 @@ "release_pin": "2026.10.16.2", "slurm_job_id": "412000", "max_log_likelihood": 12345.6, - "parity_status": "not_assessed" + "parity_status": "not_assessed", + "implied_s_per_eval": 0.0165, + "profiling_record_id": "imaging-delaunay-hst-ral-runtime", + "profiling_per_call_s": 0.21, + "profiling_per_call_source": "warm_iid_median_s", + "profiling_status": "current", + "profiling_unmatched_reason": null, + "size_match": false, + "source_pixels": 784, + "profiling_source_pixels": 1250 + }, + { + "id": "nautilus-source-pix-s1", + "likelihood": { + "dataset_type": "imaging", + "variant": "delaunay" + }, + "instrument": "hst", + "setup_id": "numba_cpu_sparse_fp64", + "host_class": "hpc_ral_cpu", + "model_variant": "default", + "sampler": "nautilus:source_pix[1]", + "seed": 1, + "wall_s": 120.0, + "likelihood_evals": 20000, + "implied_ms_per_eval": 6.0, + "reference_runtime_record_id": "imaging-delaunay-hst-ral-runtime", + "predicted_ms_per_eval": 13.1, + "ratio_measured_over_predicted": 1.26, + "cores": 16, + "parallel_efficiency": 0.795, + "release_pin": "2026.10.16.2", + "slurm_job_id": "412000", + "max_log_likelihood": 12345.6, + "parity_status": "not_assessed", + "implied_s_per_eval": 0.006, + "profiling_record_id": "imaging-delaunay-hst-ral-runtime", + "profiling_per_call_s": 0.21, + "profiling_per_call_source": "warm_iid_median_s", + "profiling_status": "current", + "profiling_unmatched_reason": null, + "size_match": false, + "source_pixels": 784, + "profiling_source_pixels": 1250 + }, + { + "id": "nautilus-light-fixed-s0", + "likelihood": { + "dataset_type": "imaging", + "variant": "delaunay" + }, + "instrument": "hst", + "setup_id": "numba_cpu_sparse_fp64", + "host_class": "hpc_ral_cpu", + "model_variant": "light_fixed", + "sampler": "nautilus:mass_total[1]", + "seed": 0, + "wall_s": 3900.04, + "likelihood_evals": 20000, + "implied_ms_per_eval": 195.002, + "reference_runtime_record_id": null, + "predicted_ms_per_eval": null, + "ratio_measured_over_predicted": null, + "cores": 1, + "parallel_efficiency": 1.0, + "release_pin": "2026.10.16.2", + "slurm_job_id": "412000", + "max_log_likelihood": 12345.6, + "parity_status": "match", + "implied_s_per_eval": 0.195002, + "profiling_record_id": null, + "profiling_per_call_s": null, + "profiling_per_call_source": null, + "profiling_status": null, + "profiling_unmatched_reason": "no profiling runtime record with model_variant light_fixed", + "size_match": null, + "source_pixels": 1250, + "profiling_source_pixels": null + }, + { + "id": "nautilus-gpu-s0", + "likelihood": { + "dataset_type": "imaging", + "variant": "delaunay" + }, + "instrument": "hst", + "setup_id": "jax_gpu_dense_mixed", + "host_class": "hpc_a100", + "model_variant": "default", + "sampler": "nautilus:mass_total[1]", + "seed": 0, + "wall_s": 88.25, + "likelihood_evals": 20000, + "implied_ms_per_eval": 4.4125, + "reference_runtime_record_id": "imaging-delaunay-hst-ral-runtime", + "predicted_ms_per_eval": 210.0, + "ratio_measured_over_predicted": 1.0, + "cores": 1, + "parallel_efficiency": null, + "release_pin": "2026.10.16.2", + "slurm_job_id": "412000", + "max_log_likelihood": 12345.6, + "parity_status": "match", + "implied_s_per_eval": 0.0044125, + "profiling_record_id": "lifecycle/not-captured", + "profiling_per_call_s": 0.009, + "profiling_per_call_source": "warm_iid_median_s", + "profiling_status": "current", + "profiling_unmatched_reason": null, + "size_match": true, + "source_pixels": 1250, + "profiling_source_pixels": 1250 } ] } diff --git a/tests/test_ingest.py b/tests/test_ingest.py index 4c784cf..c5b4350 100644 --- a/tests/test_ingest.py +++ b/tests/test_ingest.py @@ -196,4 +196,4 @@ def test_v2_and_walltime_receipts_keep_their_shape(registry_file, fake_mind, web assert s.outcome == "ok", s.errors receipt = ingest.read_receipt(tmp_path, "lens") assert receipt["schema"] == "walltime-validation" and "lifecycle" not in receipt - assert receipt["record_count"] == 2 + assert receipt["record_count"] == 5 diff --git a/tests/test_summary.py b/tests/test_summary.py index 654ac63..e396e51 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -191,6 +191,14 @@ def test_walltime_validation_is_accepted_and_pulse_computes_nothing(): (lambda d: d["records"].append(copy.deepcopy(d["records"][0])), "duplicate id"), (lambda d: d.pop("producer_revision"), "producer_revision"), (lambda d: d.update(generated_at="2026-10-21"), "generated_at"), + (lambda d: d["records"][0].update(implied_s_per_eval="slow"), "implied_s_per_eval"), + (lambda d: d["records"][0].update(profiling_per_call_s=math.nan), "profiling_per_call_s"), + (lambda d: d["records"][0].update(profiling_record_id=7), "profiling_record_id"), + (lambda d: d["records"][0].update(profiling_unmatched_reason=""), "unmatched_reason"), + (lambda d: d["records"][0].update(profiling_status=["current"]), "profiling_status"), + (lambda d: d["records"][0].update(size_match="yes"), "size_match"), + (lambda d: d["records"][0].update(source_pixels=-4), "source_pixels"), + (lambda d: d["records"][0].update(profiling_source_pixels=1.5), "profiling_source_pixels"), ], ) def test_walltime_contract_breaks_are_named(mutation, needle): @@ -207,3 +215,21 @@ def test_null_derived_numbers_are_allowed_when_not_measured(): predicted_ms_per_eval=None, ratio_measured_over_predicted=None, parallel_efficiency=None ) assert summary.classify(doc, WALL) == ("ok", []) + + +def test_profiling_join_fields_are_optional_and_nullable(): + doc = fixture_doc("walltime_validation_v1.json") + for field in ( + "implied_s_per_eval", + "profiling_per_call_s", + "profiling_record_id", + "profiling_unmatched_reason", + "profiling_per_call_source", + "profiling_status", + "size_match", + "source_pixels", + "profiling_source_pixels", + ): + doc["records"][0][field] = None + doc["records"][1].pop(field, None) + assert summary.classify(doc, WALL) == ("ok", []) From d2aec513b407d58c4c2666297ec0df651d42d9a1 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 26 Oct 2026 15:11:35 +0000 Subject: [PATCH 02/16] board: Profiling Timings and Inference Timings sections, per-project groups Split Profiling Results into Profiling Timings and Inference Timings, each opening per project (
, label from the registry row's library_refs[0], PyAutoFit then PyAutoLens). PyAutoFit inference points to the PyAutoInsight board. campaigns.py no longer emits the old heading; an empty keeps old links landing; nav and the v2 back link go to #profiling-timings. Co-Authored-By: Claude Opus 5.5 --- pulse/board.py | 166 +++++++++++++++++++++++++++++++--------- pulse/campaigns.py | 7 -- pulse/setup_browser.js | 4 +- tests/browser_setup.cjs | 3 +- tests/test_board.py | 18 +++-- tests/test_campaigns.py | 2 +- 6 files changed, 149 insertions(+), 51 deletions(-) diff --git a/pulse/board.py b/pulse/board.py index 00d5793..817e564 100644 --- a/pulse/board.py +++ b/pulse/board.py @@ -15,10 +15,14 @@ manual handoff. Pairs the reader refuses (axis mismatch, changed hardware, missing endpoint) are listed apart with the reason and no ratio. -A ``profiling-summary@3`` instance adds its producer-declared lifecycle counts -(current / superseded / archived) to its status lines and renders the -Class-first setup browser; a ``walltime-validation@1`` instance renders its -full-fit records as their own table under Profiling Results. +The measurements sit in two sections, each opening per project (PyAutoFit, +PyAutoLens; the label is the registry row's first ``library_refs`` entry): +**Profiling Timings** (the ``profiling-summary`` instances: the v2 setup +browser, or the v3 runtime table with one detail page per row) and +**Inference Timings** (the ``walltime-validation@1`` instances, one full-fit run +per row, each opening its own run page). A ``profiling-summary@3`` instance +also adds its producer-declared lifecycle counts (current / superseded / +archived) to its status lines. The board never recomputes a ratio, never combines records whose axis or hardware differs, never ranks cells across projects and never emits a @@ -75,6 +79,37 @@ def is_catalogue(doc: dict | None) -> bool: return doc.get("schema") == "walltime-validation" or doc.get("version") in (2, 3) +PROJECTS = ("PyAutoFit", "PyAutoLens") # section order; other projects follow +INSIGHT_URL = "https://pyautolabs.github.io/PyAutoInsight/" +_REPO_PROJECT = { + "autofit": "PyAutoFit", + "autolens": "PyAutoLens", + "autogalaxy": "PyAutoGalaxy", + "autoarray": "PyAutoArray", + "autocti": "PyAutoCTI", +} + + +def project_label(instance) -> str: + """The project a registry row belongs to: its first ``library_refs`` entry.""" + refs = getattr(instance, "library_refs", ()) or () + if refs: + return refs[0] + return _REPO_PROJECT.get(instance.repo.split("_", 1)[0], instance.repo) + + +def project_slug(label: str) -> str: + return re.sub(r"[^a-z0-9]+", "-", label.lower()).strip("-") + + +def by_project(views) -> OrderedDict[str, list[Snapshot]]: + """Snapshots grouped by project label, PROJECTS order first, registry order kept.""" + groups: OrderedDict[str, list] = OrderedDict((p, []) for p in PROJECTS) + for s in views: + groups.setdefault(project_label(s.instance), []).append(s) + return groups + + def lifecycle(s: Snapshot) -> str | None: """``N current · N superseded · N archived`` for a v3 capture, else None.""" doc = s.doc or {} @@ -400,6 +435,12 @@ def _md_detail(s: Snapshot, now: str | None = None) -> list[str]: ) +INSIGHT_POINTER = "PyAutoFit inference benchmarking is collected on the PyAutoInsight board." +INSIGHT_POINTER_MD = ( + f"PyAutoFit inference benchmarking is collected on the [PyAutoInsight board]({INSIGHT_URL})." +) + + def _cell(value) -> str: return "—" if value is None else str(value) @@ -434,6 +475,23 @@ def walltime_html(s: Snapshot) -> str: ) +def _md_snapshot(snapshot: Snapshot, now: str) -> list[str]: + out = [] + if snapshot.failed or snapshot.cached: + out += [f"**{snapshot.instance.instance}: {integrity(snapshot)}**", ""] + if is_walltime(snapshot): + out += walltime_markdown(snapshot) + elif (snapshot.doc or {}).get("version") in (2, 3): + out += setup_browser.markdown(snapshot) + return out + [ + "
Capture, qualification and legacy diagnostics", + "", + *_md_detail(snapshot, now), + "
", + "", + ] + + def render_markdown(views, now: str | None = None, campaign_data: dict | None = None) -> str: now = now or _utc_now() if any(is_catalogue(s.doc) for s in views): @@ -444,20 +502,22 @@ def render_markdown(views, now: str | None = None, campaign_data: dict | None = f"[Interactive board]({PAGES_URL})", "", ] - for snapshot in views: - if snapshot.failed or snapshot.cached: - out += [f"**{snapshot.instance.instance}: {integrity(snapshot)}**", ""] - if is_walltime(snapshot): - out += walltime_markdown(snapshot) - elif (snapshot.doc or {}).get("version") in (2, 3): - out += setup_browser.markdown(snapshot) - out += [ - "
Capture, qualification and legacy diagnostics", - "", - *_md_detail(snapshot, now), - "
", - "", - ] + profiling = by_project(s for s in views if not is_walltime(s)) + inference = by_project(s for s in views if is_walltime(s)) + out += ["## Profiling Timings", ""] + for label, snaps in profiling.items(): + if snaps: + out += [f"### {label}", ""] + for snapshot in snaps: + out += _md_snapshot(snapshot, now) + out += ["## Inference Timings", ""] + for label, snaps in inference.items(): + if label == "PyAutoFit" and not snaps: + out += [f"### {label}", "", INSIGHT_POINTER_MD, ""] + elif snaps: + out += [f"### {label}", ""] + for snapshot in snaps: + out += _md_snapshot(snapshot, now) out += ["", decisions.markdown()] return "\n".join(out).rstrip("\n") + "\n" out = [ @@ -467,6 +527,8 @@ def render_markdown(views, now: str | None = None, campaign_data: dict | None = "snapshots/. Do not edit by hand. -->", "", campaigns.markdown(campaign_data if campaign_data is not None else campaigns.load()), + "## Profiling Timings", + "", LEDE, f"Live page: [{PAGES_URL}]({PAGES_URL}).", "", @@ -501,7 +563,7 @@ def render_markdown(views, now: str | None = None, campaign_data: dict | None = CSS = """ .controls{margin:1.2rem 0}.prompt-action{display:flex;flex-wrap:wrap;gap:.5rem .8rem;align-items:center;margin:.7rem 0}.prompt-action details{flex-basis:100%}.prompt-action details:not([open]){flex-basis:auto}.prompt-action summary{cursor:pointer;font-size:.8rem;color:var(--muted)} .prompt-action textarea{width:100%;display:block;margin:.5rem 0;padding:.7rem;font:inherit;font-size:.85rem;color:var(--fg);background:var(--btn);border:1px solid var(--line);border-radius:8px;resize:vertical}.review-meta{font-size:.75rem;color:var(--muted)} -.campaign-table table{width:100%;table-layout:fixed}.campaign-table th:first-child{width:66%}.campaign-table th:nth-child(2){width:21%}.campaign-table th:last-child{width:13%}.campaign-table td{vertical-align:top;padding:.7rem .45rem}.campaign-table strong{font-weight:600}.campaign-detail{margin:.2rem 0 0}.campaign-detail summary{cursor:pointer;font-size:.8rem;padding:.15rem 0}.campaign-detail h3{font-size:.9rem}.campaign-task{border-top:1px solid var(--line);padding:.6rem 0}.campaign-task h4,.campaign-task p{margin:.3rem 0}.campaign-task h4{font-size:.85rem}.campaign-task p{font-size:.8rem}.link-icons{display:flex;gap:.3rem;flex-wrap:wrap}.icon-link{display:inline-flex;justify-content:center;align-items:center;width:2rem;min-height:2rem;border:1px solid var(--line);border-radius:6px;text-decoration:none}.capture-details{margin:1.5rem 0}.capture-details summary{cursor:pointer}.tablewrap{overflow-x:auto}.notions{font-size:.85rem}.warn{color:var(--warn)}.bad{color:var(--bad)}.ok{color:var(--ok)} +.campaign-table table{width:100%;table-layout:fixed}.campaign-table th:first-child{width:66%}.campaign-table th:nth-child(2){width:21%}.campaign-table th:last-child{width:13%}.campaign-table td{vertical-align:top;padding:.7rem .45rem}.campaign-table strong{font-weight:600}.campaign-detail{margin:.2rem 0 0}.campaign-detail summary{cursor:pointer;font-size:.8rem;padding:.15rem 0}.campaign-detail h3{font-size:.9rem}.campaign-task{border-top:1px solid var(--line);padding:.6rem 0}.campaign-task h4,.campaign-task p{margin:.3rem 0}.campaign-task h4{font-size:.85rem}.campaign-task p{font-size:.8rem}.link-icons{display:flex;gap:.3rem;flex-wrap:wrap}.icon-link{display:inline-flex;justify-content:center;align-items:center;width:2rem;min-height:2rem;border:1px solid var(--line);border-radius:6px;text-decoration:none}.capture-details{margin:1.5rem 0}.capture-details summary{cursor:pointer}.tablewrap{overflow-x:auto}.project-group{margin:.6rem 0;border:1px solid var(--line);border-radius:10px;padding:0 .85rem}.project-group>summary{cursor:pointer;font-weight:650;padding:.7rem 0;font-size:1.02rem}.project-group[open]>summary{border-bottom:1px solid var(--line);margin-bottom:.6rem}.project-body{min-width:0;padding-bottom:.6rem}.notions{font-size:.85rem}.warn{color:var(--warn)}.bad{color:var(--bad)}.ok{color:var(--ok)} @media(max-width:34rem){.campaign-table th:first-child{width:57%}.campaign-table th:nth-child(2){width:26%}.campaign-table th:last-child{width:17%}.campaign-table td{padding:.55rem .3rem}.campaign-table .pill{font-size:.65rem;overflow-wrap:anywhere;white-space:normal;text-overflow:clip}.campaign-table{font-size:.8rem}} """ @@ -646,25 +708,58 @@ def _captured_at(views): return min(times) if all(times) else None +def _group(kind: str, label: str, body: str) -> str: + return ( + f'
{_e(label)}' + f'
{body}
' + ) + + +def _warning(snapshot: Snapshot) -> str: + if snapshot.failed or snapshot.cached: + return ( + f'

{_e(snapshot.instance.instance)}: {_e(integrity(snapshot))}. ' + "Displayed evidence retains its captured source.

" + ) + return "" + + +def _profiling_html(snapshot: Snapshot) -> str: + out = _warning(snapshot) + setup_browser.render(snapshot) + if (snapshot.doc or {}).get("version") not in (2, 3): + out += ( + f"

{_e(snapshot.instance.instance)}: setup catalogue unavailable; use the project " + "dashboard for original evidence.

" + ) + return out + + +def _insight_link() -> str: + return f'
PyAutoInsight board' + + def render_html(views, now: str | None = None, campaign_data: dict | None = None) -> str: now = now or _utc_now() shared = setup_browser.theme() browser_css, browser_js = setup_browser.assets() - content = [] - for snapshot in views: - name = snapshot.instance.instance - if snapshot.failed or snapshot.cached: - content.append( - f'

{_e(name)}: {_e(integrity(snapshot))}. Displayed evidence retains its captured source.

' - ) - if is_walltime(snapshot): - content.append(walltime_html(snapshot)) - continue - content.append(setup_browser.render(snapshot)) - if (snapshot.doc or {}).get("version") not in (2, 3): - content.append( - f"

{_e(name)}: setup catalogue unavailable; use the project dashboard for original evidence.

" - ) + profiling = by_project(s for s in views if not is_walltime(s)) + inference = by_project(s for s in views if is_walltime(s)) + sections = ['

Profiling Timings

'] + for label, snaps in profiling.items(): + if snaps: + sections.append(_group("profiling", label, "".join(map(_profiling_html, snaps)))) + if not any(profiling.values()): + sections.append("

No profiling project is registered.

") + sections.append('

Inference Timings

') + for label, snaps in inference.items(): + if label == "PyAutoFit" and not snaps: + body = f"

{_e(INSIGHT_POINTER).replace('PyAutoInsight board', _insight_link())}

" + sections.append(_group("inference", label, body)) + elif snaps: + body = "".join(_warning(s) + walltime_html(s) for s in snaps) + sections.append(_group("inference", label, body)) + content = sections return shared.section_layout( '\n' '' @@ -676,7 +771,8 @@ def render_html(views, now: str | None = None, campaign_data: dict | None = None "Profiling dashboard", navigation=[ {"href": "#campaigns", "label": "Active campaigns"}, - {"href": "#evidence", "label": "Profiling Results"}, + {"href": "#profiling-timings", "label": "Profiling Timings"}, + {"href": "#inference-timings", "label": "Inference Timings"}, {"href": "#decision-history", "label": "Decision History"}, ], ) diff --git a/pulse/campaigns.py b/pulse/campaigns.py index 16b8c3d..d043b11 100644 --- a/pulse/campaigns.py +++ b/pulse/campaigns.py @@ -167,12 +167,6 @@ def markdown(data: dict) -> str: f"- [{_md(task['title'])}]({URL}{task['path']}) — {task['status']}: {_md(task['next'])}" ) rows += ["", "
", ""] - rows += [ - "## Profiling Results", - "", - "Choose a project, dataset and model on the interactive board.", - "", - ] return "\n".join(rows) @@ -227,6 +221,5 @@ def e(value): '

Open means tracked, not necessarily running. Full ledger ↗

', - '

Profiling Results

', ] return "".join(parts) diff --git a/pulse/setup_browser.js b/pulse/setup_browser.js index b10ed0f..95b4d46 100644 --- a/pulse/setup_browser.js +++ b/pulse/setup_browser.js @@ -893,10 +893,10 @@ nav.hidden = detailPage; results.hidden = !selected; if (!selected) return; - const back = append(results, "a", "← Profiling Results", "back-link"); + const back = append(results, "a", "← Profiling Timings", "back-link"); const home = new URL(location.href); home.searchParams.delete("view"); - home.hash = "evidence"; + home.hash = "profiling-timings"; back.href = home.href; append( results, diff --git a/tests/browser_setup.cjs b/tests/browser_setup.cjs index d4f47b6..6ab574e 100644 --- a/tests/browser_setup.cjs +++ b/tests/browser_setup.cjs @@ -100,7 +100,8 @@ const { execFileSync } = require("node:child_process"); 0, ); assert.equal(await page.locator(".capture-details").count(), 0); - await page.locator('a[href="#evidence"]').first().click(); + await page.locator('a[href="#profiling-timings"]').first().click(); + await page.locator("#profiling-pyautolens > summary").click(); await root.locator('[data-id="project-picker"] > summary').click(); await root.locator('[data-family="imaging"] > summary').click(); const popupEvent = context.waitForEvent("page"); diff --git a/tests/test_board.py b/tests/test_board.py index fa21ae7..8ff371d 100644 --- a/tests/test_board.py +++ b/tests/test_board.py @@ -262,18 +262,26 @@ def test_v2_status_lines_are_unchanged(): assert "**Lifecycle:**" not in md -def test_walltime_instance_renders_its_own_table_under_profiling_results(): +def test_profiling_and_inference_timings_open_per_project(): lens = _snapshot("lens", "profiling-summary@3", "setup_summary_v3.json") wall = _snapshot("lens-walltime", "walltime-validation@1", "walltime_validation_v1.json") data = {"campaigns": [], "tasks": []} page = board.render_html([lens, wall], NOW, campaign_data=data) - results = page.index('id="evidence"') - table = page.index('data-walltime="lens-walltime"') - assert results < table + assert 'id="evidence"' in page # old links still land + profiling = page.index('id="profiling-timings"') + inference = page.index('id="inference-timings"') + assert profiling < page.index('id="profiling-pyautolens"') < inference + assert ( + inference < page.index('id="inference-pyautofit"') < page.index('id="inference-pyautolens"') + ) + assert inference < page.index('data-walltime="lens-walltime"') + assert board.INSIGHT_URL in page and ">Profiling Results" not in page + assert '"#profiling-timings"' in page and '"#inference-timings"' in page assert "Full-fit measurements" in page and "nautilus" in page assert "setup catalogue unavailable" not in page md = board.render_markdown([lens, wall], NOW, campaign_data=data) - assert md.index("## Profiling Results") < md.index("wall-time validation") + assert md.index("## Profiling Timings") < md.index("## Inference Timings") + assert md.index("## Inference Timings") < md.index("wall-time validation") assert "| Measured/predicted |" in md and "| 1.26 |" in md state = board.render_state([wall], updated=NOW, now=NOW) assert not any(i["id"].endswith(":unqualified") for i in state["items"]) diff --git a/tests/test_campaigns.py b/tests/test_campaigns.py index 43ca10e..2ad0dfe 100644 --- a/tests/test_campaigns.py +++ b/tests/test_campaigns.py @@ -71,7 +71,7 @@ def test_control_room_precedes_measurements_and_escapes(): text.index("Profiling Check In") < text.index("Active campaigns") < text.index("Active tasks") - < text.index("Profiling Results") + < text.index("Profiling Timings") ) page = board.render_html([], campaign_data=data) assert "" not in page From cd6e23c703d7dbebff05d12ccb441d10f8a296f4 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 26 Oct 2026 15:39:03 +0000 Subject: [PATCH 03/16] setup browser: concise runtime-only profiling table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Columns Dataset type | Model | Instrument | Regime | Setup | Hardware class | Model variant | Runtime s | Est. 12-core s | Class | ›. Runtime s is the producer's vmap per-call (projected_node_throughput.per_call_s), Est. 12-core s its estimated_12_core.value_s (numba CPU only), bold, 5 DP, display rounding only. Setup drops the precision token; non-fp64 precision joins the model variant. Class defaults to All; Measurement column/selector and the per-node view are gone; a green tally sits above History; the knowledge link moves under Extra Information. The JS filter now also serves tables with no History or status. Headers never wrap; numbers right-aligned. Co-Authored-By: Claude Opus 5.5 --- REFERENCE.md | 43 ++-- pulse/setup_browser.css | 73 +++++- pulse/setup_browser.js | 34 +-- pulse/setup_browser.py | 318 +++++++++++++++------------ tests/browser_setup.cjs | 120 ++++------ tests/fixtures/setup_summary_v3.json | 9 + tests/test_board.py | 4 +- tests/test_setup_browser.py | 138 +++++++----- 8 files changed, 424 insertions(+), 315 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index f911321..cbf775a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -309,23 +309,36 @@ their η, its source and the bounding limit (see Board below). The reasoning beh numbers, as decision rules for the autolens_assistant, is the knowledge page [Comparing CPU-parallel and GPU-batched setups](knowledge/cpu_parallel_vs_gpu_batched.md). -**Board.** The setup browser's first selector is Class (Optimal by default, -then Secondary, Experimental, All), then Likelihood (dataset type, variant), -Instrument, Hardware class and Measurement. Only `current` rows show until -History is ticked, which adds `superseded` rows. Archived records appear only -as a count. A Coverage panel lists optimal `planned_cells` with no current -record. Research lookups read `class: optimal` + `status: current` unless asked +**Board.** Under **Profiling Timings**, a v3 instance renders a runtime-only +table: one row per `measurement: runtime` record. Filters: Class (All by +default, then Optimal, Secondary, Experimental), Dataset type, Model, +Instrument, Hardware class. Only `current` rows show until History is ticked, +which adds `superseded` rows; archived records appear only as a count. A green +tally (top right, above History) counts the current rows. Columns: Dataset type +| Model | Instrument | Regime | Setup | Hardware class | Model variant | +**Runtime s** | **Est. 12-core s** | Class | ›. Setup is the `setup_id` +without its precision token (`jax_gpu_sparse_fp64` → `jax_gpu_sparse`); a +non-fp64 precision is appended to the model variant (`default+mixed`). +Runtime s is the producer's vmap per-call time +`projected_node_throughput.per_call_s`; Est. 12-core s is the producer's +`estimated_12_core.value_s` (numba CPU records only, — elsewhere). Both are +rounded to 5 decimal places for display only, with the exact value in the +tooltip; Pulse computes neither. A Coverage panel lists optimal `planned_cells` +with no current record, and "Extra Information" links the knowledge page. +Research lookups read `class: optimal` + `status: current` unless asked otherwise. The v2 eligibility heuristics never apply to a v3 catalogue. -A **View** selector (after History) switches the value column between **Per -call (measured)**, the default, and **Per node (projected)**. Per node prints the -producer's `projected_node_throughput` (calls/s, workers, bounding limit, host) -with a **projected** badge; focusing or hovering the badge shows a tooltip with -η, its source, the bounding limit and worker caps, the per-call basis and what -is not modelled (Escape dismisses it). `not_projected` rows print the producer's -reason; rows without the block print a dash. The default stays per call until -phase 4 measures η, so a projection never headlines. The Markdown board adds a -"Node throughput (projected)" column with the same marking. +**Detail pages.** Each row's › opens that record's detail page on the same +board (`?view=setup&instance=&record=`): its runtime values +(including `single_jit_median` / `single_jit_block`), the 12-core estimate, +the breakdown, compile, memory and parity records on the same key +(`likelihood`, `instrument`, `setup_id`, `host_class`, `model_variant`, +`regime`) and the same status, as bars within each panel, the producer's node +throughput projection marked **projected** with η, its source and bound, class, +status, decision, validation, limitations, configuration, evidence and figure +links at the captured commit, and the record's history (every runtime record on +the key). An id that is not in the captured catalogue shows a status line and no +substitute. ## `walltime-validation` v1: full-fit evidence axis diff --git a/pulse/setup_browser.css b/pulse/setup_browser.css index 16c6083..fb5f912 100644 --- a/pulse/setup_browser.css +++ b/pulse/setup_browser.css @@ -336,6 +336,74 @@ button.retry { padding: 0.35rem 0.45rem; vertical-align: top; } +/* Headers never wrap; times are right-aligned, bold and tabular. */ +.lifecycle-table th { + white-space: nowrap; +} +.lifecycle-table .num { + text-align: right; + white-space: nowrap; + font-variant-numeric: tabular-nums; +} +.lifecycle-table td.num b { + font-weight: 700; +} +.lifecycle-table .open { + position: relative; + width: 1.6rem; + text-align: center; +} +.row-open { + display: inline-block; + min-width: 1.6rem; + font-size: 1.1rem; + font-weight: 700; + line-height: 1; + text-decoration: none; +} +.visually-hidden { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + white-space: nowrap; +} +.table-tools { + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 0.35rem; + margin: 0.2rem 0 0.6rem; +} +.tally { + color: var(--ok); + font-weight: 700; + font-size: 0.8rem; + border: 1px solid currentColor; + border-radius: 999px; + padding: 0.1rem 0.6rem; + white-space: nowrap; +} +.history-toggle { + font-size: 0.85rem; +} +.extra-info { + margin: 1.2rem 0 0.3rem; + font-size: 0.9rem; +} +.size-badge { + display: inline-block; + margin-left: 0.3rem; + padding: 0 0.35rem; + border: 1px dashed var(--warn); + border-radius: 999px; + color: var(--warn); + font-size: 0.7rem; + font-weight: 600; + white-space: nowrap; + cursor: help; +} .lifecycle-coverage { margin: 1rem 0; } @@ -343,11 +411,6 @@ button.retry { cursor: pointer; font-weight: 600; } -/* Per-node view: the producer's projection, visibly marked and never headline. */ -.lifecycle-browser .view-note { - color: var(--muted); - font-size: 0.85rem; -} .projected-wrap { position: relative; display: inline-block; diff --git a/pulse/setup_browser.js b/pulse/setup_browser.js index 95b4d46..fa60697 100644 --- a/pulse/setup_browser.js +++ b/pulse/setup_browser.js @@ -2,8 +2,10 @@ * Consumes captured producer data only. No cross-setup joins or scientific judgement. */ (() => { "use strict"; - // profiling-summary@3: the producer declares class and status. Filtering only - // shows or hides server-rendered rows; nothing is ranked, joined or chosen. + // Server-rendered timing tables (profiling-summary@3 runtime rows and the + // walltime-validation runs). Filtering only shows or hides rows; nothing is + // ranked, joined or chosen. Rows without data-status (inference runs) and + // tables without a History checkbox are handled the same way. function lifecycle(root) { const filters = [...root.querySelectorAll("select[data-filter]")]; const history = root.querySelector('input[data-filter="history"]'); @@ -14,8 +16,9 @@ for (const row of rows) { const status = row.getAttribute("data-status"); const visible = - (status === "current" || - (history.checked && status === "superseded")) && + (status === null || + status === "current" || + (history && history.checked && status === "superseded")) && filters.every((select) => { const key = select.dataset.filter; const value = select.value; @@ -28,30 +31,11 @@ row.hidden = !visible; if (visible) shown += 1; } - empty.hidden = shown > 0; + if (empty) empty.hidden = shown > 0; } - for (const control of [...filters, history]) + for (const control of [...filters, history].filter(Boolean)) control.addEventListener("change", apply); apply(); - // Per call (measured, the default) <-> per node (the producer's projection). - // Only swaps which server-rendered value shows; nothing is computed here. - const view = root.querySelector("select[data-view]"); - const swap = () => { - root.dataset.view = view.value; - for (const el of root.querySelectorAll("[data-view-value]")) - el.hidden = el.dataset.viewValue !== view.value; - }; - view.addEventListener("change", swap); - swap(); - // Escape dismisses a focused or hovered "projected" tooltip (WCAG 1.4.13). - for (const badge of root.querySelectorAll(".projected-badge")) { - const wrap = badge.parentElement; - badge.addEventListener("keydown", (event) => { - if (event.key === "Escape") wrap.classList.add("dismissed"); - }); - for (const type of ["blur", "mouseleave"]) - wrap.addEventListener(type, () => wrap.classList.remove("dismissed"), true); - } } for (const root of document.querySelectorAll("[data-setup-browser]")) { if (root.hasAttribute("data-lifecycle")) { diff --git a/pulse/setup_browser.py b/pulse/setup_browser.py index ffd288b..0b3683c 100644 --- a/pulse/setup_browser.py +++ b/pulse/setup_browser.py @@ -1,10 +1,12 @@ """Render setup navigation from captured v2/v3 evidence; never select scientific truth. -A v3 (lifecycle) catalogue renders a Class-first browser: Class (Optimal by -default) → Likelihood (dataset type → variant) → Instrument → Hardware class → -Measurement, showing ``status: current`` rows unless History is ticked. The -producer declares class and status; the board ranks nothing, picks no fastest -row and shows archived records only as a count. +A v3 (lifecycle) catalogue renders a runtime-only table: filters Class (All by +default) → Dataset type → Model → Instrument → Hardware class, one row per +``runtime`` record showing ``status: current`` rows unless History is ticked. +Runtime s is the producer's vmap per-call time and Est. 12-core s its +``estimated_12_core`` value (numba CPU only), both rounded for display; each row +opens a detail page. The producer declares class and status; the board ranks +nothing, picks no fastest row and shows archived records only as a count. """ from __future__ import annotations @@ -14,7 +16,7 @@ import json import os from pathlib import Path -from urllib.parse import quote +from urllib.parse import quote, urlencode from pulse import ORGAN_ROOT, catalogue @@ -42,19 +44,25 @@ def assets(): CLASS_OPTIONS = ( + ("all", "All"), ("optimal", "Optimal"), ("secondary", "Secondary"), ("experimental", "Experimental"), - ("all", "All"), ) # The selector order after Class; each is a data-* attribute on every row. FILTERS = ( - ("dataset_type", "Likelihood"), - ("variant", "Variant"), + ("dataset_type", "Dataset type"), + ("variant", "Model"), ("instrument", "Instrument"), ("host_class", "Hardware class"), - ("measurement", "Measurement"), ) +PRECISIONS = ("fp64", "fp32", "fp16", "bf16", "mixed") +PNT = "projected_node_throughput" +KNOWLEDGE_URL = ( + "https://github.com/PyAutoLabs/PyAutoPulse/blob/main/knowledge/cpu_parallel_vs_gpu_batched.md" +) +KNOWLEDGE_TITLE = "Comparing CPU-parallel and GPU-batched setups" +DP = 5 # display rounding of every per-call time (presentation only) def lifecycle(doc) -> bool: @@ -70,13 +78,39 @@ def _row_fields(record): "variant": likelihood.get("variant"), "instrument": record.get("instrument"), "host_class": record.get("host_class"), - "measurement": record.get("measurement"), } +def precision(setup_id) -> str | None: + """The precision token a setup id carries (``fp64``, ``fp32``, ``mixed``…), if any.""" + return next((t for t in str(setup_id or "").split("_") if t in PRECISIONS), None) + + +def setup_label(setup_id) -> str: + """The setup id without its precision token: ``jax_gpu_sparse_fp64`` → ``jax_gpu_sparse``.""" + return "_".join(t for t in str(setup_id or "").split("_") if t not in PRECISIONS) + + +def variant_label(model_variant, setup_id) -> str: + """The model variant, with a non-fp64 precision appended (``default+mixed``).""" + p = precision(setup_id) + return str(model_variant) if p in (None, "fp64") else f"{model_variant}+{p}" + + +def runtime_rows(doc) -> list[dict]: + """The v3 ``runtime`` records the table shows (current, and superseded with History).""" + return [ + r + for r in (doc or {}).get("records") or [] + if isinstance(r, dict) + and r.get("measurement") == "runtime" + and r.get("status") in ("current", "superseded") + ] + + def default_visible(record) -> bool: - """The default view: Optimal class, current status, no other filter.""" - return record.get("class") == "optimal" and record.get("status") == "current" + """The default view: every class, current status, no other filter.""" + return record.get("status") == "current" def not_measured(doc) -> list[dict]: @@ -100,34 +134,36 @@ def _cell_label(cell): ) -def _value(record): - values = record.get("values") or {} - metric = record.get("metric") - return f"{values.get(metric)} {record.get('unit')} ({metric})" +def _real(value) -> bool: + return isinstance(value, int | float) and not isinstance(value, bool) -# Per-call (measured, the default) ↔ per-node (the producer's projection). The -# default stays per-call until phase 4 measures η, so a projection never headlines. -VIEW_OPTIONS = ( - ("per_call", "Per call (measured)"), - ("per_node", "Per node (projected)"), -) -PNT = "projected_node_throughput" -KNOWLEDGE_URL = ( - "https://github.com/PyAutoLabs/PyAutoPulse/blob/main/knowledge/cpu_parallel_vs_gpu_batched.md" -) -KNOWLEDGE_TITLE = "Comparing CPU-parallel and GPU-batched setups" +def fixed(value, dp: int = DP) -> str | None: + """``value`` rounded to ``dp`` decimal places for display, else None.""" + return f"{value:.{dp}f}" if _real(value) else None + + +def runtime_s(record): + """The producer's vmap per-call time (``projected_node_throughput.per_call_s``).""" + block = record.get(PNT) + return block.get("per_call_s") if isinstance(block, dict) else None + + +def twelve_core_s(record): + """The producer's ``estimated_12_core.value_s`` (numba CPU records only).""" + block = record.get("estimated_12_core") + return block.get("value_s") if isinstance(block, dict) else None def _number(value): - return f"{value:g}" if isinstance(value, int | float) and not isinstance(value, bool) else "?" + return f"{value:g}" if _real(value) else "?" def node_throughput(record): """``(kind, text, detail)`` for the producer's declared projection, never computed here. ``kind`` is ``projected``, ``not_projected`` or ``None`` (no block declared). - ``detail`` is the tooltip text: η, its source, the bounding limit, the per-call + ``detail`` is the explanation: η, its source, the bounding limit, the per-call basis and what is not modelled. """ block = record.get(PNT) @@ -155,79 +191,109 @@ def node_throughput(record): return "projected", text, detail -def _node_cell(record, tip_id, e): - kind, text, detail = node_throughput(record) - if kind == "projected": - return ( - f"{e(text)} projected{e(detail)}" - ) - return f"{e(text)}" if kind else "—" +def _e(value) -> str: + return html.escape(str(value), quote=True) -def _render_lifecycle(snapshot): - doc = snapshot.doc - instance = snapshot.instance - e = lambda v: html.escape(str(v), quote=True) # noqa: E731 - records = [r for r in doc.get("records") or [] if isinstance(r, dict)] - counts = catalogue.lifecycle_counts(doc) - fields = [ - f'" ) - + "" - ] - for key, title in FILTERS: - values = sorted({str(_row_fields(r)[key]) for r in records}) + for key, title in keys: fields.append( - f'" ) - fields.append( - '" - ) - fields.append( - f'" + if history + else "" ) - + "" + + "" + ) + + +def _render_lifecycle(snapshot): + doc = snapshot.doc + instance = snapshot.instance + e = _e + records = runtime_rows(doc) + filters = selectors( + instance.instance, + FILTERS, + lambda key: sorted({str(_row_fields(r)[key]) for r in records}), + with_class=True, ) rows = [] - for n, r in enumerate(records): + for r in records: attrs = "".join(f' data-{k.replace("_", "-")}="{e(v)}"' for k, v in _row_fields(r).items()) hidden = "" if default_visible(r) else " hidden" - ev = r.get("evidence") or {} - links = [] - if ev.get("path"): - url = instance.blob_url(snapshot.commit, quote(ev["path"], safe="/")) - links.append(f'evidence') - for fig in r.get("figures") or []: - url = instance.blob_url(snapshot.commit, quote(fig["path"], safe="/")) - links.append(f'{e(fig["kind"])} figure') likelihood = r.get("likelihood") or {} + block = r.get(PNT) if isinstance(r.get(PNT), dict) else {} rows.append( f'' - f"{e(likelihood.get('dataset_type'))}/{e(likelihood.get('variant'))}" + f"{e(likelihood.get('dataset_type'))}{e(likelihood.get('variant'))}" f"{e(r.get('instrument'))}{e(r.get('regime'))}" - f"{e(r.get('setup_id'))}{e(r.get('host_class'))}" - f"{e(r.get('model_variant'))}{e(r.get('measurement'))}" - f"{e(_value(r))}" - f"" - f"{e(r.get('class'))}" - f"{e(r.get('status'))}{e(r.get('decision_id') or '—')}" - f"{' · '.join(links) or '—'}" + f"{e(setup_label(r.get('setup_id')))}" + f"{e(r.get('host_class'))}" + f"{e(variant_label(r.get('model_variant'), r.get('setup_id')))}" + + time_cell( + runtime_s(r), + f"per call, {block.get('per_call_source') or 'source not declared'}", + "no vmap per-call time declared", + ) + + time_cell( + twelve_core_s(r), + "producer estimate at 12 cores", + "numba CPU setups only", + ) + + f"{e(r.get('class'))}" + + open_link("setup", instance.instance, r.get("id"), "Open this setup's details") + + "" ) visible = sum(default_visible(r) for r in records) missing = not_measured(doc) @@ -241,34 +307,23 @@ def _render_lifecycle(snapshot): ) + "" ) - label = instance.repo.removesuffix("_profiling").replace("autolens", "PyAutoLens") return ( f'
' - f"

{e(label)}: setups by class

" - f'
{"".join(fields)}
' - f'

{counts["current"]} current · {counts["superseded"]} ' - f"superseded (shown with History) · {counts['archived']} archived (counted, not shown). " - "Class and status are the producer's declarations; this board ranks nothing.

" - '" - f'

Read: {KNOWLEDGE_TITLE} (decision rules, not a ' - "decision).

" - '
' - "" - "" - "" - f"{''.join(rows)}
LikelihoodInstrumentRegimeSetupHardware classModel variantMeasurement" - "Value (producer)" - "" - "ClassStatusDecisionEvidence
" + + filters + + tally(visible, history=True) + + '
' + "" + "" + "" + f"{''.join(rows)}
Dataset typeModelInstrumentRegimeSetupHardware classModel variantRuntime sEst. 12-core sClassDetails
" f'

' - "No record matches this selection.

" + coverage + "
" + "No record matches this selection.

" + + coverage + + '

Extra Information

' + f'

{KNOWLEDGE_TITLE}

' + "" ) @@ -314,49 +369,40 @@ def render(snapshot): ) -def _node_markdown(record): - kind, text, detail = node_throughput(record) - if kind == "projected": - block = record[PNT] - eta = block.get("parallel_efficiency") or {} - return f"{text} — *projected*, η {_number(eta.get('value'))} ({eta.get('source')})" - return text if kind else "—" +def _md_time(value) -> str: + shown = fixed(value) + return f"**{shown}**" if shown is not None else "—" def _markdown_lifecycle(snapshot): doc = snapshot.doc - counts = catalogue.lifecycle_counts(doc) name = snapshot.instance.repo.removesuffix("_profiling") + current = [r for r in runtime_rows(doc) if default_visible(r)] lines = [ - f"
{html.escape(name)} — optimal, current setups", + f"
{html.escape(name)} — current runtime setups", "", f"[Interactive setup browser]({snapshot.instance.dashboard_url})", "", - f"{counts['current']} current · {counts['superseded']} superseded · " - f"{counts['archived']} archived (counted, not shown). Class and status are the " - "producer's declarations.", - "", - f"Per-node values are the producer's projections, never measurements: read " - f"[{KNOWLEDGE_TITLE}]({KNOWLEDGE_URL}) before comparing CPU and GPU setups.", + f"{len(current)} current result{'' if len(current) == 1 else 's'}.", "", - "| Likelihood | Instrument | Setup | Hardware class | Model variant | Measurement " - "| Value (producer) | Decision | Node throughput (projected) |", - "|---|---|---|---|---|---|---:|---|---|", + "| Dataset type | Model | Instrument | Regime | Setup | Hardware class | Model variant " + "| Runtime s | Est. 12-core s | Class |", + "|---|---|---|---|---|---|---|---:|---:|---|", ] esc = lambda v: html.escape(str(v)).replace("|", "\\|") # noqa: E731 - for r in doc.get("records") or []: - if not default_visible(r): - continue + for r in current: likelihood = r.get("likelihood") or {} lines.append( - f"| {esc(likelihood.get('dataset_type'))}/{esc(likelihood.get('variant'))} " - f"| {esc(r.get('instrument'))} | `{esc(r.get('setup_id'))}` | {esc(r.get('host_class'))} " - f"| {esc(r.get('model_variant'))} | {esc(r.get('measurement'))} | {esc(_value(r))} " - f"| {esc(r.get('decision_id'))} | {esc(_node_markdown(r))} |" + f"| {esc(likelihood.get('dataset_type'))} | {esc(likelihood.get('variant'))} " + f"| {esc(r.get('instrument'))} | {esc(r.get('regime'))} " + f"| `{esc(setup_label(r.get('setup_id')))}` | {esc(r.get('host_class'))} " + f"| {esc(variant_label(r.get('model_variant'), r.get('setup_id')))} " + f"| {_md_time(runtime_s(r))} | {_md_time(twelve_core_s(r))} | {esc(r.get('class'))} |" ) missing = not_measured(doc) lines += ["", f"Coverage: {len(missing)} optimal cell(s) not measured.", ""] lines += [f"- {esc(_cell_label(c))}" for c in missing] + lines += ["", "#### Extra Information", "", f"[{KNOWLEDGE_TITLE}]({KNOWLEDGE_URL})"] lines += ["", "
", ""] return lines diff --git a/tests/browser_setup.cjs b/tests/browser_setup.cjs index 6ab574e..ce5cc58 100644 --- a/tests/browser_setup.cjs +++ b/tests/browser_setup.cjs @@ -624,38 +624,41 @@ const { execFileSync } = require("node:child_process"); ), ); } - // profiling-summary@3: Class first, Optimal + current by default, - // superseded rows only with History, archived never rendered. + // profiling-summary@3: a runtime-only table. Class first (All by default), + // current rows only until History, archived never rendered. await page.setViewportSize({ width: 1280, height: 1000 }); await page.goto(base + "/lifecycle.html"); - const life = page.locator("[data-lifecycle]"); - await life.evaluate((el) => { - for (let p = el.parentElement; p; p = p.parentElement) - if (p.tagName === "DETAILS") p.open = true; - }); + const life = page.locator("[data-lifecycle][data-setup-browser='lens']"); + const openGroups = (target) => + target.evaluate((el) => { + for (let p = el.parentElement; p; p = p.parentElement) + if (p.tagName === "DETAILS") p.open = true; + }); + await openGroups(life); const firstSelect = life.locator("select").first(); assert.equal(await firstSelect.getAttribute("data-filter"), "class"); - assert.equal(await firstSelect.inputValue(), "optimal"); + assert.equal(await firstSelect.inputValue(), "all"); assert.deepEqual( await life .locator(".lifecycle-selectors > label") .evaluateAll((els) => els.map((e) => e.firstChild.textContent.trim())), - [ - "Class", - "Likelihood", - "Variant", - "Instrument", - "Hardware class", - "Measurement", - "", - "View", - ], + ["Class", "Dataset type", "Model", "Instrument", "Hardware class"], ); const row = (id) => life.locator(`tr[data-record="${id}"]`); const old = row("imaging-delaunay-hst-a100-runtime-old"); assert(await row("imaging-delaunay-hst-a100-runtime").isVisible()); + assert(await row("imaging-delaunay-hst-ral-runtime").isVisible()); assert(!(await old.isVisible())); - assert(!(await row("imaging-delaunay-hst-ral-runtime").isVisible())); + // The green tally sits top right, above History. + const tally = life.locator('[data-id="tally"]'); + assert(await tally.isVisible()); + assert.equal(await tally.textContent(), "4 results"); + const tallyBox = await tally.boundingBox(); + const historyBox = await life.locator(".history-toggle").boundingBox(); + assert(tallyBox.y + tallyBox.height <= historyBox.y + 1); + assert( + Math.abs(tallyBox.x + tallyBox.width - (historyBox.x + historyBox.width)) < 2, + ); await life.locator('input[data-filter="history"]').check(); assert(await old.isVisible()); await life.locator('input[data-filter="history"]').uncheck(); @@ -666,64 +669,36 @@ const { execFileSync } = require("node:child_process"); await firstSelect.selectOption("all"); await life.locator('select[data-filter="instrument"]').selectOption("sma"); assert.equal(await life.locator("tr[data-record]:visible").count(), 1); - await life.locator('select[data-filter="measurement"]').selectOption("breakdown"); + await life.locator('select[data-filter="variant"]').selectOption("delaunay"); assert(await life.locator('[data-id="no-rows"]').isVisible()); + await life.locator('select[data-filter="instrument"]').selectOption(""); + await life.locator('select[data-filter="variant"]').selectOption(""); assert.equal(await life.locator('tr[data-status="archived"]').count(), 0); assert( (await life.locator('[data-id="coverage"] summary').textContent()).includes( "1 optimal cell not measured", ), ); - // Per call (measured) by default; per node shows the producer's projection, - // visibly marked, with η/source/bound in a keyboard-reachable tooltip. - await life.locator('select[data-filter="instrument"]').selectOption(""); - await life.locator('select[data-filter="measurement"]').selectOption(""); const knowledge = life.locator('[data-id="knowledge-link"] a'); assert(await knowledge.isVisible()); assert.equal(await knowledge.getAttribute("target"), "_blank"); - const view = life.locator("select[data-view]"); - assert.equal(await view.inputValue(), "per_call"); - const ral = row("imaging-delaunay-hst-ral-runtime"); - const perCall = ral.locator('[data-view-value="per_call"]'); - const perNode = ral.locator('[data-view-value="per_node"]'); - assert(await perCall.isVisible()); - assert(!(await perNode.isVisible())); - assert(!(await life.locator('[data-id="view-note"]').isVisible())); - await life.locator('input[data-filter="history"]').focus(); - await page.keyboard.press("Tab"); - assert.equal( - await page.evaluate(() => document.activeElement.hasAttribute("data-view")), - true, - ); - await view.selectOption("per_node"); - assert(!(await perCall.isVisible())); - assert(await perNode.isVisible()); - assert(await life.locator('[data-id="view-note"]').isVisible()); + // Bold 5-DP runtime; headers on one line (no "Likeliho- od"). + const runtime = row("imaging-delaunay-hst-ral-runtime").locator("td.num b").first(); + assert.equal(await runtime.textContent(), "0.21000"); assert( - (await perNode.textContent()).includes( - "190.5 calls/s · 40 workers (memory-bound)", - ), - ); - assert( - ( - await row("interferometer-mge-sma-ral-runtime") - .locator('[data-view-value="per_node"]') - .textContent() - ).startsWith("not projected:"), - ); - const badge = perNode.locator(".projected-badge"); - const tip = perNode.locator(".projected-tip"); - assert.equal(await badge.textContent(), "projected"); - assert(!(await tip.isVisible())); - await badge.focus(); - assert(await tip.isVisible()); - assert.equal( - await badge.evaluate((el) => - document.getElementById(el.getAttribute("aria-describedby")).getAttribute("role"), - ), - "tooltip", - ); - assert((await tip.textContent()).includes("Bound by memory")); + Number(await runtime.evaluate((el) => getComputedStyle(el).fontWeight)) >= 700, + ); + const oneLine = async (table) => + table.locator("th").evaluateAll((ths) => + ths.every((th) => { + const line = parseFloat(getComputedStyle(th).lineHeight) || 20; + const pad = + parseFloat(getComputedStyle(th).paddingTop) + + parseFloat(getComputedStyle(th).paddingBottom); + return th.getBoundingClientRect().height - pad < line * 1.6; + }), + ); + assert(await oneLine(life.locator("table"))); for (const width of [390, 1280]) { await page.setViewportSize({ width, height: 1000 }); assert( @@ -732,18 +707,7 @@ const { execFileSync } = require("node:child_process"); ), ); } - await page.keyboard.press("Escape"); - assert(!(await tip.isVisible())); - const badgeColor = () => - badge.evaluate((el) => getComputedStyle(el).color); - await page.emulateMedia({ colorScheme: "light" }); - assert.equal(await badgeColor(), "rgb(154, 103, 0)"); - await page.emulateMedia({ colorScheme: "dark" }); - assert.equal(await badgeColor(), "rgb(210, 153, 34)"); - await page.emulateMedia({ colorScheme: "light" }); - await view.selectOption("per_call"); - assert(await perCall.isVisible()); - assert(!(await perNode.isVisible())); + await page.setViewportSize({ width: 1280, height: 1000 }); assert.equal(await page.locator('[data-walltime="walltime"]').count(), 1); for (const width of [390, 1280]) { await page.setViewportSize({ width, height: 1000 }); diff --git a/tests/fixtures/setup_summary_v3.json b/tests/fixtures/setup_summary_v3.json index f05f4ff..e9370f9 100644 --- a/tests/fixtures/setup_summary_v3.json +++ b/tests/fixtures/setup_summary_v3.json @@ -381,6 +381,15 @@ "calls_per_s": 190.5 } ] + }, + "estimated_12_core": { + "basis": "estimate", + "cores": 12, + "divisor": 6, + "per_call_s": 0.21, + "per_call_source": "warm_iid_median_s", + "ruling": "fixture", + "value_s": 0.035 } }, { diff --git a/tests/test_board.py b/tests/test_board.py index 8ff371d..a9fd4a1 100644 --- a/tests/test_board.py +++ b/tests/test_board.py @@ -246,8 +246,8 @@ def test_v3_status_lines_carry_lifecycle_counts(): assert board.lifecycle(s) == expected md = board.render_markdown([s], NOW, campaign_data={"campaigns": [], "tasks": []}) assert f"- **Lifecycle:** {expected}" in md - assert "optimal, current setups" in md - assert "imaging/delaunay | hst | `jax_gpu_dense_fp64`" in md + assert "current runtime setups" in md + assert "| imaging | delaunay | hst | standard | `jax_gpu_dense` |" in md assert "imaging-delaunay-hst-a100-runtime-old" not in md assert "Coverage: 1 optimal cell(s) not measured." in md state = board.render_state([s], updated=NOW, now=NOW) diff --git a/tests/test_setup_browser.py b/tests/test_setup_browser.py index ae2cb66..2cc89d6 100644 --- a/tests/test_setup_browser.py +++ b/tests/test_setup_browser.py @@ -105,7 +105,7 @@ def lifecycle_capture(): return replace(snapshot, doc=fixture_doc("setup_summary_v3.json")) -def test_v3_first_select_is_class_with_optimal_selected(): +def test_v3_first_select_is_class_with_all_selected(): page = setup_browser.render(lifecycle_capture()) selects = re.findall(r"]*data-filter=\"([a-z_]+)\"[^>]*>(.*?)", page, re.S) assert [key for key, _ in selects] == [ @@ -114,29 +114,88 @@ def test_v3_first_select_is_class_with_optimal_selected(): "variant", "instrument", "host_class", - "measurement", ] options = re.findall(r'
', page, re.S)[1] @@ -152,62 +211,31 @@ def test_v3_bypasses_the_v2_payload_and_heuristics(): assert "data-lifecycle" not in v2 and "setup-payload" in v2 -# ------------------------- v3 per-call ↔ per-node view (phase 2x, Pulse#76) --- - - -def test_v3_view_defaults_to_per_call_and_per_node_is_hidden(): - page = setup_browser.render(lifecycle_capture()) - view = re.search(r"]*data-view>(.*?)", page, re.S)[1] - assert re.findall(r'