Skip to content

Commit d9b3a96

Browse files
Merge pull request #820 from ChrisRackauckas-Claude/add-trim-tests
Add trim tests for LUFactorization, MKLLUFactorization, and RFLUFactorization
2 parents 5df1b29 + 286e9a6 commit d9b3a96

File tree

12 files changed

+228
-4
lines changed

12 files changed

+228
-4
lines changed

.github/workflows/Tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,17 @@ jobs:
3838
- "NoPre"
3939
- "LinearSolveAutotune"
4040
- "Preferences"
41+
- "Trim"
4142
os:
4243
- ubuntu-latest
4344
- macos-latest
4445
- windows-latest
46+
exclude:
47+
# Don't run trim tests on Julia versions below 1.12
48+
- group: Trim
49+
version: "lts"
50+
- group: Trim
51+
version: "pre"
4552
uses: "SciML/.github/.github/workflows/tests.yml@v1"
4653
with:
4754
group: "${{ matrix.group }}"

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
4141
FastAlmostBandedMatrices = "9d29842c-ecb8-4973-b1e9-a27b1157504e"
4242
FastLapackInterface = "29a986be-02c6-4525-aec4-84b980013641"
4343
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
44-
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
4544
HYPRE = "b5ffcf37-a2bd-41ab-a3da-4bd9bc8ad771"
4645
IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153"
4746
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
4847
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
4948
LAPACK_jll = "51474c39-65e3-53ba-86ba-03b1b862ec14"
5049
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
50+
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
5151
Pardiso = "46dd5b70-b6fb-5a00-ae2d-e8fea33afaf2"
5252
RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4"
5353
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
@@ -90,8 +90,8 @@ CUDSS = "0.4, 0.6.1"
9090
CUSOLVERRF = "0.2.6"
9191
ChainRulesCore = "1.25"
9292
CliqueTrees = "1.11.0"
93-
ConcreteStructs = "0.2.3"
9493
ComponentArrays = "0.15.29"
94+
ConcreteStructs = "0.2.3"
9595
DocStringExtensions = "0.9.3"
9696
EnumX = "1.0.4"
9797
EnzymeCore = "0.8.5"
@@ -129,8 +129,8 @@ RecursiveFactorization = "0.2.26"
129129
Reexport = "1.2.2"
130130
SafeTestsets = "0.1"
131131
SciMLBase = "2.70"
132-
SciMLOperators = "1.7.1"
133132
SciMLLogging = "1.3.1"
133+
SciMLOperators = "1.7.1"
134134
Setfield = "1.1.1"
135135
SparseArrays = "1.10"
136136
Sparspak = "0.3.9"
@@ -163,13 +163,13 @@ KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
163163
KrylovPreconditioners = "45d422c2-293f-44ce-8315-2cb988662dec"
164164
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
165165
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
166+
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
166167
MultiFloats = "bdf0d083-296b-4888-a5b6-7498122e68a5"
167168
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
168169
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
169170
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
170171
RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4"
171172
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
172-
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
173173
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
174174
Sparspak = "e56a9233-b9d6-4f03-8d0f-1825330902ac"
175175
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"

test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,10 @@ end
7373
if Base.Sys.islinux() && (GROUP == "All" || GROUP == "LinearSolveHYPRE") && HAS_EXTENSIONS
7474
@time @safetestset "LinearSolveHYPRE" include("hypretests.jl")
7575
end
76+
77+
if GROUP == "Trim" && VERSION >= v"1.12.0"
78+
Pkg.activate("trim")
79+
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
80+
Pkg.instantiate()
81+
@time @safetestset "Trim Tests" include("trim/runtests.jl")
82+
end

test/trim/Project.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name = "TrimTest"
2+
uuid = "e59a8f5e-4b8c-4d8e-9c8e-8e8e8e8e8e8e"
3+
version = "0.1.0"
4+
5+
[deps]
6+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
7+
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
8+
RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4"
9+
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
10+
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
11+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
12+
13+
[extras]
14+
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
15+
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
16+
17+
[targets]
18+
test = ["JET", "SafeTestsets"]
19+
20+
[compat]
21+
LinearSolve = "3"
22+
RecursiveFactorization = "0.2"
23+
SciMLBase = "2"
24+
StaticArrays = "1"
25+
julia = "1.10"

test/trim/linear_lu.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module TestLUFactorization
2+
using LinearSolve
3+
using LinearAlgebra
4+
using StaticArrays
5+
import SciMLBase
6+
7+
# Define a simple linear problem with a dense matrix
8+
const A_matrix = [4.0 1.0; 1.0 3.0]
9+
const b_vector = [1.0, 2.0]
10+
11+
const alg = LUFactorization()
12+
const prob = LinearProblem(A_matrix, b_vector)
13+
const cache = init(prob, alg)
14+
15+
function solve_linear(x)
16+
# Create a new problem with a modified b vector
17+
b_new = [x, 2.0 * x]
18+
reinit!(cache; b = b_new)
19+
sol = solve!(cache)
20+
return sol
21+
end
22+
end

test/trim/linear_mkl.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module TestMKLLUFactorization
2+
using LinearSolve
3+
using LinearAlgebra
4+
using StaticArrays
5+
import SciMLBase
6+
7+
# Define a simple linear problem with a dense matrix
8+
const A_matrix = [4.0 1.0; 1.0 3.0]
9+
const b_vector = [1.0, 2.0]
10+
11+
const alg = MKLLUFactorization()
12+
const prob = LinearProblem(A_matrix, b_vector)
13+
const cache = init(prob, alg)
14+
15+
function solve_linear(x)
16+
# Create a new problem with a modified b vector
17+
b_new = [x, 2.0 * x]
18+
reinit!(cache; b = b_new)
19+
sol = solve!(cache)
20+
return sol
21+
end
22+
end

test/trim/linear_rf.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module TestRFLUFactorization
2+
using LinearSolve
3+
using LinearAlgebra
4+
using StaticArrays
5+
using RecursiveFactorization
6+
import SciMLBase
7+
8+
# Define a simple linear problem with a dense matrix
9+
const A_matrix = [4.0 1.0; 1.0 3.0]
10+
const b_vector = [1.0, 2.0]
11+
12+
const alg = RFLUFactorization()
13+
const prob = LinearProblem(A_matrix, b_vector)
14+
const cache = init(prob, alg)
15+
16+
function solve_linear(x)
17+
# Create a new problem with a modified b vector
18+
b_new = [x, 2.0 * x]
19+
reinit!(cache; b = b_new)
20+
sol = solve!(cache)
21+
return sol
22+
end
23+
end

test/trim/main_lu.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using TrimTest
2+
3+
function (@main)(argv::Vector{String})::Cint
4+
x = parse(Float64, argv[1])
5+
sol = TrimTest.TestLUFactorization.solve_linear(x)
6+
println(Core.stdout, sum(sol.u))
7+
return 0
8+
end

test/trim/main_mkl.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using TrimTest
2+
3+
function (@main)(argv::Vector{String})::Cint
4+
x = parse(Float64, argv[1])
5+
sol = TrimTest.TestMKLLUFactorization.solve_linear(x)
6+
println(Core.stdout, sum(sol.u))
7+
return 0
8+
end

test/trim/main_rf.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using TrimTest
2+
3+
function (@main)(argv::Vector{String})::Cint
4+
x = parse(Float64, argv[1])
5+
sol = TrimTest.TestRFLUFactorization.solve_linear(x)
6+
println(Core.stdout, sum(sol.u))
7+
return 0
8+
end

0 commit comments

Comments
 (0)