Skip to content

Commit cfd0d2c

Browse files
committed
Use tags
1 parent b040693 commit cfd0d2c

21 files changed

+132
-120
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ steps:
1818
if: build.message !~ /\[skip tests\]/
1919

2020
env:
21-
GROUP: GPU
21+
GROUP: CUDA
2222
JULIA_PKG_SERVER: "" # it often struggles with our large artifacts
2323
RETESTITEMS_NWORKERS: 4
2424
RETESTITEMS_NWORKER_THREADS: 2

.github/workflows/CI.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
group:
2121
- Core
2222
- Downstream
23+
- Misc
24+
- Wrappers
2325
version:
2426
- "1"
2527
os:

Project.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ LazyArrays = "1.8.2"
7676
LeastSquaresOptim = "0.8.5"
7777
LineSearches = "7.2"
7878
LinearAlgebra = "1.10"
79-
LinearSolve = "2.29"
79+
LinearSolve = "2.30"
8080
MINPACK = "1.2"
8181
MaybeInplace = "0.1.1"
82+
ModelingToolkit = "9.13.0"
8283
NLSolvers = "0.5"
8384
NLsolve = "4.5"
8485
NaNMath = "1"
@@ -89,11 +90,10 @@ PrecompileTools = "1.2"
8990
Preferences = "1.4"
9091
Printf = "1.10"
9192
Random = "1.91"
92-
ReTestItems = "1"
93+
ReTestItems = "1.24"
9394
RecursiveArrayTools = "3.8"
9495
Reexport = "1.2"
9596
SIAMFANLEquations = "1.0.1"
96-
SafeTestsets = "0.1"
9797
SciMLBase = "2.34.0"
9898
SimpleNonlinearSolve = "1.8"
9999
SparseArrays = "1.10"
@@ -104,7 +104,7 @@ StaticArrays = "1.9"
104104
StaticArraysCore = "1.4"
105105
Sundials = "4.23.1"
106106
SymbolicIndexingInterface = "0.3.15"
107-
Symbolics = "5.13"
107+
Symbolics = "5.26"
108108
Test = "1.10"
109109
TimerOutputs = "0.5.23"
110110
Zygote = "0.6.69"
@@ -130,7 +130,6 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
130130
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
131131
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
132132
SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4"
133-
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
134133
SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412"
135134
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
136135
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
@@ -140,4 +139,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
140139
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
141140

142141
[targets]
143-
test = ["Aqua", "BandedMatrices", "BenchmarkTools", "CUDA", "Enzyme", "FastLevenbergMarquardt", "FixedPointAcceleration", "LeastSquaresOptim", "MINPACK", "ModelingToolkit", "NLSolvers", "NLsolve", "NaNMath", "NonlinearProblemLibrary", "OrdinaryDiffEq", "Pkg", "Random", "ReTestItems", "SIAMFANLEquations", "SafeTestsets", "SparseDiffTools", "SpeedMapping", "StableRNGs", "StaticArrays", "Sundials", "Symbolics", "Test", "Zygote"]
142+
test = ["Aqua", "BandedMatrices", "BenchmarkTools", "CUDA", "Enzyme", "FastLevenbergMarquardt", "FixedPointAcceleration", "LeastSquaresOptim", "MINPACK", "ModelingToolkit", "NLSolvers", "NLsolve", "NaNMath", "NonlinearProblemLibrary", "OrdinaryDiffEq", "Pkg", "Random", "ReTestItems", "SIAMFANLEquations", "SpeedMapping", "StableRNGs", "StaticArrays", "Sundials", "Symbolics", "Test", "Zygote"]

test/core/23_test_problems_tests.jl

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ end
4040
export test_on_library, problems, dicts
4141
end
4242

43-
@testitem "PolyAlgorithms" setup=[RobustnessTesting] begin
43+
@testitem "PolyAlgorithms" setup=[RobustnessTesting] tags=[:core] begin
4444
alg_ops = (RobustMultiNewton(), FastShortcutNonlinearPolyalg())
4545

4646
broken_tests = Dict(alg => Int[] for alg in alg_ops)
@@ -50,7 +50,7 @@ end
5050
test_on_library(problems, dicts, alg_ops, broken_tests)
5151
end
5252

53-
@testitem "NewtonRaphson" setup=[RobustnessTesting] begin
53+
@testitem "NewtonRaphson" setup=[RobustnessTesting] tags=[:core] begin
5454
alg_ops = (NewtonRaphson(),)
5555

