-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
There doesn't seem to be an argument for chunk_size in JacVec
or JacVecOperator
. My code has some temporary variables inside so I use dualcache
. But my choice of chunk_size in dualcache
is not compatible with JacVec
unless it is set to 1.
Here's an example using the example shown in the dualcache
tutorial:
using LinearAlgebra, OrdinaryDiffEq, PreallocationTools
function foo(du, u, (A, tmp), t)
tmp = get_tmp(tmp, u)
mul!(tmp, A, u)
@. du = u + tmp
nothing
end
chunk_size = 1
# chunk_size = 5 doesn't work!
(A, tmp) = (ones(5,5), dualcache(zeros(5), Val{chunk_size}))
ff = (y,x)->foo(y,x,(A,tmp),nothing)
u0 = rand(5);
du0 = similar(u0);
ff(du0,u0)
using SparseDiffTools
J = JacVec(ff,u0;autodiff=true);
res = similar(u0);
mul!(res,J,u0) # Does 1 f evaluation
Metadata
Metadata
Assignees
Labels
No labels