Skip to content

Commit 8ac423f

Browse files
committed
test: standardize testing
1 parent 31c9569 commit 8ac423f

File tree

10 files changed

+54
-55
lines changed

10 files changed

+54
-55
lines changed

.buildkite/pipeline.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,4 @@ steps:
3030
env:
3131
GROUP: CUDA
3232
JULIA_PKG_SERVER: "" # it often struggles with our large artifacts
33-
RETESTITEMS_NWORKERS: 4
34-
RETESTITEMS_NWORKER_THREADS: 2
3533
SECRET_CODECOV_TOKEN: "HC7K/ymhi62KUQ5OLU4DOl+11gaQt4JhXX/2nfTGlTsBB8mEMxQ8R+sHIp/2HjEup5eSXAN2IWQDQ7RDBuQvVp0T1UVtr2e4YNZFztKnsJXrFO15hXxYShJodI//X/8DzhlQd/lyTDOAOJu3eznsc3sC2CUgJzXZxLUtQN9YaZ1i3a+NoN1mO5UpkkHVhXigwF5gjy+0tei8fCdcP+SIhG0EanS5yd9q/SurtCpMHsHyUG97+ZVPglSKgdaqr31+PdmiPJ+ynp4+Hnc/esosxUSHSIL+ryRTO+28RNwPTiNf99J51RJLQmz1knWTR1ky6tiYIZ5218O6wvNil0SqNw==;U2FsdGVkX18nBY3t4LZYlEIz3EVKjpqCd994JNeJGt006up+sAjXEssI0tgCVXnfXsenVsP3NCCEoOS1GXc44g=="

.github/workflows/CI_NonlinearSolve.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
version:
3636
- "min"
3737
- "1"
38-
- "pre"
3938
os:
4039
- ubuntu-latest
4140
- macos-latest
@@ -70,8 +69,6 @@ jobs:
7069
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
7170
env:
7271
GROUP: ${{ matrix.group }}
73-
RETESTITEMS_NWORKERS: 4
74-
RETESTITEMS_NWORKER_THREADS: 2
7572
- uses: julia-actions/julia-processcoverage@v1
7673
with:
7774
directories: src,ext

.github/workflows/CI_SciMLJacobianOperators.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
version:
2727
- "min"
2828
- "1"
29-
- "pre"
3029
os:
3130
- ubuntu-latest
3231
- macos-latest

.github/workflows/Downgrade.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,3 @@ jobs:
2626
skip: Pkg,TOML
2727
- uses: julia-actions/julia-buildpkg@v1
2828
- uses: julia-actions/julia-runtest@v1
29-
env:
30-
JULIA_NUM_THREADS: 11
31-
RETESTITEMS_NWORKERS: 4
32-
RETESTITEMS_NWORKER_THREADS: 2

.github/workflows/Downstream.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ jobs:
5555
@info "Not compatible with this release. No problem." exception=err
5656
exit(0) # Exit immediately, as a success
5757
end
58-
env:
59-
RETESTITEMS_NWORKERS: 4
60-
RETESTITEMS_NWORKER_THREADS: 2
6158
- uses: julia-actions/julia-processcoverage@v1
6259
with:
6360
directories: src,ext

Project.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ FastLevenbergMarquardt = "0.1"
7474
FiniteDiff = "2.22"
7575
FixedPointAcceleration = "0.3"
7676
ForwardDiff = "0.10.36"
77+
Hwloc = "3"
7778
LazyArrays = "1.8.2, 2"
7879
LeastSquaresOptim = "0.8.5"
7980
LineSearches = "7.2"
@@ -121,6 +122,8 @@ Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
121122
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
122123
FastLevenbergMarquardt = "7a0df574-e128-4d35-8cbd-3d84502bf7ce"
123124
FixedPointAcceleration = "817d07cb-a79a-5c30-9a31-890123675176"
125+
Hwloc = "0e44f5e4-bd66-52a0-8798-143a42290a1d"
126+
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
124127
LeastSquaresOptim = "0fc2ff8b-aaa3-5acd-a817-1944a5e08891"
125128
MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
126129
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
@@ -142,4 +145,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
142145
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
143146

