Skip to content

0.30.0

Latest

Choose a tag to compare

@github-actions github-actions released this 18 Nov 23:06
88358e8

Release notes for sbmlsim 0.30.0

sbmlsim

A scan spends its time integrating instead of copying. The values of a point were copied four times on their way from the solution of the integrator into the result a caller reads, which a wide output grid made the larger half of a run: the scan of 1000 points of 401 output times of the HCTZ model in the engine core took 0.619 s, of which the integration was 0.143, and at that width the engine core was no faster than roadrunner (0.619 against 0.615, a ratio of 0.99). It now copies once, and the points of a wide chunk are written on threads, which takes that scan to 0.247 s and the share of the integration from 23 % to 58 %. The engine core, which simulates in the calling process and so paid the copy in the open, gains the most, and roadrunner gains on its serial runs. A fit on the engine core evaluates a whole jacobian as one batch of the engine, 2.1 to 3.4 times the loop over its vectors, and sbmlsim-core 0.11.0 brings algebraic rules and the delay csymbol to the engine core, which no longer refuses either.

Performance

  • One batch of the engine is one jacobian of a fit (#568). A fit on the engine core evaluates the whole jacobian of a step, or the whole population of a generation, as one batch of the engine instead of one point per worker process, so the simulations of every vector of the batch fan out over the threads of the engine at once (executor_core.execute_many in chunks of CORE_MAX_CHUNK, dispatched by engines.execute_plans, OptimizationProblem.evaluate_residuals_many/evaluate_cost_many, which simulate a batch per model before any vector is evaluated, and FitPool.threads, which gives such a fit one worker on the cores of the fit). The other engines simulate one plan per call, so a batch is the loop over its plans for them and a caller gets the same results from every engine. On the PK fit of the HCTZ example with 20 threads, one jacobian takes 4.5 ms instead of 9.5 for 4 vectors, 6.6 instead of 22.7 for 11 and 12.9 instead of 44.3 for 21. The engine holds no state between two requests and every thread simulates on an instance of its own, so such a fit takes the path of the serial fit bitwise, which tests/fit/test_jacobian.py runs end to end; a worker which dies takes its batch with it, whose vectors are then evaluated one per task, so a vector which kills a worker fails alone as it does with the other engines.
  • A scan assembles its result with one copy instead of four (#560). A point used to be copied out of the solution of the integrator, into the chunk, out of the chunk and into the cube of the run; the chunk is now packed in the layout of the cube (column, point, row) and a run in the calling process hands a chunk the slice of the cube its points belong to, which the chunk writes into directly (_Assembly.destination, offered only where that slice is a view and not a copy of its own). A chunk reports by its values whether it took the destination, so a chunk which packs no timecourses answers with an array of its own and the run marks nothing written that nothing wrote.
  • The points of a wide chunk are written on threads (#560). The remaining copy is bound by the memory of the machine, so the points of a chunk of at least PACK_THREAD_BYTES (16 MiB) are written with at most PACK_MAX_THREADS (6) of them, which is the knee of the measurement and not one thread per CPU: on a chunk of 250 points of 401 rows and 190 selections, the copy alone takes 18.4 ms with one thread, 12.8 with four, 10.9 with six and 11.1 with eight. A chunk writes with the calling thread below the threshold, in a worker of a pool, which has the cores of one worker while the other workers copy beside it, and with observables, whose points are interpolated one at a time as they are written and so are never held twice. Every thread writes points no other thread writes, so a result is the one of a write by the calling thread, bitwise.

Features

  • The engine core simulates a change whose value is a formula of the model (#551).
  • A fit definition names the engine its problems optimize on (#547). FitDefinition.engine reaches every problem it builds and the workers of a parallel fit, so a fit of a project is evaluated on the engine the project names.
  • The engine core holds the concentration of a pre-initialization across the initialization (#545), as every other executor does (PEtab v2), so nothing of it is refused any more.

Dependencies

  • sbmlsim-core 0.11.0, through 0.10.0, whose engine simulates a model with algebraic rules with SUNDIALS IDA and a model with delays with an integrator of its own for them, so the engine core refuses neither any more: its semantic suite goes from 1,581 of 1,789 cases to 1,701 with 0.10.0 and to 1,754 with 0.11.0, and the 35 which are left need fast reactions. 0.11.0 also carries the simulate_plans of its bindings, which the batched jacobian above runs on, and a preconditioned GMRES which is opt-in, so the automatic choice of a linear solver is still KLU. A fast reaction, a required package, a cycle of assignment rules and a draw of a distribution of distrib are what the compiler refuses now, and the docstrings of model_core.py and engine.py and the section Engines of docs/simulation.md name those instead of an algebraic rule or a delay.
  • pkpdutils 1.7.0 and sbmlode 0.3.2, the latest releases of both, and the floors of sbmlutils and pymetadata raised to the 0.17.2 and 0.8.3 the lock already carried. The floor of pkpdutils is 1.7.0 for a reason of correctness and not of currency: from 1.6.1 on it brings a pkpdutils-core whose macOS wheel links no mimalloc (0.5.1 then, 0.6.0 under 1.7.0, both checked wheel by wheel). Two extension modules which each statically link mimalloc claim the same two slots of the pthread TLS block on macOS, by compiled-in number, so each reads the heap of a thread the other left there and frees blocks through a page map which never saw their arena. An install which pairs sbmlsim-core with a pkpdutils-core older than 0.5.1 therefore corrupts its heap on macOS, in whichever of the two the next allocation happens to land, and reports it as values no correct code can produce (#565, pkpdutils-core#11). No result of sbmlsim moves with the two bumps: the suite passes on kernel 0.6.0 as it did on 0.5.1 and on 0.4.1, and what 1.7.0 changes on purpose, the draws of the bootstrap of a group curve, is a part of pkpdutils which sbmlsim does not use - it reads the non-compartmental analysis of a PK observable and its point estimates only.
  • libroadrunner 2.12.0.dev683 with the sparse linear solver KLU (#553), the settings linear_solver (klu by default) and jacobian (sparse_difference_quotient by default) of CVODE, which ROADRUNNER_ONLY_SETTINGS has COPASI and AMICI ignore.

Documentation

  • The page Benchmarks, measured again on the final code (#546, #552, #557, #559, #560): the load, the compilation, one simulation and a scan of 1000 points, serial and on 8 workers, of the five models in the four engines, with the agreement with roadrunner, and the scan over the width of the output grid, where the grid no longer eats the lead of the engine core: it was 1.68, 1.56, 1.23 and 0.99 over the four widths and is 1.68, 1.74, 1.65 and 2.33. Every model now has a figure of its own, drawn once per mode of the page, in the colours of the benchmark of sbmlsim-core, and the page shows them above its tables; --figure names their stem and --from-json draws them again from a stored measurement. The run it records is the one on sbmlsim-core 0.10.0, which the page names with its other versions: the release locks 0.11.0, whose delays keep a history of size zero for a model which has none (ten of 48 ordinary workloads of its own measurement were slower, the largest by 3.90 %) and whose GMRES is opt-in, so nothing this page measures was measured on another engine than the one it reports.

Fixed

  • A chunk whose points all failed writes the rows of the run and not none of them, which a destination of the cube would have refused with a shape it could not take.
  • test_the_cost_is_linear_in_the_number_of_events no longer compares the seconds of 200 events with the seconds of 100. The load of a parallel run stretches a wall clock by more than the margin it allowed, so it failed now and then on a busy machine while the integrations, which the test counts exactly and which are what "linear in the number of events" means, were right.
  • test_the_timings_of_an_experiment no longer asserts an upper bound on the other of an experiment which does nothing around its run. That phase is the seconds of a run which none of its phases measured, so it holds whatever the machine did outside them: the windows runner spent 1.26 s there while matplotlib built its font cache and failed a test whose claim, that the sleep of an overridden run is measured as other, held.