Skip to content

Commit 387cc42

Browse files
Automatic build\nPublished by build of: SciML/SciMLBenchmarks.jl@6d7941b
1 parent b1312c4 commit 387cc42

File tree

6 files changed

+36
-33
lines changed

6 files changed

+36
-33
lines changed

markdown/NonlinearProblem/bruss.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,15 @@ function get_ordering(x::AbstractMatrix)
163163
idxs = Vector{Int}(undef, size(x, 1))
164164
placed = zeros(Bool, size(x, 1))
165165
idx = 1
166-
for i in size(x, 2):-1:1
167-
col = view(x, :, i)
168-
idxs_col = sortperm(col; by = x -> isnan(x) ? Inf : (x == -1 ? Inf : x))
169-
for j in idxs_col
170-
if !placed[j] && !isnan(col[j]) && col[j] -1
171-
idxs[j] = idx
166+
for j in size(x, 2):-1:1
167+
row = view(x, :, j)
168+
idxs_row = sortperm(row; by = x -> isnan(x) ? Inf : (x == -1 ? Inf : x))
169+
for i in idxs_row
170+
if !placed[i] && !isnan(row[i]) && row[i] -1
171+
idxs[idx] = i
172+
placed[i] = true
172173
idx += 1
173-
placed[j] = true
174+
idx > length(idxs) && break
174175
end
175176
end
176177
idx > length(idxs) && break
@@ -239,7 +240,7 @@ for (i, N) in enumerate(Ns)
239240
bruss_f!, u0 = (du, u) -> test_problem.f(du, u, test_problem.p), test_problem.u0
240241
y = similar(u0)
241242
for (j, (sd, adtype)) in enumerate(algs)
242-
if N < 2^8 || (N 2^8 && sd isa SymbolicsSparsityDetection)
243+
if N < 2^9 || (N 2^9 && sd isa SymbolicsSparsityDetection)
243244
times[i, j] = @belapsed $cache_and_compute_10_jacobians($adtype, $sd, $bruss_f!, $y, $u0)
244245
@info times[i, j]
245246
else
@@ -272,7 +273,7 @@ fig = begin
272273
colormap = :seaborn_bright, strokewidth = 3)
273274

