Skip to content

bench: Ipopt + MadNLP allocation profile script#71

Open
jack-champagne wants to merge 3 commits intofeat/madnlp-integrationfrom
bench/ipopt-madnlp-alloc-profile
Open

bench: Ipopt + MadNLP allocation profile script#71
jack-champagne wants to merge 3 commits intofeat/madnlp-integrationfrom
bench/ipopt-madnlp-alloc-profile

Conversation

@jack-champagne
Copy link
Copy Markdown
Member

Summary

  • Adds benchmark/alloc_profile.jl — standalone Julia script that runs DirectTrajOpt.solve! under Profile.Allocs for both Ipopt and MadNLP on the shared bilinear toy problem, saving one AllocProfileResult JLD2 per solver via HarmoniqsBenchmarks.benchmark_memory! / save_alloc_profile.
  • Adds benchmark/Project.toml with DTO + the two NLP backends + HarmoniqsBenchmarks (pinned to feat/alloc-profile until HarmoniqsBenchmarks.jl#1 merges).
  • Gitignores /benchmark/results/ so local profile output stays out of history.

The sibling Piccolissimo.jl PR covers the Altissimo+MadNLP+Ipopt three-way on an X-gate; this PR is the DTO-only lane that tracks Ipopt/MadNLP performance over time on DTO's own test fixture.

Rationale

sample_rate defaults to 0.01 in main() — Ipopt/MadNLP generate orders of magnitude more fine-grained allocations than a sample_rate=1.0 trace can complete in reasonable wall time (an N=10 bilinear toy hangs 15+ minutes at 1.0). 0.01 still gives statistically useful traces for hot-path triage.

JIT warmup runs on a throwaway deepcopy of the problem before the profiled pass so compile-time allocations stay out of the recorded trace.

Dependencies

Blocked on HarmoniqsBenchmarks.jl#1 merging — once it does, drop the rev = pin from benchmark/Project.toml.

Test plan

  • julia --project=benchmark benchmark/alloc_profile.jl produces two *_allocs.jld2 under benchmark/results/allocs/
  • AllocProfileResult.total_count > 0 and total_bytes > 0 for both solvers
  • Loading back via load_alloc_profile roundtrips correctly

Adds benchmark/alloc_profile.jl which runs Profile.Allocs-traced
solves on the shared bilinear toy problem for both in-tree NLP
backends, saving AllocProfileResult JLD2s via HarmoniqsBenchmarks'
benchmark_memory! / save_alloc_profile API.

benchmark/Project.toml pins HarmoniqsBenchmarks to the
feat/alloc-profile branch until that PR merges.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

analyze_allocs.jl ranks alloc hotspots by scaled bytes across all
profile JLD2s in benchmark/results/allocs/ with noise-frame filtering.
Companion to the existing alloc_profile.jl driver.

alloc_profile.jl: coerce MadNLP.ERROR to Int for MadNLPOptions —
symmetric to Piccolissimo commit 472fe4d.
Identified by Gennadi. abs2(tr(U_goal'·U))/n² is phase-insensitive,
so +im·U_goal and -im·U_goal are equally valid optima. With free
Δt, solvers fall into different basins depending on init + step
sequence; with fixed Δt, both consistently land in the same basin.
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