Skip to content
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

Allow linsolve to be \ #358

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Allow linsolve to be \ #358

merged 1 commit into from
Jan 30, 2024

Conversation

avik-pal
Copy link
Member

For very simple problems with a diagonal Jacobian this is much faster.

Testing on the quadratic problem

julia> @benchmark solve(prob, NLsolveJL())
BenchmarkTools.Trial: 10000 samples with 5 evaluations.
 Range (min  max):  6.047 μs   2.675 ms  ┊ GC (min  max):  0.00%  98.90%
 Time  (median):     7.052 μs              ┊ GC (median):     0.00%
 Time  (mean ± σ):   9.251 μs ± 50.774 μs  ┊ GC (mean ± σ):  10.88% ±  1.98%

    ▁█▂                                                       
  ▁▂███▆▃▂▂▂▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▂▂▃▃▃▄▄▄▃▄▃▃▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁ ▂
  6.05 μs        Histogram: frequency by time        12.6 μs <

 Memory estimate: 8.20 KiB, allocs estimate: 107.

julia> @benchmark solve(prob, NewtonRaphson(; linsolve = \, autodiff = AutoForwardDiff(; chunksize = 2)))
BenchmarkTools.Trial: 10000 samples with 9 evaluations.
 Range (min  max):  2.446 μs   1.465 ms  ┊ GC (min  max):  0.00%  98.65%
 Time  (median):     2.976 μs              ┊ GC (median):     0.00%
 Time  (mean ± σ):   4.062 μs ± 27.179 μs  ┊ GC (mean ± σ):  13.24% ±  1.98%

     ▄█▇▅▁                                                    
  ▁▂▅██████▆▃▃▃▂▂▂▂▃▂▃▃▃▃▂▂▂▂▂▁▂▂▂▂▃▃▃▃▃▃▃▄▄▃▃▂▂▂▂▂▂▂▂▂▁▁▁▁▁ ▂
  2.45 μs        Histogram: frequency by time        5.89 μs <

 Memory estimate: 5.09 KiB, allocs estimate: 54.

julia> @benchmark solve(prob, NewtonRaphson(; linsolve = LUFactorization(), autodiff = AutoForwardDiff(; chunksize = 2)))
BenchmarkTools.Trial: 10000 samples with 8 evaluations.
 Range (min  max):  3.409 μs   1.503 ms  ┊ GC (min  max): 0.00%  98.89%
 Time  (median):     3.759 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   4.631 μs ± 25.575 μs  ┊ GC (mean ± σ):  9.47% ±  1.71%

   ▄▆██▇▇▇▆▅▄▃▃▂▁ ▁             ▁▁▁▁▂▁▂▂▂▂▃▂▃▃▂▃▂▁▂▁▁▁       ▂
  █████████████████▇▅▆▆▆▅▆▆▇▇▇███████████████████████████▇▇▇ █
  3.41 μs      Histogram: log(frequency) by time     6.77 μs <

 Memory estimate: 5.22 KiB, allocs estimate: 55.

julia> @benchmark solve(prob, NewtonRaphson(; autodiff = AutoForwardDiff(; chunksize = 2)))
BenchmarkTools.Trial: 10000 samples with 7 evaluations.
 Range (min  max):  4.846 μs   1.846 ms  ┊ GC (min  max):  0.00%  98.97%
 Time  (median):     5.304 μs              ┊ GC (median):     0.00%
 Time  (mean ± σ):   6.414 μs ± 40.806 μs  ┊ GC (mean ± σ):  14.11% ±  2.21%

   ▃▅▇███▇▆▅▄▃▂▂▂                                            ▂
  █████████████████▇▆▇▇▆▆▆▇▆▇▆▅▆▄▅▆▅▄▄▅▅▄▆▅▇▆▆▇▇▇▆███▇█▇▇▇▇▇ █
  4.85 μs      Histogram: log(frequency) by time     9.25 μs <

 Memory estimate: 8.25 KiB, allocs estimate: 100.

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (e989b72) 86.23% compared to head (d840c17) 86.19%.

Files Patch % Lines
src/internal/linear_solve.jl 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #358      +/-   ##
==========================================
- Coverage   86.23%   86.19%   -0.05%     
==========================================
  Files          44       44              
  Lines        2609     2608       -1     
==========================================
- Hits         2250     2248       -2     
- Misses        359      360       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@avik-pal
Copy link
Member Author

Failure is due to SciML/SciMLBase.jl#605.

@avik-pal avik-pal closed this Jan 30, 2024
@avik-pal avik-pal reopened this Jan 30, 2024
@ChrisRackauckas ChrisRackauckas merged commit 7e0685a into master Jan 30, 2024
45 of 52 checks passed
@ChrisRackauckas ChrisRackauckas deleted the ap/direct_ldiv branch January 30, 2024 10:02
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.

2 participants