stan-dev / stan-dev/math

BDF ODE integrator slow

Open
#2,224 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description

With the switch to the new variadic ODE interface we also changed how error tolerances are being checked during the Newton iterations. Essentially the error tolerances are now also being checked for the sensitivities as the same time as for the ODE states. This lead to a significant slow-down of the BDF integrator ranging from 10-30% as reported on discourse. The reason for the change were

  1. with this scheme the Adams-Moulton integrator became actually stable as this one was unstable before
  2. this aligned the CVODES integrators with the RK45 scheme of handling things

Example

https://discourse.mc-stan.org/t/ode-solver-behavior-change-from-math-v3-2-0-to-v3-3-0/18699/10?u=wds15

Expected Output

Same output is expected, but faster.

Current Version:

v3.3.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the BDF ODE integrator's Newton-iteration error-tolerance checks, then compare its handling of ODE states and sensitivities with the Adams-Moulton and RK45 integrators. Profile the reported slowdown while confirming that solver output remains unchanged; done means the BDF integrator preserves output and improves the 10–30% regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.