Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Feb 11, 2025
1 parent 6fb8c59 commit a03b2d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Autodiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ end
function distributed_autodiff_array_jacobian(a, i_to_x, j_to_i::AbstractArray{<:SkeletonPair})
dummy_tag = ()->()
i_to_cfg = map(i_to_x) do i_to_x
lazy_map(ConfigMap(ForwardDiff.gradient,dummy_tag),i_to_x)
lazy_map(ConfigMap(ForwardDiff.jacobian,dummy_tag),i_to_x)
end
i_to_xdual = map(i_to_cfg,i_to_x) do i_to_cfg, i_to_x
lazy_map(DualizeMap(),i_to_cfg,i_to_x)
Expand Down
12 changes: 12 additions & 0 deletions test/AutodiffTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ using Test
using Gridap, Gridap.Algebra
using GridapDistributed
using PartitionedArrays
using SparseArrays
using ForwardDiff

function main_sf(distribute,parts)
ranks = distribute(LinearIndices((prod(parts),)))
Expand Down Expand Up @@ -40,6 +42,16 @@ function main_sf(distribute,parts)
b = assemble_vector(dg,U)
b_AD = assemble_vector(gradient(g,uh),U)
@test b b_AD

# Skeleton AD
# I would like to compare the results, but we cannot be using FD in parallel...
Λ = SkeletonTriangulation(model)
= Measure(Λ,2*k)
g_Λ(v) = (mean(v))*
r_Λ(u,v) = (mean(u)*mean(v))*

b_Λ_AD = assemble_vector(gradient(g_Λ,uh),U)
A_Λ_AD = jacobian(FEOperator(r_Λ,U,V),uh)
end

function main_mf(distribute,parts)
Expand Down

0 comments on commit a03b2d9

Please sign in to comment.