Open linwaytin opened 4 years ago
I'm solving the heat equation using finite difference method, in which an nonlinear solver is needed.
Why not use CVODE?
Does anybody have idea about this?
This looks like a memory leak. I'd look into how it's freeing. TBH the Kinsol code in here has gotten the least love because it's all been about the ODE/DAE solvers. (And I haven't found a case where Kinsol does better than NLsolve.jl)
Why not use CVODE?
Just curious about the performance. I tried also NLsolve.jl and Scipy's root through PyCall.jl They both solve the problem but NLsolve is much slower than Scipy's root, in particular for large systems. Sundials seems much faster but broken after a few steps.
I see. Yes, to investigate a performance issue is a reason to get this fixed up. I'll take a look at it later today after teaching.
in particular for large systems.
For large systems you'll likely want to exploit sparsity, which NLsolve doesn't do (SciPy doesn't either). Kinsol doesn't have all of it either... see
http://www.stochasticlifestyle.com/a-collection-of-jacobian-sparsity-acceleration-tools-for-julia/
https://github.com/JuliaNLSolvers/NLsolve.jl/issues/219
@pkofod were benchmarks ever setup for NLsolve? This is a little curious because a large nonlinear solve should essentially just cost a multiple of the number of matrix factorizations, so I wonder if there's an algorithmic improvement that needs to be done for it.
Thanks for taking care of this issue. Another interesting thing is that the performance of Scipy (root with Krylov method) and NLsolve are quite different. Probably there is something hidden in the implementation.
Another interesting thing is that the performance of Scipy (root with Krylov method) and NLsolve are quite different. Probably there is something hidden in the implementation.
I don't see why that would be surprising. NLsolve does not do Krylov at all (though I'm re-writing both Optim an NLsolve's code, and the new version does have a Krylov solver that you can try if you want).
I tried also NLsolve.jl and Scipy's root through PyCall.jl
Is that the Krylov solver then?
KINSOL isn't a Krylov method though, so if it is faster that's puzzling and worth looking into. I'd assume factorization costs dominate the allocations so much that it wouldn't matter at that point, so there's only a difference if you factorize more.
Is that the Krylov solver then?
Yes, I only use the Krylov solver.
KINSOL isn't a Krylov method though
According to its website, KINSOL contains a Newton-Krylov solver. Is this not what's called Krylov method?
I see, that part is wrapped but isn't used in the higher level interface. You'd have to call the wrapped API for it right now.
Yes, I only use the Krylov solver.
Okay, but then NLsolve is obviously crippled here, because it does not do a krylov solver. How hard would it be to produce a function that calculates the residual vector?
Hi there,
I'm solving the heat equation using finite difference method, in which an nonlinear solver is needed.
I found kinsol will be broken after several steps. The error is as follows.
If I make the grid finer (giving larger nonlinear systems), kinsol will be broken earlier. Does anybody have idea about this?