Skip to content

Optimizations for VRDirectCB #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
10 tasks
ChrisRackauckas opened this issue May 20, 2025 · 3 comments
Open
10 tasks

Optimizations for VRDirectCB #483

ChrisRackauckas opened this issue May 20, 2025 · 3 comments

Comments

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented May 20, 2025

VRDirectCB needs some code optimizations. Clear things to do:

  • Create a separate FunctionWrapper mode, i.e. VRDirectCBFW which wraps things in FunctionWrappers for cases with large numbers of jumps
  • Check https://github.com/SciML/JumpProcesses.jl/pull/477/files#diff-ef724e728ebe5838ea90cbda75a1e828afc91def61764cfec717b4ba24b7580bR174-R177 constant props
  • Create flamegraphs to showcase other potential performance bottlenecks
  • Setup a benchmark in SciMLBenchmarks (i.e. finish Benchmarking Variable Rate Aggregator SciMLBenchmarks.jl#1230)
  • Change VRDirectCB to the default when demonstrated as more efficient.
  • Make sure everything is type stable with regards to the VRJs and rate/affect evaluation in the no FunctionWrapper case.
  • Reuse last cur_rates evaluation from the condition in the affect if it is at the correct time (i.e. if the quadrature uses the endpoints).
  • See if additional @inbounds decorators improves performance
  • use preallocated u_tau instead of out-of-place evaluation.
  • Think about what order / type of quad rule to use. Why are we using the 4-point Gauss-Legendre quadrature currently? (For example, we could use a rule that includes endpoints to avoid recalculating the cumulative rate sum at the final point.)
@ChrisRackauckas
Copy link
Member Author

@sivasathyaseeelan

@isaacsas
Copy link
Member

A secondary optimization that may be important to actually get better performance than the old approach we used is to play with the quadrature order. The higher it is the more times we need to evaluate all the rates each call to the condition vs. the less accurate the integral evaluation is for lower orders, so there may be a sweet spot that optimizes performance.

@ChrisRackauckas
Copy link
Member Author

We will get a Gauss-Kronrod version rather soon, and that would be a nice error controlled way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants