-
Notifications
You must be signed in to change notification settings - Fork 6
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
Speed up ForwardDiffExt with batched solve #84
Comments
here is how I solve it in my tailored ForwardDiff compatible calls partials = mapreduce(ℱ.partials, hcat, BCX)'
b = ℱ.jacobian(x -> solve_sylvester_equation_condition(x, val), bcx)
a = ℱ.jacobian(x -> solve_sylvester_equation_condition(bcx, x), val)
reshape_matmul = LinearOperators.LinearOperator(Float64, size(b,1) * size(partials,2), size(b,1) * size(partials,2), false, false,
(sol,𝐱) -> begin
𝐗 = reshape(𝐱, (size(b,1),size(partials,2)))
sol .= vec(a * 𝐗)
return sol
end)
X, info = Krylov.gmres(reshape_matmul, -vec(b * partials))#, atol = tol)
jvp = reshape(X, (size(b,1),size(partials,2))) |
here you can see nicely as well why its worth having different conditions_backends. if you go from m input elements to n output elements and m >>n you want to use reverse mode overall but the conditions go both ways in terms of dimensionality. once you go from m to n and once from n to m (solution as input). in that sense, the case with the potentially largest efficiency gain is the one where you diff the condition with respect to the solution ( |
I'm struggling to make this work because |
See the vec and reshape operations in my example. I also gave it a try but was struggling with the operators. Working with realised matrices is somewhat easier for me... |
I tried a bit myself and managed for the direct solver case but the linear operator dimensions are a bit tricky to figure out |
This is an internal performance issue that can always be improved in a non breaking way, so I'm putting it on hold to focus on the design for v0.5 |
See #71 (comment) by @thorek1
The text was updated successfully, but these errors were encountered: