Skip to content

Conversation

@ErikQQY
Copy link
Member

@ErikQQY ErikQQY commented Oct 22, 2025

Fix #379

The previous implementation can't exploit the sparsity pattern of the loss function due to the value updates in loss function, this PR allows sparse AD in optimmization based internal solvers.

Before this PR:

image

With this PR:

image

@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

Benchmark Results

Click to check benchmark results
master d8aeb29... master / d8aeb29...
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK2() 0.308 ± 0.02 s 0.32 ± 0.02 s 0.963 ± 0.086
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK3() 9.85 ± 0.33 ms 9.88 ± 0.5 ms 0.997 ± 0.06
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK4() 2.48 ± 0.095 ms 2.49 ± 0.07 ms 0.997 ± 0.047
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK5() 7.3 ± 1.8 ms 7.34 ± 1.8 ms 0.995 ± 0.35
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK6() 1.34 ± 0.34 ms 1.34 ± 0.097 ms 1 ± 0.27
Simple Pendulum/IIP/MultipleShooting(10, Tsit5; grid_coarsening = false) 1.76 ± 0.99 ms 1.74 ± 0.98 ms 1.01 ± 0.8
Simple Pendulum/IIP/MultipleShooting(10, Tsit5; grid_coarsening = true) 2.93 ± 0.94 ms 2.94 ± 0.92 ms 0.998 ± 0.45
Simple Pendulum/IIP/MultipleShooting(100, Tsit5; grid_coarsening = false) 0.0705 ± 0.016 s 0.0706 ± 0.016 s 0.998 ± 0.32
Simple Pendulum/IIP/MultipleShooting(100, Tsit5; grid_coarsening = true) 0.0879 ± 0.028 s 0.0916 ± 0.029 s 0.959 ± 0.43
Simple Pendulum/IIP/Shooting(Tsit5()) 0.237 ± 0.067 ms 0.237 ± 0.076 ms 0.999 ± 0.43
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK2() 0.462 ± 0.014 s 0.458 ± 0.0048 s 1.01 ± 0.031
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK3() 12.3 ± 6.2 ms 12.3 ± 5.7 ms 0.999 ± 0.68
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK4() 2.84 ± 0.2 ms 2.86 ± 0.15 ms 0.992 ± 0.087
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK5() 8.33 ± 1.2 ms 8.44 ± 1.2 ms 0.987 ± 0.2
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK6() 1.5 ± 0.24 ms 1.53 ± 0.23 ms 0.981 ± 0.21
Simple Pendulum/OOP/MultipleShooting(10, Tsit5; grid_coarsening = false) 3.01 ± 3.2 ms 2.99 ± 3.2 ms 1.01 ± 1.5
Simple Pendulum/OOP/MultipleShooting(10, Tsit5; grid_coarsening = true) 5.18 ± 5.9 ms 5.15 ± 5.4 ms 1.01 ± 1.6
Simple Pendulum/OOP/MultipleShooting(100, Tsit5; grid_coarsening = false) 0.114 ± 0.0059 s 0.111 ± 0.0068 s 1.03 ± 0.083
Simple Pendulum/OOP/MultipleShooting(100, Tsit5; grid_coarsening = true) 0.142 ± 0.061 s 0.148 ± 0.048 s 0.965 ± 0.52
Simple Pendulum/OOP/Shooting(Tsit5()) 0.521 ± 0.31 ms 0.521 ± 0.28 ms 0.998 ± 0.8
time_to_load 4.31 ± 0.018 s 4.32 ± 0.012 s 0.997 ± 0.0049
### Benchmark Plots A plot of the benchmark results has been uploaded as an artifact to the workflow run for this PR. Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

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

Successfully merging this pull request may close these issues.

Allow more autodiff backends when using internal optimization solvers

2 participants