144147
[targets]
145-
test = ["Aqua", "BandedMatrices", "BenchmarkTools", "CUDA", "Enzyme", "ExplicitImports", "FastLevenbergMarquardt", "FixedPointAcceleration", "LeastSquaresOptim", "MINPACK", "ModelingToolkit", "NLSolvers", "NLsolve", "NaNMath", "NonlinearProblemLibrary", "OrdinaryDiffEq", "Pkg", "Random", "ReTestItems", "SIAMFANLEquations", "SpeedMapping", "StableRNGs", "StaticArrays", "Sundials", "Symbolics", "Test", "Zygote"]
148+
test = ["Aqua", "BandedMatrices", "BenchmarkTools", "CUDA", "Enzyme", "ExplicitImports", "FastLevenbergMarquardt", "FixedPointAcceleration", "Hwloc", "InteractiveUtils", "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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ end
122122
test_on_library(problems, dicts, alg_ops, broken_tests, Sys.isapple() ? 1e-3 : 1e-4)
123123
end
124124

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

128128
broken_tests = Dict(alg => Int[] for alg in alg_ops)

test/core/rootfind_tests.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ end
5252

5353
# --- NewtonRaphson tests ---
5454

55-
@testitem "NewtonRaphson" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
55+
@testitem "NewtonRaphson" setup=[CoreRootfindTesting] tags=[:core] begin
5656
@testset "LineSearch: $(_nameof(lsmethod)) LineSearch AD: $(_nameof(ad))" for lsmethod in (
5757
Static(), StrongWolfe(), BackTracking(), HagerZhang(), MoreThuente()),
5858
ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff())
@@ -118,7 +118,7 @@ end
118118

119119
# --- TrustRegion tests ---
120120

121-
@testitem "TrustRegion" setup=[CoreRootfindTesting] tags=[:core] skip=:(Sys.isapple()) timeout=3600 begin
121+
@testitem "TrustRegion" setup=[CoreRootfindTesting] tags=[:core] begin
122122
radius_update_schemes = [RadiusUpdateSchemes.Simple, RadiusUpdateSchemes.NocedalWright,
123123
RadiusUpdateSchemes.NLsolve, RadiusUpdateSchemes.Hei,
124124
RadiusUpdateSchemes.Yuan, RadiusUpdateSchemes.Fan, RadiusUpdateSchemes.Bastin]
@@ -236,7 +236,7 @@ end
236236

237237
# --- LevenbergMarquardt tests ---
238238

239-
@testitem "LevenbergMarquardt" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
239+
@testitem "LevenbergMarquardt" setup=[CoreRootfindTesting] tags=[:core] begin
240240
u0s = ([1.0, 1.0], @SVector[1.0, 1.0], 1.0)
241241
@testset "[OOP] u0: $(typeof(u0))" for u0 in u0s
242242
sol = benchmark_nlsolve_oop(quadratic_f, u0; solver = LevenbergMarquardt())
@@ -322,7 +322,7 @@ end
322322

323323
# --- DFSane tests ---
324324

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

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

394394
# --- PseudoTransient tests ---
395395

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

463463
# --- Broyden tests ---
464464

465-
@testitem "Broyden" setup=[CoreRootfindTesting] tags=[:core] skip=:(Sys.isapple()) timeout=3600 begin
465+
@testitem "Broyden" setup=[CoreRootfindTesting] tags=[:core] begin
466466
@testset "LineSearch: $(_nameof(lsmethod)) LineSearch AD: $(_nameof(ad)) Init Jacobian: $(init_jacobian) Update Rule: $(update_rule)" for lsmethod in (
467467
Static(), StrongWolfe(), BackTracking(),
468468
HagerZhang(), MoreThuente(), LiFukushimaLineSearch()),
@@ -512,7 +512,7 @@ end
512512

513513
# --- Klement tests ---
514514

515-
@testitem "Klement" setup=[CoreRootfindTesting] tags=[:core] skip=:(Sys.isapple()) timeout=3600 begin
515+
@testitem "Klement" setup=[CoreRootfindTesting] tags=[:core] begin
516516
@testset "LineSearch: $(_nameof(lsmethod)) LineSearch AD: $(_nameof(ad)) Init Jacobian: $(init_jacobian)" for lsmethod in (
517517
Static(), StrongWolfe(), BackTracking(), HagerZhang(), MoreThuente()),
518518
ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()),
@@ -561,7 +561,7 @@ end
561561

562562
# --- LimitedMemoryBroyden tests ---
563563

564-
@testitem "LimitedMemoryBroyden" setup=[CoreRootfindTesting] tags=[:core] skip=:(Sys.isapple()) timeout=3600 begin
564+
@testitem "LimitedMemoryBroyden" setup=[CoreRootfindTesting] tags=[:core] begin
565565
@testset "LineSearch: $(_nameof(lsmethod)) LineSearch AD: $(_nameof(ad))" for lsmethod in (
566566
Static(), StrongWolfe(), BackTracking(),
567567
HagerZhang(), MoreThuente(), LiFukushimaLineSearch()),
@@ -611,7 +611,7 @@ end
611611
end
612612

613613
# Miscellaneous Tests
614-
@testitem "Custom JVP" setup=[CoreRootfindTesting] tags=[:core] timeout=3600 begin
614+
@testitem "Custom JVP" setup=[CoreRootfindTesting] tags=[:core] begin
615615
function F(u::Vector{Float64}, p::Vector{Float64})
616616
Δ = Tridiagonal(-ones(99), 2 * ones(100), -ones(99))
617617
return u + 0.1 * u .* Δ * u - p

test/gpu/core_tests.jl

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

