Skip to content
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

Try out DifferentiationInterface for sparse autodiff? #109

Open
gdalle opened this issue Jun 27, 2024 · 2 comments
Open

Try out DifferentiationInterface for sparse autodiff? #109

gdalle opened this issue Jun 27, 2024 · 2 comments

Comments

@gdalle
Copy link

gdalle commented Jun 27, 2024

Hi @j-fu!
As of this morning's release, DifferentiationInterface is starting to look like a solid replacement for SparseDiffTools in the realm of sparse Jacobians and Hessians. Would you be interested in trying it out?
You can check out the tutorial to get a feel for the interface.

@j-fu
Copy link
Member

j-fu commented Jun 28, 2024

Thanks for pinging me - basically this is already on my bucket list. However, sparsity detection in the moment is a side track in VoronoiFVM, as the general approach is to apply AD (ForwardDiff to be exact) locally, resulting in local
node and edge based Jacobi matrices (a similar approach with FEM would use element Jacobi matrices). These are assembled into the global sparse matrix via an intermediate linked list structure (see ExtendableSparse.jl).

A bit of handwaving philosophy behind this is that discretized PDEs have a repeating spatial structure. In that sense their sparsity pattern is not entirely generic (though with multispecies/multiphysics this is hard to condense into some structure) Global sparsity detection seems to kind of ignores this fact.

Sparsity detection in VoronoiFVM.jl is used for a "generic operator" (which is for weird models) and for derivatives of solution functionals (for impedance/small signal analysis).

In the moment, my main focus for the package is multithreaded assembly.
How your approach to sparsity detection would work with multithreaded code ?

@gdalle
Copy link
Author

gdalle commented Jul 3, 2024

A bit of handwaving philosophy behind this is that discretized PDEs have a repeating spatial structure. In that sense their sparsity pattern is not entirely generic

I see, you might be interested in the following works then, which also exploit repeated structure for differentiation:

How your approach to sparsity detection would work with multithreaded code ?

There isn't any theoretical obstacle, but I don't think performance would be great, because sparsity detection routines make lots of allocations that may hamper parallelism

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

No branches or pull requests

2 participants