@@ -5,6 +5,14 @@ using ADTypes, SparseDiffTools,
55 StaticArrays
66using ADTypes: dense_ad
77
8+ function nice_string (ad:: AbstractADType )
9+ if ad isa AutoSparse
10+ return " AutoSparse($(nice_string (dense_ad (ad))) )"
11+ else
12+ return nameof (typeof (ad))
13+ end
14+ end
15+
816function __chunksize (:: Union {
917 AutoSparse{<: AutoForwardDiff{C} }, AutoForwardDiff{C},
1018 AutoSparse{<: AutoPolyesterForwardDiff{C} }, AutoPolyesterForwardDiff{C}
@@ -70,7 +78,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
7078 AutoPolyesterForwardDiff (; chunksize = 4 )
7179 ]
7280
73- @testset " sparse_jacobian $(nameof ( typeof ( difftype) )) : Out of Place" for difftype in DIFFTYPES
81+ @testset " sparse_jacobian $(nice_string ( difftype)) : Out of Place" for difftype in DIFFTYPES
7482 @testset " Cache & Reuse" begin
7583 cache = sparse_jacobian_cache (difftype, sd, fdiff, x)
7684 J = init_jacobian (cache)
@@ -81,7 +89,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
8189 @inferred sparse_jacobian! (J, difftype, cache, fdiff, x)
8290
8391 t₁ = @elapsed sparse_jacobian! (J, difftype, cache, fdiff, x)
84- @info " $(nameof ( typeof ( difftype) )) () `sparse_jacobian!` (only differentiation) time: $(t₁) s"
92+ @info " $(nice_string ( difftype)) () `sparse_jacobian!` (only differentiation) time: $(t₁) s"
8593
8694 J = sparse_jacobian (difftype, cache, fdiff, x)
8795
@@ -92,7 +100,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
92100 end
93101
94102 t₂ = @elapsed sparse_jacobian (difftype, cache, fdiff, x)
95- @info " $(nameof ( typeof ( difftype) )) () `sparse_jacobian` (with matrix allocation) time: $(t₂) s"
103+ @info " $(nice_string ( difftype)) () `sparse_jacobian` (with matrix allocation) time: $(t₂) s"
96104 end
97105
98106 @testset " Single Use" begin
@@ -104,7 +112,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
104112 end
105113
106114 t₁ = @elapsed sparse_jacobian (difftype, sd, fdiff, x)
107- @info " $(nameof ( typeof ( difftype) )) () `sparse_jacobian` (complete) time: $(t₁) s"
115+ @info " $(nice_string ( difftype)) () `sparse_jacobian` (complete) time: $(t₁) s"
108116
109117 cache = sparse_jacobian_cache (difftype, sd, fdiff, x)
110118 J = init_jacobian (cache)
@@ -115,13 +123,13 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
115123 @inferred sparse_jacobian! (J, difftype, sd, fdiff, x)
116124
117125 t₂ = @elapsed sparse_jacobian! (J, difftype, sd, fdiff, x)
118- @info " $(nameof ( typeof ( difftype) )) () `sparse_jacobian!` (with matrix coloring) time: $(t₂) s"
126+ @info " $(nice_string ( difftype)) () `sparse_jacobian!` (with matrix coloring) time: $(t₂) s"
119127 end
120128 end
121129
122130 @info " Inplace Place Function"
123131
124- @testset " sparse_jacobian $(nameof ( typeof ( difftype) )) : In place" for difftype in (
132+ @testset " sparse_jacobian $(nice_string ( difftype)) : In place" for difftype in (
125133 AutoSparse (AutoForwardDiff ()), AutoForwardDiff (),
126134 AutoSparse (AutoForwardDiff (; chunksize = 0 )), AutoForwardDiff (; chunksize = 0 ),
127135 AutoSparse (AutoForwardDiff (; chunksize = 4 )), AutoForwardDiff (; chunksize = 4 ),
@@ -138,7 +146,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
138146 @inferred sparse_jacobian! (J, difftype, cache, fdiff, y, x)
139147
140148 t₁ = @elapsed sparse_jacobian! (J, difftype, cache, fdiff, y, x)
141- @info " $(nameof ( typeof ( difftype) )) () `sparse_jacobian!` (only differentiation) time: $(t₁) s"
149+ @info " $(nice_string ( difftype)) () `sparse_jacobian!` (only differentiation) time: $(t₁) s"
142150
143151 J = sparse_jacobian (difftype, cache, fdiff, y, x)
144152
@@ -148,7 +156,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
148156 end
149157
150158 t₂ = @elapsed sparse_jacobian (difftype, cache, fdiff, y, x)
151- @info " $(nameof ( typeof ( difftype) )) () `sparse_jacobian` (with jacobian allocation) time: $(t₂) s"
159+ @info " $(nice_string ( difftype)) () `sparse_jacobian` (with jacobian allocation) time: $(t₂) s"
152160 end
153161
154162 @testset " Single Use" begin
@@ -160,7 +168,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
160168 end
161169
162170 t₁ = @elapsed sparse_jacobian (difftype, sd, fdiff, y, x)
163- @info " $(nameof ( typeof ( difftype) )) () `sparse_jacobian` (complete) time: $(t₁) s"
171+ @info " $(nice_string ( difftype)) () `sparse_jacobian` (complete) time: $(t₁) s"
164172
165173 J = init_jacobian (cache)
166174
@@ -170,11 +178,11 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
170178 @inferred sparse_jacobian! (J, difftype, sd, fdiff, y, x)
171179
172180 t₂ = @elapsed sparse_jacobian! (J, difftype, sd, fdiff, y, x)
173- @info " $(nameof ( typeof ( difftype) )) () `sparse_jacobian!` (with matrix coloring) time: $(t₂) s"
181+ @info " $(nice_string ( difftype)) () `sparse_jacobian!` (with matrix coloring) time: $(t₂) s"
174182 end
175183 end
176184
177- @testset " sparse_jacobian $(nameof ( typeof ( difftype) )) : In place" for difftype in (
185+ @testset " sparse_jacobian $(nice_string ( difftype)) : In place" for difftype in (
178186 AutoSparse (AutoZygote ()),
179187 AutoZygote ())
180188 y = similar (x)
0 commit comments