-
Notifications
You must be signed in to change notification settings - Fork 4
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
improve performance with sparse matrices #101
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
==========================================
- Coverage 98.32% 98.09% -0.23%
==========================================
Files 6 6
Lines 1250 1415 +165
==========================================
+ Hits 1229 1388 +159
- Misses 21 27 +6 ☔ View full report in Codecov by Sentry. |
There seem to be some issues with floating point rounding errors on macOS CI. The other tests seem to be fine |
@SKopecz Do you have an idea why |
If possible, I'd exclude I think we need much more information to see what the actual problem is. It looks to me as if the result of linear solve has a negative element. |
👍
Yes, that's what I think, too - computing the powers like |
This PR is ready for a review. Let's keep fingers crossed that CI passes this time 🤞 |
do not necessarily have the structure for which UMFPACK is optimized for. Thus, | ||
it is often possible to gain performance by switching to KLU instead. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying that this is the reason for the large number of allocations we see in the linear advection tutorial?
There's also something else we should look at. When we initialize the linear solvers we use something like
linsolve = init(linprob, alg.linsolve, alias_A = true, alias_b = true,
assumptions = LinearSolve.OperatorAssumptions(true))
The statement alias_A=true
allows the linear solver to reuse the memory of the system matrix and modify it. The idea behind this was that in an MPRK scheme we no longer need the system matrix once the system is solved, so the linear solver can change it at will.
For a sparse matrix this modification of the system matrix could become problematic, since the sparsity pattern of L and U does not match that of A, especially in the linear advection tutorial, where A is a banded matrix with an entry in the upper right corner, for which in genaral L or U could become a full triangular matrix.
All I want to say is that we should try alias_A=false
and check if we see any difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use alias_A = !issparse(the_matrix_we_put_in)
for the general case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks! I just had a minor comment on the FAQ and the concern regarding alias_A=true
could also be moved to an issue.
Co-authored-by: Stefan Kopecz <[email protected]>
Closes #98