Expand description
Diagnostic-dump infrastructure shared by the solver and the CLI.
§Why this exists
Debugging a stalled solve or a perf regression usually means
capturing the inner state of the IPM at specific iterations:
the augmented-system KKT matrix, the iterate, the search step,
the line-search trace. Historically this lived as a scatter of
POUNCE_DBG_* env-vars across the codebase, each with bespoke
semantics. This module centralizes the surface so the CLI
(--dump kkt:5-10) and the dump sites (deep in the linear
solver) speak the same vocabulary.
§Lifecycle
- The CLI parses
--dump <cat>[:<spec>]flags into aDiagnosticsConfigand constructs aDiagnosticsState. - The application installs the state via
IpoptApplication::set_diagnostics, then propagates anRc<DiagnosticsState>through the solve in the same waycrate::timing::TimingStatisticsis propagated. - At the top of each outer iteration, the IPM calls
DiagnosticsState::bump_iterto advance the current-iter counter and reset the per-iter solve index. - Every dump site (KKT solver, line search, μ oracle, …) calls
DiagnosticsState::wantto gate the dump, thenDiagnosticsState::open_writerto obtain a file handle in the rightiter_NNN/sub-directory.
§File layout
<dump_dir>/
manifest.json
iter_005/
kkt_solve_001.jsonl
iterate.json
iter_006/...
resto/
parent_iter_007/
iter_000/kkt_solve_001.jsonl
timing.jsonThe solve_NNN suffix disambiguates the multi-solve-per-iter case
(second-order corrections and perturbation re-solves issue extra
factorizations inside one outer iteration). The
resto/parent_iter_NNN/ hierarchy keeps the restoration sub-IPM
trace separate from the main solve trace.
Structs§
- Diagnostics
Config - Static configuration: where to dump, in what format, with what per-category iter filters. Constructed by the CLI, held by the application, frozen for the duration of a solve.
- Diagnostics
State - Live state threaded through the solve via
Rc. The IPM mutatescurrent_iterandsolves_this_iter; the dump sites read them. All fields use atomics so the type isSend + Synceven though the solver itself is single-threaded — keeps the door open for future parallel inner solvers without an ABI rewrite.
Enums§
- Diag
Category - Single diagnostic category the user can request.
- Dump
Format - Iter
Spec - Iteration filter attached to a category.
Noneendpoints denote open-ended ranges (N-isRange(Some(N), None)). - Iterate
Variant - Payload-detail variant for the
iteratedump category. - KktVariant
- Payload-detail variant for the
kktdump category.
Functions§
- parse_
iterate_ spec - Parse the
iterate:spec grammar —[<iter-filter>[:<variant>]]. - parse_
kkt_ spec - Parse the
kkt:spec grammar —[<iter-filter>][+L][+Lvals].