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 1a80f69... master / 1a80f69...
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK2() 0.289 ± 0.018 s 0.29 ± 0.018 s 0.993 ± 0.086
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK3() 10.3 ± 0.96 ms 10.3 ± 1.5 ms 0.997 ± 0.17
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK4() 2.62 ± 0.082 ms 2.59 ± 0.081 ms 1.01 ± 0.045
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK5() 7.42 ± 1.3 ms 7.39 ± 1.3 ms 1 ± 0.26
Simple Pendulum/IIP/BoundaryValueDiffEqMIRK.MIRK6() 1.34 ± 0.13 ms 1.35 ± 0.21 ms 0.986 ± 0.18
Simple Pendulum/IIP/MultipleShooting(10, Tsit5; grid_coarsening = false) 1.73 ± 0.71 ms 1.73 ± 0.71 ms 1 ± 0.58
Simple Pendulum/IIP/MultipleShooting(10, Tsit5; grid_coarsening = true) 2.93 ± 0.67 ms 2.9 ± 0.67 ms 1.01 ± 0.33
Simple Pendulum/IIP/MultipleShooting(100, Tsit5; grid_coarsening = false) 0.0674 ± 0.0083 s 0.0682 ± 0.01 s 0.988 ± 0.19
Simple Pendulum/IIP/MultipleShooting(100, Tsit5; grid_coarsening = true) 0.0833 ± 0.014 s 0.0834 ± 0.022 s 0.999 ± 0.31
Simple Pendulum/IIP/Shooting(Tsit5()) 0.205 ± 0.04 ms 0.204 ± 0.039 ms 1 ± 0.28
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK2() 0.482 ± 0.02 s 0.488 ± 0.016 s 0.988 ± 0.053
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK3() 13.9 ± 8.6 ms 13.5 ± 8.4 ms 1.03 ± 0.9
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK4() 3.15 ± 0.26 ms 3.11 ± 0.25 ms 1.01 ± 0.12
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK5() 8.9 ± 0.74 ms 8.94 ± 0.73 ms 0.996 ± 0.12
Simple Pendulum/OOP/BoundaryValueDiffEqMIRK.MIRK6() 1.62 ± 0.15 ms 1.61 ± 0.15 ms 1.01 ± 0.13
Simple Pendulum/OOP/MultipleShooting(10, Tsit5; grid_coarsening = false) 3.52 ± 2.2 ms 3.53 ± 2.2 ms 0.997 ± 0.89
Simple Pendulum/OOP/MultipleShooting(10, Tsit5; grid_coarsening = true) 6.09 ± 4.3 ms 6.1 ± 4.3 ms 0.999 ± 0.99
Simple Pendulum/OOP/MultipleShooting(100, Tsit5; grid_coarsening = false) 0.128 ± 0.01 s 0.126 ± 0.0092 s 1.01 ± 0.11
Simple Pendulum/OOP/MultipleShooting(100, Tsit5; grid_coarsening = true) 0.158 ± 0.025 s 0.157 ± 0.036 s 1.01 ± 0.28
Simple Pendulum/OOP/Shooting(Tsit5()) 0.56 ± 0.22 ms 0.559 ± 0.22 ms 1 ± 0.56
time_to_load 4.7 ± 0.021 s 4.69 ± 0.013 s 1 ± 0.0052
### 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).

@ErikQQY
Copy link
Member Author

ErikQQY commented Nov 3, 2025

CI failing seems unrelated

@ErikQQY ErikQQY merged commit 78cceb2 into master Nov 3, 2025
22 of 31 checks passed
@ErikQQY ErikQQY deleted the qqy/sparse_optimization branch November 3, 2025 18:54
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