274275
ax = Axis(fig[1, 2]; title = "Scaling of Sparse Jacobian Computation Algorithms",
275-
titlesize = 22, titlegap = 10, xscale = log2, yscale = log2,
276+
titlesize = 22, titlegap = 10, xscale = log10, yscale = log10,
276277
xticksize = 20, yticksize = 20, xticklabelsize = 20, yticklabelsize = 20,
277278
xtickwidth = 2.5, ytickwidth = 2.5, spinewidth = 2.5,
278279
xlabel = L"Input Dimension ($\mathbf{N}$)", ylabel = L"Time $\mathbf{(s)}$", xlabelsize = 22,
@@ -376,7 +377,7 @@ CairoMakie.Screen{SVG}
376377
First, let us experiment the scaling of each algorithm with the problem size.
377378

378379
```julia
379-
Ns = 2 .^ (2:7)
380+
Ns = vcat(collect(2 .^ (2:7)), [150, 175, 200])
380381

381382
solvers_scaling = [
382383
(; pkg = :nonlinearsolve, sparsity = :none, name = "NR (Dense)", alg = NewtonRaphson(; linsolve = nothing)),
@@ -420,7 +421,10 @@ for (i, N) in enumerate(Ns)
420421
if (j > 1 && runtimes_scaling[j - 1, i] == -1) || (alg isa CMINPACK && N > 32) ||
421422
(alg isa KINSOL && N > 64) ||
422423
(alg isa NLsolveJL && N > 64 && alg.method == :trust_region) ||
423-
(alg isa GeneralizedFirstOrderAlgorithm{nothing, :TrustRegion} && N > 64)
424+
(alg isa GeneralizedFirstOrderAlgorithm{nothing, :TrustRegion} && N > 64) ||
425+
(alg isa NLsolveJL && N > 128 && alg.method == :newton) ||
426+
(alg isa GeneralizedFirstOrderAlgorithm{nothing, :NewtonRaphson} && N > 128 && ptype == :none) ||
427+
(alg isa GeneralizedFirstOrderAlgorithm{nothing, :NewtonRaphson} && N > 150 && ptype == :approx)
424428
# The last benchmark failed so skip this too
425429
runtimes_scaling[j, i] = NaN
426430
@warn "$(name): Would Have Timed out"
@@ -717,12 +721,7 @@ fig = begin
717721
end
718722
```
719723

720-
```
721-
Error: BoundsError: attempt to access 9-element Vector{NamedTuple{(:pkg, :n
722-
ame, :alg)}} at index [[3, 8, 1, 6, 4, 7, 2, 5, 27127150881566736]]
723-
```
724-
725-
724+
![](figures/bruss_12_1.png)
726725

727726
```julia
728727
save("brusselator_krylov_methods_scaling.svg", fig)
@@ -947,7 +946,7 @@ Environment:
947946
Package Information:
948947

949948
```
950-
Status `/cache/build/exclusive-amdci3-0/julialang/scimlbenchmarks-dot-jl/benchmarks/NonlinearProblem/Project.toml`
949+
Status `/cache/build/exclusive-amdci1-0/julialang/scimlbenchmarks-dot-jl/benchmarks/NonlinearProblem/Project.toml`
951950
[2169fc97] AlgebraicMultigrid v0.6.0
952951
[6e4b80f9] BenchmarkTools v1.5.0
953952
[13f3f980] CairoMakie v0.11.9
@@ -977,7 +976,7 @@ Info Packages marked with ⌃ have new versions available and may be upgradable.
977976
And the full manifest:
978977

979978
```
980-
Status `/cache/build/exclusive-amdci3-0/julialang/scimlbenchmarks-dot-jl/benchmarks/NonlinearProblem/Manifest.toml`
979+
Status `/cache/build/exclusive-amdci1-0/julialang/scimlbenchmarks-dot-jl/benchmarks/NonlinearProblem/Manifest.toml`
981980
⌃ [47edcb42] ADTypes v0.2.6
982981
[a4c015fc] ANSIColoredPrinters v0.0.1
983982
[621f4979] AbstractFFTs v1.5.0
@@ -1052,7 +1051,7 @@ Status `/cache/build/exclusive-amdci3-0/julialang/scimlbenchmarks-dot-jl/benchma
10521051
[7034ab61] FastBroadcast v0.2.8
10531052
[9aa1b823] FastClosures v0.3.2
10541053
[29a986be] FastLapackInterface v2.0.2
1055-
[5789e2e9] FileIO v1.16.2
1054+
[5789e2e9] FileIO v1.16.2
10561055
[8fc22ac5] FilePaths v0.8.3
10571056
[48062228] FilePathsBase v0.9.21
10581057
[1a297f60] FillArrays v1.9.3
@@ -1073,7 +1072,7 @@ Status `/cache/build/exclusive-amdci3-0/julialang/scimlbenchmarks-dot-jl/benchma
10731072
⌃ [3955a311] GridLayoutBase v0.10.0
10741073
[42e2da0e] Grisu v1.0.2
10751074
[708ec375] Gumbo v0.8.2
1076-
[cd3eb016] HTTP v1.10.3
1075+
[cd3eb016] HTTP v1.10.3
10771076
[eafb193a] Highlights v0.5.2
10781077
[3e5b6fbb] HostCPUFeatures v0.1.16
10791078
[34004b35] HypergeometricFunctions v0.3.23
@@ -1195,7 +1194,7 @@ Status `/cache/build/exclusive-amdci3-0/julialang/scimlbenchmarks-dot-jl/benchma
11951194
[94e857df] SIMDTypes v0.1.0
11961195
[476501e8] SLEEFPirates v0.6.42
11971196
[322a6be2] Sass v0.2.0
1198-
[0bca4576] SciMLBase v2.29.0
1197+
[0bca4576] SciMLBase v2.29.0
11991198
[31c91b34] SciMLBenchmarks v0.1.3
12001199
[c0aeaf25] SciMLOperators v0.3.8
12011200
[6c6a2e73] Scratch v1.2.1
1.54 KB
Loading
379 Bytes
Loading
5.73 KB
Loading
1.24 KB
Loading

script/NonlinearProblem/bruss.jl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@ function get_ordering(x::AbstractMatrix)
129129
idxs = Vector{Int}(undef, size(x, 1))
130130
placed = zeros(Bool, size(x, 1))
131131
idx = 1
132-
for i in size(x, 2):-1:1
133-
col = view(x, :, i)
134-
idxs_col = sortperm(col; by = x -> isnan(x) ? Inf : (x == -1 ? Inf : x))
135-
for j in idxs_col
136-
if !placed[j] && !isnan(col[j]) && col[j] -1
137-
idxs[j] = idx
132+
for j in size(x, 2):-1:1
133+
row = view(x, :, j)
134+
idxs_row = sortperm(row; by = x -> isnan(x) ? Inf : (x == -1 ? Inf : x))
135+
for i in idxs_row
136+
if !placed[i] && !isnan(row[i]) && row[i] -1
137+
idxs[idx] = i
138+
placed[i] = true
138139
idx += 1
139-
placed[j] = true
140+
idx > length(idxs) && break
140141
end
141142
end
142143
idx > length(idxs) && break
@@ -190,7 +191,7 @@ for (i, N) in enumerate(Ns)
190191
bruss_f!, u0 = (du, u) -> test_problem.f(du, u, test_problem.p), test_problem.u0
191192
y = similar(u0)
192193
for (j, (sd, adtype)) in enumerate(algs)
193-
if N < 2^8 || (N 2^8 && sd isa SymbolicsSparsityDetection)
194+
if N < 2^9 || (N 2^9 && sd isa SymbolicsSparsityDetection)
194195
times[i, j] = @belapsed $cache_and_compute_10_jacobians($adtype, $sd, $bruss_f!, $y, $u0)
195196
@info times[i, j]
196197
else
@@ -217,7 +218,7 @@ fig = begin
217218
colormap = :seaborn_bright, strokewidth = 3)
218219