5656
broken_tests = Dict(alg => Int[] for alg in alg_ops)
@@ -59,7 +59,7 @@ end
5959
test_on_library(problems, dicts, alg_ops, broken_tests)
6060
end
6161

62-
@testitem "TrustRegion" setup=[RobustnessTesting] begin
62+
@testitem "TrustRegion" setup=[RobustnessTesting] tags=[:core] begin
6363
alg_ops = (TrustRegion(; radius_update_scheme = RadiusUpdateSchemes.Simple),
6464
TrustRegion(; radius_update_scheme = RadiusUpdateSchemes.Fan),
6565
TrustRegion(; radius_update_scheme = RadiusUpdateSchemes.Hei),
@@ -78,7 +78,7 @@ end
7878
test_on_library(problems, dicts, alg_ops, broken_tests)
7979
end
8080

81-
@testitem "LevenbergMarquardt" setup=[RobustnessTesting] begin
81+
@testitem "LevenbergMarquardt" setup=[RobustnessTesting] tags=[:core] begin
8282
using LinearSolve
8383

8484
alg_ops = (LevenbergMarquardt(), LevenbergMarquardt(; α_geodesic = 0.1),
@@ -92,7 +92,7 @@ end
9292
test_on_library(problems, dicts, alg_ops, broken_tests)
9393
end
9494

95-
@testitem "DFSane" setup=[RobustnessTesting] begin
95+
@testitem "DFSane" setup=[RobustnessTesting] tags=[:core] begin
9696
alg_ops = (DFSane(),)
9797

9898
broken_tests = Dict(alg => Int[] for alg in alg_ops)
@@ -101,21 +101,28 @@ end
101101
test_on_library(problems, dicts, alg_ops, broken_tests)
102102
end
103103

104-
@testitem "Broyden" setup=[RobustnessTesting] begin
104+
@testitem "Broyden" setup=[RobustnessTesting] tags=[:core] begin
105105
alg_ops = (Broyden(), Broyden(; init_jacobian = Val(:true_jacobian)),
106106
Broyden(; update_rule = Val(:bad_broyden)),
107107
Broyden(; init_jacobian = Val(:true_jacobian), update_rule = Val(:bad_broyden)))
108108

109109
broken_tests = Dict(alg => Int[] for alg in alg_ops)
110-
broken_tests[alg_ops[1]] = [1, 5, 11, 15]
111-
broken_tests[alg_ops[2]] = [1, 5, 8, 11, 18]
112-
broken_tests[alg_ops[3]] = [1, 5, 9, 11]
113-
broken_tests[alg_ops[4]] = [5, 6, 8, 11]
110+
if Sys.isapple()
111+
broken_tests[alg_ops[1]] = [1, 5, 11]
112+
broken_tests[alg_ops[2]] = [1, 5, 8, 11, 18]
113+
broken_tests[alg_ops[3]] = [1, 5, 6, 9, 11]
114+
broken_tests[alg_ops[4]] = [5, 6, 8, 11]
115+
else
116+
broken_tests[alg_ops[1]] = [1, 5, 11, 15]
117+
broken_tests[alg_ops[2]] = [1, 5, 8, 11, 18]
118+
broken_tests[alg_ops[3]] = [1, 5, 9, 11]
119+
broken_tests[alg_ops[4]] = [5, 6, 8, 11]
120+
end
114121

115-
test_on_library(problems, dicts, alg_ops, broken_tests)
122+
test_on_library(problems, dicts, alg_ops, broken_tests, Sys.isapple() ? 1e-3 : 1e-4)
116123
end
117124

118-
@testitem "Klement" retries=5 setup=[RobustnessTesting] begin
125+
@testitem "Klement" retries=5 setup=[RobustnessTesting] tags=[:core] begin
119126
alg_ops = (Klement(), Klement(; init_jacobian = Val(:true_jacobian_diagonal)))
120127

121128
broken_tests = Dict(alg => Int[] for alg in alg_ops)
@@ -125,7 +132,7 @@ end
125132
test_on_library(problems, dicts, alg_ops, broken_tests)
126133
end
127134

128-
@testitem "PseudoTransient" setup=[RobustnessTesting] begin
135+
@testitem "PseudoTransient" setup=[RobustnessTesting] tags=[:core] begin
129136
# PT relies on the root being a stable equilibrium for convergence, so it won't work on
130137
# most problems
131138
alg_ops = (PseudoTransient(),)

test/core/forward_ad_tests.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ __compatible(::KINSOL, ::Val{:oop_cache}) = false
6262
export test_f!, test_f, jacobian_f, solve_with, __compatible
6363
end
6464

65-
@testitem "ForwardDiff.jl Integration" setup=[ForwardADTesting] begin
65+
@testitem "ForwardDiff.jl Integration" setup=[ForwardADTesting] tags=[:core] begin
6666
for alg in (NewtonRaphson(), TrustRegion(), LevenbergMarquardt(),
6767
PseudoTransient(; alpha_initial = 10.0), Broyden(), Klement(), DFSane(),
6868
nothing, NLsolveJL(), CMINPACK(), KINSOL(; globalization_strategy = :LineSearch))
6969
us = (2.0, @SVector[1.0, 1.0], [1.0, 1.0], ones(2, 2), @SArray ones(2, 2))
7070

71+
alg isa CMINPACK && Sys.isapple() && continue
72+
7173
@testset "Scalar AD" begin
7274
for p in 1.0:0.1:100.0, u0 in us, mode in (:iip, :oop, :iip_cache, :oop_cache)
7375
__compatible(u0, alg) || continue

test/core/nlls_tests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ end
4848
export solvers, θ_init, x, y_target, true_function, θ_true, loss_function
4949
end
5050

51-
@testitem "General NLLS Solvers" setup=[CoreNLLSTesting] begin
51+
@testitem "General NLLS Solvers" setup=[CoreNLLSTesting] tags=[:core] begin
5252
prob_oop = NonlinearLeastSquaresProblem{false}(loss_function, θ_init, x)
5353
prob_iip = NonlinearLeastSquaresProblem(
5454
NonlinearFunction(loss_function; resid_prototype = zero(y_target)), θ_init, x)
@@ -62,7 +62,7 @@ end
6262
end
6363
end
6464

65-
@testitem "Custom VJP" setup=[CoreNLLSTesting] begin
65+
@testitem "Custom VJP" setup=[CoreNLLSTesting] tags=[:core] begin
6666
# This is just for testing that we can use vjp provided by the user
6767
function vjp(v, θ, p)
6868
resid = zeros(length(p))
@@ -96,7 +96,7 @@ end
9696
end
9797
end
9898

99-
@testitem "NLLS Analytic Jacobian" begin
99+
@testitem "NLLS Analytic Jacobian" tags=[:core] begin
100100
dataIn = 1:10
101101
f(x, p) = x[1] * dataIn .^ 2 .+ x[2] * dataIn .+ x[3]
102102
dataOut = f([1, 2, 3], nothing) + 0.1 * randn(10, 1)

test/core/rootfind_tests.jl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function newton_fails(u, p)
2020
end
2121

2222
const TERMINATION_CONDITIONS = [
23-
SteadyStateDiffEqTerminationMode(), SimpleNonlinearSolveTerminationMode(),
2423
NormTerminationMode(), RelTerminationMode(), RelNormTerminationMode(),
2524
AbsTerminationMode(), AbsNormTerminationMode(), RelSafeTerminationMode(),
2625
AbsSafeTerminationMode(), RelSafeBestTerminationMode(), AbsSafeBestTerminationMode()]
@@ -53,7 +52,7 @@ end
5352

5453
# --- NewtonRaphson tests ---
5554

56-
@testitem "NewtonRaphson" setup=[CoreRootfindTesting] begin
55+
@testitem "NewtonRaphson" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
5756
@testset "LineSearch: $(_nameof(lsmethod)) LineSearch AD: $(_nameof(ad))" for lsmethod in (
5857
Static(), StrongWolfe(), BackTracking(), HagerZhang(), MoreThuente()),
5958
ad in (AutoFiniteDiff(), AutoZygote())
@@ -119,7 +118,7 @@ end
119118

120119
# --- TrustRegion tests ---
121120

122-
@testitem "TrustRegion" setup=[CoreRootfindTesting] begin
121+
@testitem "TrustRegion" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
123122
radius_update_schemes = [RadiusUpdateSchemes.Simple, RadiusUpdateSchemes.NocedalWright,
124123
RadiusUpdateSchemes.NLsolve, RadiusUpdateSchemes.Hei,
125124
RadiusUpdateSchemes.Yuan, RadiusUpdateSchemes.Fan, RadiusUpdateSchemes.Bastin]
@@ -237,7 +236,7 @@ end
237236

238237
# --- LevenbergMarquardt tests ---
239238

240-
@testitem "LevenbergMarquardt" setup=[CoreRootfindTesting] begin
239+
@testitem "LevenbergMarquardt" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
241240
u0s = ([1.0, 1.0], @SVector[1.0, 1.0], 1.0)
242241
@testset "[OOP] u0: $(typeof(u0))" for u0 in u0s
243242
sol = benchmark_nlsolve_oop(quadratic_f, u0; solver = LevenbergMarquardt())
@@ -323,7 +322,7 @@ end
323322

324323
# --- DFSane tests ---
325324

326-
@testitem "DFSane" setup=[CoreRootfindTesting] begin
325+
@testitem "DFSane" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
327326
u0s = ([1.0, 1.0], @SVector[1.0, 1.0], 1.0)
328327

329328
@testset "[OOP] u0: $(typeof(u0))" for u0 in u0s
@@ -394,7 +393,7 @@ end
394393

395394
# --- PseudoTransient tests ---
396395

397-
@testitem "PseudoTransient" setup=[CoreRootfindTesting] begin
396+
@testitem "PseudoTransient" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
398397
# These are tests for NewtonRaphson so we should set alpha_initial to be high so that we
399398
# converge quickly
400399
@testset "PT: alpha_initial = 10.0 PT AD: $(ad)" for ad in (
@@ -463,7 +462,7 @@ end
463462

464463
# --- Broyden tests ---
465464

466-
@testitem "Broyden" setup=[CoreRootfindTesting] begin
465+
@testitem "Broyden" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
467466
@testset "LineSearch: $(_nameof(lsmethod)) LineSearch AD: $(_nameof(ad)) Init Jacobian: $(init_jacobian) Update Rule: $(update_rule)" for lsmethod in (
468467
Static(), StrongWolfe(), BackTracking(),
469468
HagerZhang(), MoreThuente(), LiFukushimaLineSearch()),
@@ -513,7 +512,7 @@ end
513512

514513
# --- Klement tests ---
515514

516-
@testitem "Klement" setup=[CoreRootfindTesting] begin
515+
@testitem "Klement" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
517516
@testset "LineSearch: $(_nameof(lsmethod)) LineSearch AD: $(_nameof(ad)) Init Jacobian: $(init_jacobian)" for lsmethod in (
518517
Static(), StrongWolfe(), BackTracking(), HagerZhang(), MoreThuente()),
519518
ad in (AutoFiniteDiff(), AutoZygote()),
@@ -562,7 +561,7 @@ end
562561

563562
# --- LimitedMemoryBroyden tests ---
564563

565-
@testitem "LimitedMemoryBroyden" setup=[CoreRootfindTesting] begin
564+
@testitem "LimitedMemoryBroyden" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
566565
@testset "LineSearch: $(_nameof(lsmethod)) LineSearch AD: $(_nameof(ad))" for lsmethod in (
567566
Static(), StrongWolfe(), BackTracking(),
568567
HagerZhang(), MoreThuente(), LiFukushimaLineSearch()),
@@ -612,7 +611,7 @@ end
612611
end
613612

614613
# Miscellaneous Tests
615-
@testitem "Custom JVP" setup=[CoreRootfindTesting] begin
614+
@testitem "Custom JVP" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
616615
function F(u::Vector{Float64}, p::Vector{Float64})
617616
Δ = Tridiagonal(-ones(99), 2 * ones(100), -ones(99))
618617
return u + 0.1 * u .* Δ * u - p
Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
1-
using ModelingToolkit, NonlinearSolve
2-
using ModelingToolkit: t_nounits as t
3-
4-
@parameters p d
5-
@variables X(t)
6-
eqs = [0 ~ sin(X + p) - d * sqrt(X + 1)]
7-
@mtkbuild nlsys = NonlinearSystem(eqs, [X], [p, d])
8-
9-
# Creates an integrator.
10-
nlprob = NonlinearProblem(nlsys, [X => 1.0], [p => 2.0, d => 3.0])
11-
12-
@testset "GeneralizedFirstOrderAlgorithmCache" begin
13-
nint = init(nlprob, NewtonRaphson())
14-
@test nint isa NonlinearSolve.GeneralizedFirstOrderAlgorithmCache
15-
16-
@test nint[X] == 1.0
17-
@test nint[nlsys.X] == 1.0
18-
@test nint[:X] == 1.0
19-
@test nint.ps[p] == 2.0
20-
@test nint.ps[nlsys.p] == 2.0
21-
@test nint.ps[:p] == 2.0
22-
end
23-
24-
@testset "NonlinearSolvePolyAlgorithmCache" begin
25-
nint = init(nlprob, FastShortcutNonlinearPolyalg())
26-
@test nint isa NonlinearSolve.NonlinearSolvePolyAlgorithmCache
27-
28-
@test nint[X] == 1.0
29-
@test nint[nlsys.X] == 1.0
30-
@test nint[:X] == 1.0
31-
@test nint.ps[p] == 2.0
32-
@test nint.ps[nlsys.p] == 2.0
33-
@test nint.ps[:p] == 2.0
34-
end
35-
36-
@testset "NonlinearSolveNoInitCache" begin
37-
nint = init(nlprob, SimpleNewtonRaphson())
38-
@test nint isa NonlinearSolve.NonlinearSolveNoInitCache
39-
40-
@test nint[X] == 1.0
41-
@test nint[nlsys.X] == 1.0
42-
@test nint[:X] == 1.0
43-
@test nint.ps[p] == 2.0
44-
@test nint.ps[nlsys.p] == 2.0
45-
@test nint.ps[:p] == 2.0
1+
@testitem "Modeling Toolkit Cache Indexing" tags=[:downstream] begin
2+
using ModelingToolkit
3+
using ModelingToolkit: t_nounits as t
4+
5+
@parameters p d
6+
@variables X(t)
7+
eqs = [0 ~ sin(X + p) - d * sqrt(X + 1)]
8+
@mtkbuild nlsys = NonlinearSystem(eqs, [X], [p, d])
9+
10+
# Creates an integrator.
11+
nlprob = NonlinearProblem(nlsys, [X => 1.0], [p => 2.0, d => 3.0])
12+
13+
@testset "GeneralizedFirstOrderAlgorithmCache" begin
14+
nint = init(nlprob, NewtonRaphson())
15+
@test nint isa NonlinearSolve.GeneralizedFirstOrderAlgorithmCache
16+
17+
@test nint[X] == 1.0
18+
@test nint[nlsys.X] == 1.0
19+
@test nint[:X] == 1.0
20+
@test nint.ps[p] == 2.0
21+
@test nint.ps[nlsys.p] == 2.0
22+
@test nint.ps[:p] == 2.0
23+
end
24+
25+
@testset "NonlinearSolvePolyAlgorithmCache" begin
26+
nint = init(nlprob, FastShortcutNonlinearPolyalg())
27+
@test nint isa NonlinearSolve.NonlinearSolvePolyAlgorithmCache
28+
29+
@test nint[X] == 1.0
30+
@test nint[nlsys.X] == 1.0
31+
@test nint[:X] == 1.0
32+
@test nint.ps[p] == 2.0
33+
@test nint.ps[nlsys.p] == 2.0
34+
@test nint.ps[:p] == 2.0
35+
end
36+
37+
@testset "NonlinearSolveNoInitCache" begin
38+
nint = init(nlprob, SimpleNewtonRaphson())
39+
@test nint isa NonlinearSolve.NonlinearSolveNoInitCache
40+
41+
@test nint[X] == 1.0
42+
@test nint[nlsys.X] == 1.0
43+
@test nint[:X] == 1.0
44+
@test nint.ps[p] == 2.0
45+
@test nint.ps[nlsys.p] == 2.0
46+
@test nint.ps[:p] == 2.0
47+
end
4648
end

test/gpu/core_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testitem "CUDA Tests" begin
1+
@testitem "CUDA Tests" tags=[:cuda] skip=:(using CUDA; !CUDA.functional()) begin
22
using CUDA, NonlinearSolve, LinearSolve, StableRNGs
33

44
CUDA.allowscalar(false)

test/misc/aliasing_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testitem "PolyAlgorithm Aliasing" begin
1+
@testitem "PolyAlgorithm Aliasing" tags=[:misc] begin
22
using NonlinearProblemLibrary
33

44
# Use a problem that the initial solvers cannot solve and cause the initial value to

0 commit comments

Comments
 (0)