-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
remove KLU
and UMFPACK
from the default
#456
remove KLU
and UMFPACK
from the default
#456
Conversation
… especially easy to silence
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #456 +/- ##
===========================================
- Coverage 66.06% 24.88% -41.19%
===========================================
Files 27 27
Lines 2122 2110 -12
===========================================
- Hits 1402 525 -877
- Misses 720 1585 +865 ☔ View full report in Codecov by Sentry. |
Let's be serious... |
Why exactly do these errors need to be suppressed and what is the preferred behavior here? At least KLU I can modify, but I'm somewhat confused. |
the sciml style is to return error codes rather than throw errors because that way, higher level interfaces can check the results better. for example, this PR was created because I was getting a SingularException from the nonlinear solve that initializes a DAE solve which would have initialized properly if the linear solve had returned with a failing error code rather than erroring. |
Surely LinSolve should just wrap the solve calls in try catch then? KLU would be sort of non-conformant to the LinearAlgebra factorization "interface" if it returned error codes instead of exceptional errors. |
No, try/catch is really slow and is generally not recommended in any numerical code because it introduces dynamic behavior. In general, mathematical functions shouldn't throw but instead report errors. That's why LAPACK's interface has return codes instead of throws, and SuiteSparse does this as well, Sundials, it's why NaNMath.jl exists, etc. all are setup to not throw because that interferes with the recovery behavior of solvers. Julia's interface throws by default, but it's an important enough feature that |
Alright that's easy enough to fix, I'll try to do that tonight if this flight isn't any further delayed |
Thanks! |
UMFPACK already has it :P, I'll check on KLU and then make a PR |
Wait. |
None of the operations should error throw. If |
Any errors? Even OOM? |
OOM is acceptable (since an OOM isn't really recoverable anyway) |
Yeah things that prevent segfaults, sure that needs to error. But it's the errors that are non-essential. Think for example NaNMath.jl. Julia throws an error if it enters the complex plane but that's not necessary, it could just be a NaN as a message that the solution doesn't exist and then a runtime check for NaNs allows optimization routines to continue. This is why JuMP for example has to translate all math functions to NaNMath functions internally. |
Yeah I see at least a few possible throws in LinearAlgebra/cholesky.jl. The codes that at least Cholesky would throw at ldiv! time are:
I'm going to operate under the assumption that these are both acceptable (I imagine similar is true for UMFPACK and KLU). And it's only factorization input issues (singularity, issues with the diagonal, etc) which should be disabled for possible recovery. |
I've added support for These errors must be caught after the factorization and before the solve using |
Okay, if ldiv! isn't throwing errors then I think we're good? |
UMFPACK and KLU both throw errors with singular matrices that are not especially easy to silence
ldiv!
for sparse UMFPACK andklu
do not support passingcheck=false
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.