Repository navigation
Compare sensitivity timings only with timings of the same quantity (#61) - #68
Merged
Merged
Conversation
Merged
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.
Fixes #61.
What
The sens-sbml and sens-net timing summaries now compare BNGsim's sensitivity solve only with engines that computed the same derivatives. Plain solves and log-likelihood gradients each get a table of their own, and every
timing.csvrow says what it computed.Why
Each sensitivity timing also times what is not a sensitivity solve: a plain solve (
bngsim_ode,roadrunner,run_network), the unit of a finite-difference gradient, and a log-likelihood gradient (amici_adjoint,bngsim_gradient). All of them sat in one table, and the derived speedups divided one by the other:roadrunner0.0031: BNGsim "328x slower", against a plain solveroadrunner_central_fd0.26: 3.8x slower, against RoadRunner's central-difference gradientrun_network0.68: BNGsim slowerrun_network_central_fd29: BNGsim 29x fasteramici_adjointbngsim_gradient, BNGsim's gradient of the same log-likelihoodfd_baselines, the like-for-like number, was in every job record, butbench publishnever used it.Changes
timing.csvhas three new columns (docs/published_format.md):quantity: what the engine computed. In a sens suite it issensitivities,llh_gradientorplain_solve. Every other suite's engines compute the suite's own output, named by its capability (ode,steady_state,psa,ssa,nf). A pivot onengineandquantitycannot mix them.derived_from,parameters: set on a new row per plain solve, the central finite-difference gradient it gives. That row's time is 2N times the plain solve's, its interval is the plain solve's scaled by 2N, and its pre-sim is the plain solve's. The rows are namedroadrunner_central_fd,run_network_central_fdandbngsim_ode_central_fd. They are computed, not measured, and the role says so.Note
The issue suggests the names
fd_roadrunnerandrun_network_fd. Those are the correctness references, and they do more work: steps h and h/2 (4N solves) at the tighterfd_rtol/fd_atol. A timing row under the same name would read as their cost, understated at least twofold. So the rows are named apart, and the README anddocs/published_format.mdsay which is which.The table of what each engine computes is
bench.gather.SENS_QUANTITIES.bench publishrefuses a sens engine it does not list, so a new engine has to say what it computes before it is published beside the others.The snapshot README has one timing table per quantity where a suite timed more than one, BNGsim's own first: forward sensitivities, then the log-likelihood gradient, then one plain solve. Each table's speedups divide by BNGsim's engine of that quantity (
bngsim,bngsim_gradient,bngsim_ode). A finite-difference row readsroadrunner_central_fd (2 × 43 roadrunner solves). A member with no gradient timed is absent from the gradient table, which says so; its reason, if any, is in the first table. The READMEs of the suites that time one quantity are byte for byte unchanged.The roles and pre-sim costs of sens rows.
timing.csvread these through the general_presim, which knows onlybngsimand the references. Sobngsim_simultaneous,bngsim_odeandbngsim_gradienthad no role and no pre-sim cost, and the role was the one thing that told a plain solve apart. They are now read through_sens_presim, asbench gatheralready did. As in gather,amici_adjointandbngsim_gradientshow the pre-sim of the build they run on (AMICI's, BNGsim's).Committed snapshots are rebuilt, not rerun.
publish.snapshot_tablesrebuilds a snapshot'scorrectness.csvandtiming.csvfrom its ownmanifest.jsonand job records.bench publish --indexnow writes them, as it writes the READMEs, and the existing guard (test_every_committed_summary_is_what_the_committed_data_generates) checks them. Before any change, it reproduced all 16 committed CSVs byte for byte. Every number here comes from the job records already committed; no suite was rerun. The publisher is not part of a job's definition, so no snapshot becomes out of date because of this.bench gather's local report had the same mix: its sensx amicicolumn divided AMICI's sensitivities by every engine's time. It now divides by sensitivities only, and says so under the table.Audit of the other suites
Each times one quantity. ode-net, ode-sbml and ode-antimony time trajectories; ss-sbml and ss-net, steady states (
bngsim_integrationandrun_networkreach the same steady state another way); psa-net, the same PSA at each@nc=N, divided bybngsim@nc=N; ssa-, ensembles; nf-xml-, network-free runs. Their CSVs gain only the three columns (quantityfilled, the other two empty), and their READMEs do not change.Not doing
fd_baselines. The published row is central differences, the method the correctness check uses.fd_baselinesis computed (2N × the plain-solve median), not timed end to end. The row says so; timing a whole FD gradient would be a harness change.Review
One round of an independent whole-branch review using Fable (high effort). It reran the arithmetic against every committed record: each
fd_baselines.central_secondsis 2N times the plain-solve median. Measured rows are unchanged apart from the filled roles and pre-sim costs. Non-sens READMEs are byte-identical.snapshot_tablesreproduces whatpublish()writes, withheld timings included. It found four issues, each fixed with a test:bngsimrow rendered an empty section and took a derived row as BNGsim's base;@nc=Nplain solve's FD row would have landed in the plain-solve table;bngsim_gradientthat sens-sbml does not time.Testing
tests/test_summary.py, 11 new tests:quantity, as first published, both sens READMEs put all three quantities in one table, and the guard says so;roadrunner_central_fd, never byroadrunneror the correctness reference's name;@nc=Nplain solve's FD row keeping its suffix and quantity;bngsimrow getting no empty section, and no derived row as BNGsim's base.tests/test_gather.py:x amiciis blank for a plain solve.mutate.pyfrom bngsim-preflights): 20 killed. A first run's one survivor was an equivalent mutant: it removed a role lookup that_sens_presimalready does, so the lookup was removed.-m 'not integration and not network') in a uv environment without pixi: 1330 passed. It has the same 18 failures and 5 errors asmainin that environment, all needing AMICI or BioNetGen. CI is the first full run.ruff checkon the changed files: no new findings.