@@ -194,7 +194,7 @@ save("static_arrays_quadratic.svg", fig)
194194
195195```julia
196196probs = [generate_prob(Val(N), Val(false)) for N in [4, 16, 128, 1024]]
197- wpsets = [(@show length(prob.u0); generate_wpset(prob, solvers) ) for prob in probs]
197+ wpsets = [generate_wpset(prob, solvers) for prob in probs]
198198titles = ["N = 4", "N = 16", "N = 128", "N = 1024"]
199199
200200fig = plot_all_wpsets(wpsets, solvers, titles, "Regular Julia Arrays")
@@ -207,46 +207,25 @@ save("regular_arrays_quadratic.svg", fig)
207207## Comparison against SimpleNonlinearSolve
208208
209209```julia
210- function __set_ad_chunksize(solver::GeneralizedFirstOrderAlgorithm{CJ, N}, ck) where {CJ, N}
211- ad = AutoForwardDiff(; chunksize = ck)
212- return GeneralizedFirstOrderAlgorithm{CJ, N}(; solver.descent, solver.linesearch,
213- solver.trustregion, jacobian_ad = ad, solver.max_shrink_times, solver.forward_ad,
214- solver.reverse_ad)
215- end
216- function __set_ad_chunksize(solver::SimpleNewtonRaphson, ck)
217- solver.autodiff === nothing || return solver
218- autodiff = AutoForwardDiff(; chunksize = ck)
219- return SimpleNewtonRaphson(; autodiff)
220- end
221- function __set_ad_chunksize(solver::SimpleTrustRegion, ck)
222- solver.autodiff === nothing || return solver
223- autodiff = AutoForwardDiff(; chunksize = ck)
224- return SimpleTrustRegion(; autodiff)
225- end
226- __set_ad_chunksize(solver, _) = solver
227-
228210function benchmark_combinations(solvers, probs)
229211 return map(Iterators.product(solvers, probs)) do (solver, prob)
230212 try
231- solver_concrete = prob.u0 isa SArray ? solver.solver[:alg] :
232- __set_ad_chunksize(solver.solver[:alg],
233- min(NonlinearSolve.pickchunksize(prob.u0), 6))
234-
235- sol = solve(prob, solver_concrete; abstol = 1e-10, reltol = 1e-10,
213+ alg = solver.solver[:alg]
214+ sol = solve(prob, alg; abstol = 1e-10, reltol = 1e-10,
236215 maxiters = 1000, termination_condition = AbsNormTerminationMode())
237216 @info "Solver $(solver.name) successfully solved the problem with norm = \
238217 $(norm(sol.resid, Inf))."
239218
240219 if norm(sol.resid, Inf) ≤ 1e-10
241- tt = @belapsed solve($prob, $solver_concrete ; abstol = 1e-10,
220+ tt = @belapsed solve($prob, $alg ; abstol = 1e-10,
242221 reltol = 1e-10, maxiters = 1000)
243222 @info "Solver $(solver.name) took $(tt) seconds."
244223 return tt
245224 else
246225 return NaN
247226 end
248227 catch e
249- @error "Solver $(solver.name) threw an error."
228+ @error "Solver $(solver.name) threw an error." err=e
250229 return NaN
251230 end
252231 end
@@ -299,14 +278,14 @@ fig = begin
299278
300279 ax = Axis(fig[1, i];
301280 ylabel = "",
302- title = L"N = %$(length(probs_sa[i].u0))$",
281+ title = L"N = %$(length(probs_sa[i].u0))% $",
303282 titlegap = 10, xticksvisible = false, yticksvisible = true,
304283 xticklabelsvisible = false, yticklabelsvisible = true, titlesize = 22,
305284 spinewidth = STROKEWIDTH, xlabelsize = 22, ylabelsize = 22,
306285 xticklabelrotation = π / 4, xticklabelsize = 20, yticklabelsize = 20)
307286 axs[1, i] = ax
308287
309- barplot!(ax, xs, ys; dogde = dodge, color = dodge, colormap = :seaborn_bright,
288+ barplot!(ax, xs, ys; dodge, color = dodge, colormap = :seaborn_bright,
310289 strokewidth = 2)
311290
312291 hlines!(ax, [1.0], color = :black, linestyle = :dash, linewidth = 2)
@@ -324,15 +303,15 @@ fig = begin
324303
325304 ax = Axis(fig[2, i];
326305 ylabel = "",
327- title = L"N = %$(length(probs_reg[i].u0))$",
306+ title = L"N = %$(length(probs_reg[i].u0))% $",
328307 titlegap = 10, xticksvisible = true, yticksvisible = true,
329308 xticklabelsvisible = true, yticklabelsvisible = true, titlesize = 22,
330309 spinewidth = STROKEWIDTH, xlabelsize = 22, ylabelsize = 22,
331310 xticks = (1:length(df_sa), [d.first for d in df_sa]),
332311 xticklabelrotation = π / 4, xticklabelsize = 20, yticklabelsize = 20)
333312 axs[1, i] = ax
334313
335- barplot!(ax, xs, ys; color = dodge, dodge = dodge, colormap = :seaborn_bright,
314+ barplot!(ax, xs, ys; dodge, color = dodge, colormap = :seaborn_bright,
336315 strokewidth = 3)
337316
338317 hlines!(ax, [1.0], color = :black, linestyle = :dash, linewidth = 3)
0 commit comments