Skip to content

[Do Not Merge] Preallocate more caches #470

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

Merged
merged 5 commits into from
Feb 13, 2024
Merged

[Do Not Merge] Preallocate more caches #470

merged 5 commits into from
Feb 13, 2024

Conversation

avik-pal
Copy link
Member

const PREALLOCATED_NORMALCHOLESKY = ArrayInterface.cholesky_instance(
Symmetric(rand(1, 1)), NoPivot())

function init_cacheval(alg::NormalCholeskyFactorization, A::Matrix, b, u, Pl, Pr,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function init_cacheval(alg::NormalCholeskyFactorization, A::Matrix, b, u, Pl, Pr,
function init_cacheval(alg::NormalCholeskyFactorization, A::Matrix{Float64}, b, u, Pl, Pr,

src/default.jl Outdated
Comment on lines 162 to 163
# DefaultAlgorithmChoice.GenericLUFactorization
DefaultAlgorithmChoice.RFLUFactorization
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that's anything more than voodoo, since https://github.com/JuliaLinearAlgebra/RecursiveFactorization.jl/blob/master/src/lu.jl#L62-L69 . I don't think that uses more caches or anything?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e37a60a) 27.90% compared to head (085ba9d) 28.11%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #470      +/-   ##
==========================================
+ Coverage   27.90%   28.11%   +0.21%     
==========================================
  Files          27       27              
  Lines        2118     2134      +16     
==========================================
+ Hits          591      600       +9     
- Misses       1527     1534       +7     

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

@avik-pal
Copy link
Member Author

These EnumX to Symbol mappings do have some unnecessary overhead, let me track them down

@avik-pal
Copy link
Member Author

julia> @btime solve(prob, $NewtonRaphson(; autodiff = AutoForwardDiff(; chunksize = 2)));
  2.774 μs (46 allocations: 4.55 KiB)

julia> @btime solve(prob, $NewtonRaphson(; autodiff = AutoForwardDiff(; chunksize = 2), linsolve = \));
  3.233 μs (49 allocations: 4.66 KiB)

julia> @btime solve(prob, $NewtonRaphson(; autodiff = AutoForwardDiff(; chunksize = 2), linsolve = GenericLUFactorization()));
  2.620 μs (44 allocations: 4.23 KiB)

julia> @btime solve(prob, $NewtonRaphson(; autodiff = AutoForwardDiff(; chunksize = 2), linsolve = RFLUFactorization()));
  2.607 μs (40 allocations: 3.91 KiB)

@avik-pal
Copy link
Member Author

I don't seem to have caused the Enzyme failures

@ChrisRackauckas ChrisRackauckas merged commit 8228c67 into main Feb 13, 2024
@ChrisRackauckas ChrisRackauckas deleted the ap/overhead branch February 13, 2024 22:11
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