Skip to content

Commit 7a935d1

Browse files
committed
bring back compilation workload
1 parent 6b3f882 commit 7a935d1

File tree

2 files changed

+43
-45
lines changed

2 files changed

+43
-45
lines changed

lib/NonlinearSolveQuasiNewton/src/NonlinearSolveQuasiNewton.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ include("klement.jl")
3434

3535
include("solve.jl")
3636

37-
# @setup_workload begin
38-
# nonlinear_functions = (
39-
# (NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
40-
# (NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
41-
# (NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
42-
# )
43-
44-
# nonlinear_problems = NonlinearProblem[]
45-
# for (fn, u0) in nonlinear_functions
46-
# push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
47-
# end
48-
49-
# algs = [Broyden(), Klement()]
37+
@setup_workload begin
38+
nonlinear_functions = (
39+
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
40+
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
41+
(NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
42+
)
43+
44+
nonlinear_problems = NonlinearProblem[]
45+
for (fn, u0) in nonlinear_functions
46+
push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
47+
end
48+
49+
algs = [Broyden(), Klement()]
5050

5151
@compile_workload begin
5252
@sync for prob in nonlinear_problems, alg in algs

src/NonlinearSolve.jl

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ include("default.jl")
5252

5353
include("forward_diff.jl")
5454

55-
# @setup_workload begin
56-
# nonlinear_functions = (
57-
# (NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
58-
# (NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
59-
# (NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
60-
# )
61-
62-
# nonlinear_problems = NonlinearProblem[]
63-
# for (fn, u0) in nonlinear_functions
64-
# push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
65-
# end
55+
@setup_workload begin
56+
nonlinear_functions = (
57+
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
58+
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
59+
(NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
60+
)
61+
62+
nonlinear_problems = NonlinearProblem[]
63+
for (fn, u0) in nonlinear_functions
64+
push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
65+
end
6666

6767
nonlinear_functions = (
6868
(NonlinearFunction{false, NoSpecialize}((u, p) -> (u .^ 2 .- p)[1:1]), [0.1, 0.0]),
@@ -85,27 +85,25 @@ include("forward_diff.jl")
8585
)
8686
)
8787

88-
# nlls_problems = NonlinearLeastSquaresProblem[]
89-
# for (fn, u0) in nonlinear_functions
90-
# push!(nlls_problems, NonlinearLeastSquaresProblem(fn, u0, 2.0))
91-
# end
92-
93-
# @compile_workload begin
94-
# @sync begin
95-
# for prob in nonlinear_problems
96-
# Threads.@spawn CommonSolve.solve(
97-
# prob, nothing; abstol = 1e-2, verbose = true
98-
# )
99-
# end
100-
101-
# for prob in nlls_problems
102-
# Threads.@spawn CommonSolve.solve(
103-
# prob, nothing; abstol = 1e-2, verbose = true
104-
# )
105-
# end
106-
# end
107-
# end
108-
# end
88+
nlls_problems = NonlinearLeastSquaresProblem[]
89+
for (fn, u0) in nonlinear_functions
90+
push!(nlls_problems, NonlinearLeastSquaresProblem(fn, u0, 2.0))
91+
end
92+
93+
@compile_workload begin
94+
@sync begin
95+
for prob in nonlinear_problems
96+
Threads.@spawn CommonSolve.solve(
97+
)
98+
end
99+
100+
for prob in nlls_problems
101+
Threads.@spawn CommonSolve.solve(
102+
)
103+
end
104+
end
105+
end
106+
end
109107

110108
# Rexexports
111109
@reexport using SciMLBase, NonlinearSolveBase, LineSearch, ADTypes

0 commit comments

Comments
 (0)