Skip to content

Add optional workspace for allocation-free CHOLMOD solves#727

Open
lorenzogambichler wants to merge 2 commits into
JuliaSparse:mainfrom
lorenzogambichler:cholmod-solve2-workspace
Open

Add optional workspace for allocation-free CHOLMOD solves#727
lorenzogambichler wants to merge 2 commits into
JuliaSparse:mainfrom
lorenzogambichler:cholmod-solve2-workspace

Conversation

@lorenzogambichler

@lorenzogambichler lorenzogambichler commented Jun 20, 2026

Copy link
Copy Markdown

Addresses #726

Adds optional preallocated workspace, so repeated solves against fixed sparse Cholesky factorization can reuse internal CHOLMOD cholmod_solve2 Y and E buffers. This eliminates any julia-sided allocations per solve (should reduce to 16 bytes total, as tested). The default solve path remains unchanged, since the workspace is fully optional. I am open to any alternative approaches or suggestions.

API:

F = cholesky(A)
ws = CholmodWorkspace()
for b in rhs
    ldiv!(x, F, b, ws)
end

Also added a testset similar to that of standard ldiv! above it with appropriate changes.

…s cholmod_dense_struct wrappers and Y/E buffers so cholmod_solve2 reuses them across calls instead of reallocating
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.09524% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.34%. Comparing base (3f9b6fb) to head (5923f2f).

Files with missing lines Patch % Lines
src/solvers/cholmod.jl 88.09% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #727      +/-   ##
==========================================
- Coverage   84.39%   84.34%   -0.06%     
==========================================
  Files          13       13              
  Lines        9371     9413      +42     
==========================================
+ Hits         7909     7939      +30     
- Misses       1462     1474      +12     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lorenzogambichler

Copy link
Copy Markdown
Author

The failed win x86/x64 nightly checks seem to be a dependency resolution fail, so unrelated to this PR from what I can tell.

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.

1 participant