Skip to content

feat: campaign carbon estimate and end-of-campaign report (hpc-campaign p4) - #1748

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/hpc-campaign-p4-carbon-report
Oct 30, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/hpc-campaign-p4-carbon-report

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

hpc-campaign phase 4 (#1746). Stacked on #1747 (phase 3); merge that first. Both add commands to campaign/__main__.py, and that conflict is already resolved here. Site constants come from the PyAutoNerves companion PR (PyAutoLabs/PyAutoNerves#209).

  • carbon.py: a Green Algorithms estimate, E = t × (n_c P_c u_c + n_m × 0.3725 W/GB) × PUE, C = E × CI.
    • Four cases: low; central (usage basis, requested memory); allocation (u = 1); high (high inputs on the allocation basis).
    • Ranges come from the site's low/high values. Carbon-intensity bounds are the spread across bases (ruling F6).
    • Energy is split into successful, failed/repeated and in-progress work, with values per completed task.
    • There are no Green Algorithms default fallbacks: if the site has no carbon-intensity table the output is energy only, and if W per CPU or PUE is missing there is no estimate. --pue, --tdp and --ci override the site values.
    • The NESO fetch is optional and cached (--neso), the --begin-hint is optional, and nothing uses the network by default.
    • forecast(StageForecast…) estimates a planned campaign.
  • report.py: python -m autofit.campaign report works from a live or retro digest, or a campaign.yaml. It writes report.md + report.json covering compute, energy and carbon, the failure census, per-stage tables and results counts. It ends with a paste-ready paper paragraph that says "estimate", gives the range, names the carbon-intensity basis and the other bases, and lists what is excluded. "Saving" appears nowhere, and a test asserts it.

Heart RED override (development only)

Heart was RED at the start of this task (2026-10-30): release validation FAILED (stage integrate); PyAutoHeart/workflows/Release Integrate failure; PyAutoNerves test_fitsable.py::test__output_to_fits red; unit-test timing 1 regression (>3× baseline), 14 slow; autogalaxy red; release validation NOT release_ready (v2026.10.30.1.dev85101); autolens_profiling red; worktree drift 1 dirty. The human authorized the Human override for Heart RED (development only) live for hpc-campaign phases 3 and 4 ("Override, proceed"). This PR touches no RED item and does not fix Heart. Merging still needs green CI and a separate /prm; it permits no release.

Decisions taken (please check)

  1. Carbon-intensity range: the range is the spread across bases (F6). For RAL, regional (188) is the highest basis, so the high bound uses no intensity above central. Half-hourly p5/p95 values are stored but not used, because a campaign averages over them.
  2. Earlier attempts are charged with the final attempt's CPUs and memory. Tasks with no CPU time count at u = 1, GPUs at full TDP, and a partition the site doesn't list takes the widest range of the partitions it does list.
  3. Successful work means the final attempt of a completed task that passed its success check. Pending, running and timeout-pending tasks go in an "in progress" bucket that counts toward neither share.

Test plan

  • test_autofit/campaign: 151 passed on this stacked head, including report §1.4's DR1 worked estimate reproduced exactly (1,239 / 1,717 / 4,494 kWh; 124 / 223 / 854 kgCO2e). Also covered: both bases, the split, NESO mocked, and the CLI.
  • Full PyAutoFit suite: 4,143 passed. Smoke test on the autofit workspace: 10 passed, 0 failed.
  • Independent review: FINDINGS, fixed in 8e7a1f5:
    • a null carbon-intensity basis no longer crashes;
    • a report with no finished energy no longer crashes;
    • running tasks are no longer counted as failed;
    • the --ci basis label is correct;
    • report with no source gives a usage error.
  • Witness W4: a DR1 estimate from the W2 retro digest, in Workspace/Science/scratch/hpc_campaign_p4_w4/ (not committed).
    • ≈3.5 MWh (range 1.7–6.0); ≈651 kgCO2e (range 221–1,119) on the regional basis.
    • 30% of the energy of finished work went on failed, timed-out or repeated runs.
    • That's about 2× the §1.4 forecast because of workload (22k vis_lp and 23k SED tasks against 5k each), not the model.

Refs #1746

🤖 Generated with Claude Code

Jammy2211 and others added 2 commits October 30, 2026 15:08
…report (hpc-campaign p4)

autofit.campaign.carbon: E = t x (n_c P_c u_c + n_m x 0.3725 + n_g P_g) x PUE,
C = E x CI, in four cases - low (low inputs, measured usage, peak memory),
central (usage basis), allocation (u = 1, requested memory) and high (high
inputs on the allocation basis); site constants from autonerves (tdp per
partition, gpu power, PUE, carbon_intensity bases with ci_basis central and the
spread of bases as bounds, ruling F6); no world-average default, a missing input
is reported and its figure left out; successful vs failed or repeated work
(earlier attempts charged from allocated CPU time); per stage, per completed
task, per object. forecast() for planned stages reproduces the report 1.4 worked
DR1 estimate exactly (1,239 / 1,717 / 4,494 kWh, 124 / 223 / 854 kgCO2e).
Optional, cached NESO period intensity and a 48 h --begin hint, network only on
request. autofit.campaign.report: report.md + report.json (compute, energy and
carbon with inputs and sources, failure census, stage table, results-index
counts, a paper paragraph that says estimate, gives the range and names the
basis). CLI: carbon, report.

Refs #1746

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A site whose ci_basis basis has no value (or an all-null carbon_intensity
  table) gave a KeyError / ValueError; it now gives energy only, with the
  reason in the note.
- Tasks pending, running or timeout_pending get their own 'in progress'
  bucket: excluded from the failed-or-repeated share (now of finished work
  only) and named in the paragraph as unfinished, never as wasted.
- A report with no finished energy (share None) no longer crashes.
- --ci given with a site drops the site's bases: the basis is 'given' and the
  paragraph names no bases the range no longer comes from.
- carbon / report with no source is a usage error, not a TypeError.

Refs #1746

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from feature/hpc-campaign-p3-plan-evidence to main October 30, 2026 15:32
@Jammy2211
Jammy2211 merged commit a7798cb into main Oct 30, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/hpc-campaign-p4-carbon-report branch October 30, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant