feat: record per-structure peak device memory#134
Draft
lwalew wants to merge 4 commits into
Draft
Conversation
3acf901 to
d5d84d4
Compare
d5d84d4 to
66b89b6
Compare
Add a peak_memory_bytes field to ScalingStructureResult populated from jax.devices()[0].memory_stats()["peak_bytes_in_use"], captured after each structure's simulation (including the failure path). Surfaced in the UI as a "Peak device memory vs system size" chart alongside the existing step-time chart, with a fallback message when the active JAX backend does not expose memory stats. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The UI surface for the new peak_memory_bytes field can be added later (or in a separate PR) once we have a better sense of what we want to plot. The data field on ScalingStructureResult is the only piece that needs to land first. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This reverts commit 53b6791.
66b89b6 to
13cc84e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
peak_bytes_in_usefromjax.devices()[0].memory_stats()after each structure's simulation in the scaling benchmark.ScalingStructureResult.peak_memory_bytes(NonNegativeInt | None) — backward-compatible with existing stored results (defaults toNonewhen the field is absent in older JSON rows).memory_stats()(CPU runs).Why
ScalingBenchmarkcurrently records timing only. For models that OOM on the larger systems in the dataset (e.g.1vsq,1a7m,1ab7at ~6700 / 2800 / 1400 atoms), we have no recorded signal of where on the size axis the GPU pressure starts climbing — only that the simulation failed. Addingpeak_memory_bytesgives us a "high-water mark vsnum_atoms" curve per model, which is the natural complement to the existing "step time vsnum_atoms" plot.Semantics of the value
peak_bytes_in_useis monotonic-since-process-start. The reading is captured in afinally:block so it lands on both the success path and the failure path. For the size-sorted structure list, the value plotted againstnum_atomstraces the cumulative high-water mark — i.e. the value at structureTest plan
pytest tests/scaling/— both existing tests updated + passing.pre-commit run --files …— ruff / ruff-format / mypy / conventional-commit all green.None/numeric data when one model was run on CPU and another on GPU.Notes
develop; the in-flightfeat/pass-charges-to-modelswork touches the samerun_modelloop but on different lines — should rebase cleanly when that lands.experiment.resultis stored as JSON, and Pydantic validates older rows with the new optional field defaulting toNone. No migration needed.🤖 Generated with Claude Code