Repository navigation
smooth pulses: read a bump call's argument for a clock before inlining every rate law - #1444
Merged
Merged
Conversation
#1286) #1383's stop search inlined every rate law and parsed each that calls exp, cosh or tanh, on every run of any model that spells one. Most such calls are no bump of a clock: a Boltzmann factor, a rate of a voltage. MODEL1006230049 took 21 s a run for no stop, and MODEL1006230090 over 7 minutes, which timed the three large CellML models out of the nightly's path-agreement check. A bump's argument has the clock as its one symbol once the parameter values are put in. The texts now say first whether any call's argument reaches a clock (time() or a counter), through the functions and derived parameters it names, and reaches no other species or observable. Where none does, nothing is inlined or parsed. The four models are answered in under 20 ms.
…lliseconds a run
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.
#1383's search for smooth pulses in time (#1286) made bngsim slow on any model whose rate laws call
exp,coshortanh, on every run. Most such calls have nothing to do with time: a Boltzmann factor, a rate of a voltage. The search inlined every rate law and parsed each one that holds such a call, before asking whether any of them involves a clock.It found no pulse in any of them. On the nightly's runners that pushed MODEL1006230049, 053 and 077 out of their budget in the path-agreement check. #1401's run 41313484937 timed all three out in the
localecheck, whichmainbefore #1383 passed in 1,350–1,456 s. The slowdown never shipped: #1286's changelog fragment is still unreleased, so this adds none.The fix
A pulse's argument has the clock as its only symbol once the parameter values are put in. The search now reads the function texts first. For each call's argument, it follows the functions and derived parameters it names and asks two things: does the argument reach a clock (
time(), or a counter fed at a constant rate), and does it reach any other species or observable? Only an argument that reaches a clock and nothing else can be a pulse. If no argument passes, nothing is inlined or parsed. Otherwise the search runs exactly as before.Checks
Tests. Four new cases fail without the change: a Boltzmann factor, a pulse of the state, the clock reached only beside the state (as
pH_cydoes in MODEL1006230049), and_e^of no clock. Two more confirm that a pulse reached through another function is still found, intime()and in a counter. ode: stop on the centre of a smooth bump of the clock in a rate law (#1286) #1383's existing 30 tests pass unchanged.Every pulse ode: stop on the centre of a smooth bump of the clock in a rate law (#1286) #1383's tests find is still found. I ran those tests and
test_net_state_switch_stepping.pywith a guard that asserted the check never skips a search that finds a stop. 75 searches ran: all 44 that found a stop were kept, and the 27 skipped found none.Corpus sweep, all 1,319 BioModels SBML files. For every model the check skips, the old full search was run too.
exp/cosh/tanhcall at all (untouched)None skipped had a pulse. MODEL1006230090 has no clock at all: no function calls
time(), and no counter. The check costs at most 8 ms per model.