4-
CUDA.allowscalar(false)
4+
if CUDA.functional()
5+
CUDA.allowscalar(false)
56

6-
A = cu(rand(StableRNG(0), 4, 4))
7-
u0 = cu(rand(StableRNG(0), 4))
8-
b = cu(rand(StableRNG(0), 4))
7+
A = cu(rand(StableRNG(0), 4, 4))
8+
u0 = cu(rand(StableRNG(0), 4))
9+
b = cu(rand(StableRNG(0), 4))
910

10-
linear_f(du, u, p) = (du .= A * u .+ b)
11+
linear_f(du, u, p) = (du .= A * u .+ b)
1112

12-
prob = NonlinearProblem(linear_f, u0)
13+
prob = NonlinearProblem(linear_f, u0)
1314

14-
SOLVERS = (NewtonRaphson(), LevenbergMarquardt(; linsolve = QRFactorization()),
15-
LevenbergMarquardt(; linsolve = KrylovJL_GMRES()), PseudoTransient(),
16-
Klement(), Broyden(; linesearch = LiFukushimaLineSearch()),
17-
LimitedMemoryBroyden(; threshold = 2, linesearch = LiFukushimaLineSearch()),
18-
DFSane(), TrustRegion(; linsolve = QRFactorization()),
19-
TrustRegion(; linsolve = KrylovJL_GMRES(), concrete_jac = true), # Needed if Zygote not loaded
20-
nothing)
15+
SOLVERS = (NewtonRaphson(), LevenbergMarquardt(; linsolve = QRFactorization()),
16+
LevenbergMarquardt(; linsolve = KrylovJL_GMRES()), PseudoTransient(),
17+
Klement(), Broyden(; linesearch = LiFukushimaLineSearch()),
18+
LimitedMemoryBroyden(; threshold = 2, linesearch = LiFukushimaLineSearch()),
19+
DFSane(), TrustRegion(; linsolve = QRFactorization()),
20+
TrustRegion(; linsolve = KrylovJL_GMRES(), concrete_jac = true), # Needed if Zygote not loaded
21+
nothing)
2122

22-
@testset "[IIP] GPU Solvers" begin
23-
for alg in SOLVERS
24-
@test_nowarn sol = solve(prob, alg; abstol = 1.0f-5, reltol = 1.0f-5)
23+
@testset "[IIP] GPU Solvers" begin
24+
for alg in SOLVERS
25+
@test_nowarn sol = solve(prob, alg; abstol = 1.0f-5, reltol = 1.0f-5)
26+
end
2527
end
26-
end
2728

28-
linear_f(u, p) = A * u .+ b
29+
linear_f(u, p) = A * u .+ b
2930

30-
prob = NonlinearProblem{false}(linear_f, u0)
31+
prob = NonlinearProblem{false}(linear_f, u0)
3132

32-
@testset "[OOP] GPU Solvers" begin
33-
for alg in SOLVERS
34-
@test_nowarn sol = solve(prob, alg; abstol = 1.0f-5, reltol = 1.0f-5)
33+
@testset "[OOP] GPU Solvers" begin
34+
for alg in SOLVERS
35+
@test_nowarn sol = solve(prob, alg; abstol = 1.0f-5, reltol = 1.0f-5)
36+
end
3537
end
3638
end
3739
end

test/runtests.jl

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
using ReTestItems, CUDA
1+
using ReTestItems, NonlinearSolve, Hwloc, InteractiveUtils
22

3-
const GROUP = get(ENV, "GROUP", CUDA.functional() ? "All" : "All")
3+
@info sprint(InteractiveUtils.versioninfo)
44

5-
if GROUP == "All"
6-
ReTestItems.runtests(@__DIR__)
7-
else
8-
tags = [Symbol(lowercase(GROUP))]
9-
ReTestItems.runtests(@__DIR__; tags)
10-
end
5+
const GROUP = lowercase(get(ENV, "GROUP", "All"))
6+
7+
const RETESTITEMS_NWORKERS = parse(
8+
Int, get(ENV, "RETESTITEMS_NWORKERS", string(min(Hwloc.num_physical_cores(), 4))))
9+
const RETESTITEMS_NWORKER_THREADS = parse(Int,
10+
get(ENV, "RETESTITEMS_NWORKER_THREADS",
11+
string(max(Hwloc.num_virtual_cores() ÷ RETESTITEMS_NWORKERS, 1))))
12+
13+
@info "Running tests for group: $LUXLIB_TEST_GROUP with $RETESTITEMS_NWORKERS workers"
14+
15+
ReTestItems.runtests(NonlinearSolve; tags = (GROUP == "all" ? nothing : [Symbol(GROUP)]),
16+
nworkers = RETESTITEMS_NWORKERS,
17+
nworker_threads = RETESTITEMS_NWORKER_THREADS, testitem_timeout = 3600, retries=4)

0 commit comments

Comments
 (0)