Skip to content

Commit bb58b6a

Browse files
committed
resintate setup workload
1 parent d61b3e5 commit bb58b6a

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

lib/NonlinearSolveFirstOrder/src/NonlinearSolveFirstOrder.jl

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -40,59 +40,59 @@ include("pseudo_transient.jl")
4040
include("poly_algs.jl")
4141
include("forward_diff.jl")
4242

43-
# @setup_workload begin
44-
# nonlinear_functions = (
45-
# (NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
46-
# (NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
47-
# (NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
48-
# )
49-
50-
# nonlinear_problems = NonlinearProblem[]
51-
# for (fn, u0) in nonlinear_functions
52-
# push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
53-
# end
54-
55-
# nonlinear_functions = (
56-
# (NonlinearFunction{false, NoSpecialize}((u, p) -> (u .^ 2 .- p)[1:1]), [0.1, 0.0]),
57-
# (
58-
# NonlinearFunction{false, NoSpecialize}((u, p) -> vcat(u .* u .- p, u .* u .- p)),
59-
# [0.1, 0.1]
60-
# ),
61-
# (
62-
# NonlinearFunction{true, NoSpecialize}(
63-
# (du, u, p) -> du[1] = u[1] * u[1] - p, resid_prototype = zeros(1)
64-
# ),
65-
# [0.1, 0.0]
66-
# ),
67-
# (
68-
# NonlinearFunction{true, NoSpecialize}(
69-
# (du, u, p) -> du .= vcat(u .* u .- p, u .* u .- p), resid_prototype = zeros(4)
70-
# ),
71-
# [0.1, 0.1]
72-
# )
73-
# )
74-
75-
# nlls_problems = NonlinearLeastSquaresProblem[]
76-
# for (fn, u0) in nonlinear_functions
77-
# push!(nlls_problems, NonlinearLeastSquaresProblem(fn, u0, 2.0))
78-
# end
79-
80-
# nlp_algs = [NewtonRaphson(), TrustRegion(), LevenbergMarquardt()]
81-
# nlls_algs = [GaussNewton(), TrustRegion(), LevenbergMarquardt()]
82-
83-
# @compile_workload begin
84-
# @sync begin
85-
# for prob in nonlinear_problems, alg in nlp_algs
86-
# Threads.@spawn CommonSolve.solve(prob, alg; abstol = 1e-2, verbose = NonlinearVerbosity())
87-
# end
88-
89-
# for prob in nlls_problems, alg in nlls_algs
90-
# Threads.@spawn CommonSolve.solve(
91-
# prob, alg; abstol = 1e-2, verbose = NonlinearVerbosity())
92-
# end
93-
# end
94-
# end
95-
# end
43+
@setup_workload begin
44+
nonlinear_functions = (
45+
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
46+
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
47+
(NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
48+
)
49+
50+
nonlinear_problems = NonlinearProblem[]
51+
for (fn, u0) in nonlinear_functions
52+
push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
53+
end
54+
55+
nonlinear_functions = (
56+
(NonlinearFunction{false, NoSpecialize}((u, p) -> (u .^ 2 .- p)[1:1]), [0.1, 0.0]),
57+
(
58+
NonlinearFunction{false, NoSpecialize}((u, p) -> vcat(u .* u .- p, u .* u .- p)),
59+
[0.1, 0.1]
60+
),
61+
(
62+
NonlinearFunction{true, NoSpecialize}(
63+
(du, u, p) -> du[1] = u[1] * u[1] - p, resid_prototype = zeros(1)
64+
),
65+
[0.1, 0.0]
66+
),
67+
(
68+
NonlinearFunction{true, NoSpecialize}(
69+
(du, u, p) -> du .= vcat(u .* u .- p, u .* u .- p), resid_prototype = zeros(4)
70+
),
71+
[0.1, 0.1]
72+
)
73+
)
74+
75+
nlls_problems = NonlinearLeastSquaresProblem[]
76+
for (fn, u0) in nonlinear_functions
77+
push!(nlls_problems, NonlinearLeastSquaresProblem(fn, u0, 2.0))
78+
end
79+
80+
nlp_algs = [NewtonRaphson(), TrustRegion(), LevenbergMarquardt()]
81+
nlls_algs = [GaussNewton(), TrustRegion(), LevenbergMarquardt()]
82+
83+
@compile_workload begin
84+
@sync begin
85+
for prob in nonlinear_problems, alg in nlp_algs
86+
Threads.@spawn CommonSolve.solve(prob, alg; abstol = 1e-2, verbose = NonlinearVerbosity())
87+
end
88+
89+
for prob in nlls_problems, alg in nlls_algs
90+
Threads.@spawn CommonSolve.solve(
91+
prob, alg; abstol = 1e-2, verbose = NonlinearVerbosity())
92+
end
93+
end
94+
end
95+
end
9696

9797
@reexport using SciMLBase, NonlinearSolveBase
9898

0 commit comments

Comments
 (0)