219220
ax = Axis(fig[1, 2]; title = "Scaling of Sparse Jacobian Computation Algorithms",
220-
titlesize = 22, titlegap = 10, xscale = log2, yscale = log2,
221+
titlesize = 22, titlegap = 10, xscale = log10, yscale = log10,
221222
xticksize = 20, yticksize = 20, xticklabelsize = 20, yticklabelsize = 20,
222223
xtickwidth = 2.5, ytickwidth = 2.5, spinewidth = 2.5,
223224
xlabel = L"Input Dimension ($\mathbf{N}$)", ylabel = L"Time $\mathbf{(s)}$", xlabelsize = 22,
@@ -305,7 +306,7 @@ end
305306
save("brusselator_sparse_jacobian_scaling.svg", fig)
306307

307308

308-
Ns = 2 .^ (2:7)
309+
Ns = vcat(collect(2 .^ (2:7)), [150, 175, 200])
309310

310311
solvers_scaling = [
311312
(; pkg = :nonlinearsolve, sparsity = :none, name = "NR (Dense)", alg = NewtonRaphson(; linsolve = nothing)),
@@ -349,7 +350,10 @@ for (i, N) in enumerate(Ns)
349350
if (j > 1 && runtimes_scaling[j - 1, i] == -1) || (alg isa CMINPACK && N > 32) ||
350351
(alg isa KINSOL && N > 64) ||
351352
(alg isa NLsolveJL && N > 64 && alg.method == :trust_region) ||
352-
(alg isa GeneralizedFirstOrderAlgorithm{nothing, :TrustRegion} && N > 64)
353+
(alg isa GeneralizedFirstOrderAlgorithm{nothing, :TrustRegion} && N > 64) ||
354+
(alg isa NLsolveJL && N > 128 && alg.method == :newton) ||
355+
(alg isa GeneralizedFirstOrderAlgorithm{nothing, :NewtonRaphson} && N > 128 && ptype == :none) ||
356+
(alg isa GeneralizedFirstOrderAlgorithm{nothing, :NewtonRaphson} && N > 150 && ptype == :approx)
353357
# The last benchmark failed so skip this too
354358
runtimes_scaling[j, i] = NaN
355359
@warn "$(name): Would Have Timed out"

0 commit comments

Comments
 (0)