Skip to content

Commit a03b2d9

Browse files
committed
Minor
1 parent 6fb8c59 commit a03b2d9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Autodiff.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ end
223223
function distributed_autodiff_array_jacobian(a, i_to_x, j_to_i::AbstractArray{<:SkeletonPair})
224224
dummy_tag = ()->()
225225
i_to_cfg = map(i_to_x) do i_to_x
226-
lazy_map(ConfigMap(ForwardDiff.gradient,dummy_tag),i_to_x)
226+
lazy_map(ConfigMap(ForwardDiff.jacobian,dummy_tag),i_to_x)
227227
end
228228
i_to_xdual = map(i_to_cfg,i_to_x) do i_to_cfg, i_to_x
229229
lazy_map(DualizeMap(),i_to_cfg,i_to_x)

test/AutodiffTests.jl

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ using Test
44
using Gridap, Gridap.Algebra
55
using GridapDistributed
66
using PartitionedArrays
7+
using SparseArrays
8+
using ForwardDiff
79

810
function main_sf(distribute,parts)
911
ranks = distribute(LinearIndices((prod(parts),)))
@@ -40,6 +42,16 @@ function main_sf(distribute,parts)
4042
b = assemble_vector(dg,U)
4143
b_AD = assemble_vector(gradient(g,uh),U)
4244
@test b b_AD
45+
46+
# Skeleton AD
47+
# I would like to compare the results, but we cannot be using FD in parallel...
48+
Λ = SkeletonTriangulation(model)
49+
= Measure(Λ,2*k)
50+
g_Λ(v) = (mean(v))*
51+
r_Λ(u,v) = (mean(u)*mean(v))*
52+
53+
b_Λ_AD = assemble_vector(gradient(g_Λ,uh),U)
54+
A_Λ_AD = jacobian(FEOperator(r_Λ,U,V),uh)
4355
end
4456

4557
function main_mf(distribute,parts)

0 commit comments

Comments
 (0)