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

Use DI preparation result when initializing Jacobian #472

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

gdalle
Copy link
Collaborator

@gdalle gdalle commented Oct 4, 2024

This should fix #469 for the example you gave.

Copy link
Member

@avik-pal avik-pal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad, completely missed it. Thanks!

@gdalle
Copy link
Collaborator Author

gdalle commented Oct 4, 2024

It would be fair to expect DI.jacobian(b, AutoForwardDiff(; chunksize=2), x) to be type-stable. The problem is that this falls back directly onto ForwardDiff.jacobian(f, x), which is itself type-unstable since I don't give it the static chunk size it needs to create the JacobianConfig. I could give it the chunk size, but I would have to create a JacobianConfig myself for that, which is unnecessary work e.g. for StaticArrays.

@ChrisRackauckas
Copy link
Member

We allowed for specifying chunk size as a Val to handle that. We probably need to ensure that's allowed in ADTypes implementations.

@gdalle
Copy link
Collaborator Author

gdalle commented Oct 4, 2024

This should solve it: gdalle/DifferentiationInterface.jl#541

@avik-pal avik-pal merged commit d56476c into SciML:master Oct 4, 2024
31 of 34 checks passed
@gdalle gdalle deleted the gd/jac_init branch October 4, 2024 17:04
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.

cache construction is no longer type stable
3 participants