Update adapt cost microbenchmark for current APIs - #476
Open
ss2098 wants to merge 1 commit into
Open
Conversation
lmoresi
requested changes
Aug 2, 2026
lmoresi
left a comment
Member
There was a problem hiding this comment.
Adversarial review
The API modernizations are correct (we live-probed node_redistribution, metric_density_from_gradient(amp=, name=), Mesh.deform, .snes — all present), but two substitutions change what the benchmark measures:
- MAJOR — the upper boundary changed from penalty free-slip to no-slip (
add_essential_bc((0,0))). That silently changes the convection physics while the docstring still claims "same setup as the saturation runner", so the numbers are no longer comparable to the recorded baselines this script exists to track.add_natural_bcstill exists; the sanctioned modernization isadd_rotated_freeslip_bc(0, "Upper"). - MAJOR — the timed Stokes solves flipped
zero_init_guess=False → True: the benchmark now times cold-start solves, inflating t_step and deflating the adaptation/step cost ratio. - MINOR —
_deform_mesh → deform:deform()runsremesh_with_field_transferitself before the script overwrites T, so the remap timings now double-count transfer work.
Requested changes: restore free-slip via add_rotated_freeslip_bc(0, "Upper"), restore zero_init_guess=False in the timed loops (or explicitly re-baseline and relabel), and note the deform double-transfer in the timing comment. With those, this is mergeable — the rest of the update checked out clean.
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.
This PR updates scripts/adapt_cost_microbench.py so the microbenchmark runs with the current Underworld3 APIs.
Changes include:
This does not change solver internals.
Validation:
Example local output: