Repository navigation
steady_state: ask a waiting "residual" march's inputs where it stalls (#2074) - #2149
Merged
Merged
Conversation
…#2074) A march under criterion="residual" that waits for masked inputs asks them by a Newton step only at doubling counts of the steps the kept species pass. One ended as stalled, by an integrator failure, or out of steps between two asks was not asked where it stopped, unlike the default criterion's march (#1001). It is now. The ask schedule is unchanged: asking at every step costs one dense factorization a step (260 s for 0.73 s at 500 unknowns) and converges the issue's ring-down only at the one step of 8,762 that passes. Refs #2074
Wording of the stall-ask comment, the changelog and the new test's comment (the steps counted are those at which the kept species pass and the inputs do not; the offsets are relative). The march's end ask cannot fire on a run that is taken on, which marches with tol = 0, so "out of steps" in the previous commit's message describes nothing reachable. test_a_sharded_compile_leaves_no_compiler_and_no_debris[unsupervised] failed in a loaded pre-push run: writing the 6,000 species' code took the whole 6 s deadline, so no compiler had started and cc.pids did not exist. 15 s still stops it mid-compile (the stand-in compiler sleeps 120 s). Refs #2074
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.
Part of #2074: the second gap (the ask at a stall). The ask schedule is deliberately unchanged, and the issue's ring-down at damping 0.02 stays unconverged. The reasons are below, so this does not close the issue.
Change
SteadyStateMarcher::march(src/steady_state.cpp). A"residual"march that waits for masked inputs asks them by a Newton step only at the 1st, 2nd, 4th, ... step at which the kept species pass and the inputs do not, and at the stop time. A march called stalled, or ended by an integrator failure, between two such asks came back unconverged wherever it stopped. The march now records whether the inputs were asked at its last step (inputs_asked, reset where the roots-dropped branch moves the state). When it ends unconverged and unasked with the kept species undertol, it is asked there byss_inputs_let_a_stop, the same test the loop makes. This mirrors the default criterion'sif (by_distance_ && !asked)(#1001). The two never both apply:waits_for_inputs_is for criteria other than"scaled", andby_distance_only for"scaled". A run that is taken on marches withtol = 0, so the new ask never fires there. The first commit's message says "or out of steps"; that case cannot happen.Test:
test_a_march_that_waits_for_inputs_is_asked_where_it_stallsuses a model built to hit this case. Masked I sits 1e-10 (relative) off rest, with its rate (1e-8) overtoland not falling. Kept X reads I and creeps to X* from 1e-6 (relative) away. A masked ring that nothing reads sets the step size. The Newton step passes from the 1,385th kept-pass step, and the march stalls at the 2,005th, between the asks at 1,024 and 2,048. On main it is unconverged with X 2e-9 (relative) from X*; here it is converged. The assertion1_024 < n_steps < 2_048rules out a pass by an ask inside the loop.Why the schedule is not changed
I measured the issue's three options on its reproduction and on the realistic models from #2040's Cost section.
Asking at every step converges the ring-down only by luck. I asked at every step of the a=0.02 march without stopping on a pass. Exactly 1 of the 8,762 steps at which the kept species pass passes: step 5,714. The march's accuracy floor (U, V about 4e-7 from rest) is above what the Newton test asks (about 1e-8). Units are not the cause: in units of 1, 1e6, 1e9 and 1e14 the march is unconverged at the same step count, as is
"residual"with no mask. Beside 100, 250 or 500 species at rest that nothing reads, asking at every step does not converge either.Cost of asking at every step. One ask (dense Jacobian plus LU) on the ring-down beside N species at rest:
At a=0.001 with 250 species: 1.05 s against 145 s.
Asking at every step once the inputs' residual stops falling asks 2,426 times on the reproduction and is still unconverged. The one passing step is a new least of the inputs' residual, so this option never asks there.
Realistic models. BIOMD0000000685 (keeping A_star, and keeping A at
max_time1e5), BIOMD0000000407 (first species left out), ige_receptor_cycle (Lyn left out,max_time3e3, 1e4 and the default), BIOMD0000000252 (keeping mm, 1e5) and hawse_reduced_boolean (keeping the 16th species, and leaving out the first): the same verdicts and step counts under all three schedules.Getting the ring-down to converge under
"residual"would take something other than the schedule, such as a Newton polish at the stall. It fails the same way with no mask.Also in this PR
test_cli_deadline.py::test_a_sharded_compile_leaves_no_compiler_and_no_debris[unsupervised]failed once in the local pre-push run. Under load, writing the 6,000-species model's code used up the whole 6 s deadline before any compiler started, socc.pidsdid not exist. It passed 3 of 3 runs on its own. The deadline is now 15 s; the stand-in compiler sleeps 120 s, so the stop still lands mid-compile.Checked
--no-verifyafter running alltest_steady_state*.pyfiles andtest_cli_deadline.pyagainst a rebuilt core: 1,247 passed, 10 skipped.Reviews
/code-review(high): nothing blocking. Fixed: the sibling deadline test,test_a_slow_compile_is_stopped_and_the_next_command_compiles, which readscc.pidsafter a 6 s deadline in the same way, now gets 15 s as well (test_cli_deadline.py: 155 passed). Left alone: