From f0fcaaab933b9622a3e9b3a24ecbb888bbf5ff88 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Thu, 13 Nov 2025 22:15:31 -0500 Subject: [PATCH 1/6] Add trim tests for LUFactorization, MKLLUFactorization, and RFLUFactorization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds trimming tests to LinearSolve.jl, similar to PR #734 in NonlinearSolve.jl. ## Summary - Add `test/trim/` directory with infrastructure for testing trimming - Add tests for LUFactorization, MKLLUFactorization, and RFLUFactorization - Add "Trim" test group to CI configuration - Tests only run on Julia 1.12+ (when trimming was introduced) ## Test Structure The tests verify: 1. LUFactorization works correctly with pre-initialized cache 2. MKLLUFactorization works correctly with pre-initialized cache 3. RFLUFactorization works correctly with pre-initialized cache 4. Each implementation can be successfully compiled with \`juliac --trim\` ## Notes - Trim tests only run on Julia 1.12+ - CI excludes trim tests on LTS and pre-release versions - Tests use a custom environment in \`test/trim/\` to avoid conflicts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/Tests.yml | 7 ++++ Project.toml | 10 +++--- test/runtests.jl | 7 ++++ test/trim/Project.toml | 25 +++++++++++++ test/trim/linear_lu.jl | 22 ++++++++++++ test/trim/linear_mkl.jl | 22 ++++++++++++ test/trim/linear_rf.jl | 23 ++++++++++++ test/trim/main_lu.jl | 8 +++++ test/trim/main_mkl.jl | 8 +++++ test/trim/main_rf.jl | 8 +++++ test/trim/runtests.jl | 72 +++++++++++++++++++++++++++++++++++++ test/trim/src/TrimTest.jl | 7 ++++ 12 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 test/trim/Project.toml create mode 100644 test/trim/linear_lu.jl create mode 100644 test/trim/linear_mkl.jl create mode 100644 test/trim/linear_rf.jl create mode 100644 test/trim/main_lu.jl create mode 100644 test/trim/main_mkl.jl create mode 100644 test/trim/main_rf.jl create mode 100644 test/trim/runtests.jl create mode 100644 test/trim/src/TrimTest.jl diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 7a27a1d9e..978d8d18e 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -38,10 +38,17 @@ jobs: - "NoPre" - "LinearSolveAutotune" - "Preferences" + - "Trim" os: - ubuntu-latest - macos-latest - windows-latest + exclude: + # Don't run trim tests on Julia versions below 1.12 + - group: Trim + version: "lts" + - group: Trim + version: "pre" uses: "SciML/.github/.github/workflows/tests.yml@v1" with: group: "${{ matrix.group }}" diff --git a/Project.toml b/Project.toml index 7f89526d8..cf7858f8c 100644 --- a/Project.toml +++ b/Project.toml @@ -11,6 +11,7 @@ DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56" GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7" LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -41,13 +42,13 @@ EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" FastAlmostBandedMatrices = "9d29842c-ecb8-4973-b1e9-a27b1157504e" FastLapackInterface = "29a986be-02c6-4525-aec4-84b980013641" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" -Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" HYPRE = "b5ffcf37-a2bd-41ab-a3da-4bd9bc8ad771" IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153" KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77" LAPACK_jll = "51474c39-65e3-53ba-86ba-03b1b862ec14" Metal = "dde4c033-4e86-420c-a63e-0dd931031962" +Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" Pardiso = "46dd5b70-b6fb-5a00-ae2d-e8fea33afaf2" RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" @@ -90,8 +91,8 @@ CUDSS = "0.4, 0.6.1" CUSOLVERRF = "0.2.6" ChainRulesCore = "1.25" CliqueTrees = "1.11.0" -ConcreteStructs = "0.2.3" ComponentArrays = "0.15.29" +ConcreteStructs = "0.2.3" DocStringExtensions = "0.9.3" EnumX = "1.0.4" EnzymeCore = "0.8.5" @@ -104,6 +105,7 @@ GPUArraysCore = "0.2" HYPRE = "1.7" InteractiveUtils = "1.10" IterativeSolvers = "0.9.4" +JuliaFormatter = "2.2.0" KernelAbstractions = "0.9.30" Krylov = "0.10" KrylovKit = "0.10" @@ -129,8 +131,8 @@ RecursiveFactorization = "0.2.26" Reexport = "1.2.2" SafeTestsets = "0.1" SciMLBase = "2.70" -SciMLOperators = "1.7.1" SciMLLogging = "1.3.1" +SciMLOperators = "1.7.1" Setfield = "1.1.1" SparseArrays = "1.10" Sparspak = "0.3.9" @@ -163,13 +165,13 @@ KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77" KrylovPreconditioners = "45d422c2-293f-44ce-8315-2cb988662dec" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" Metal = "dde4c033-4e86-420c-a63e-0dd931031962" +Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" MultiFloats = "bdf0d083-296b-4888-a5b6-7498122e68a5" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" -Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" Sparspak = "e56a9233-b9d6-4f03-8d0f-1825330902ac" StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" diff --git a/test/runtests.jl b/test/runtests.jl index 2d2b5dc2e..15ab5554d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -73,3 +73,10 @@ end if Base.Sys.islinux() && (GROUP == "All" || GROUP == "LinearSolveHYPRE") && HAS_EXTENSIONS @time @safetestset "LinearSolveHYPRE" include("hypretests.jl") end + +if GROUP == "Trim" && VERSION >= v"1.12.0" + Pkg.activate("trim") + Pkg.develop(PackageSpec(path = dirname(@__DIR__))) + Pkg.instantiate() + @time @safetestset "Trim Tests" include("trim/runtests.jl") +end diff --git a/test/trim/Project.toml b/test/trim/Project.toml new file mode 100644 index 000000000..bdde4ead0 --- /dev/null +++ b/test/trim/Project.toml @@ -0,0 +1,25 @@ +name = "TrimTest" +uuid = "e59a8f5e-4b8c-4d8e-9c8e-8e8e8e8e8e8e" +version = "0.1.0" + +[deps] +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" +RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[extras] +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" + +[targets] +test = ["JET", "SafeTestsets"] + +[compat] +LinearSolve = "3" +RecursiveFactorization = "0.2" +SciMLBase = "2" +StaticArrays = "1" +julia = "1.10" diff --git a/test/trim/linear_lu.jl b/test/trim/linear_lu.jl new file mode 100644 index 000000000..630e0938f --- /dev/null +++ b/test/trim/linear_lu.jl @@ -0,0 +1,22 @@ +module TestLUFactorization +using LinearSolve +using LinearAlgebra +using StaticArrays +import SciMLBase + +# Define a simple linear problem with a dense matrix +const A_matrix = [4.0 1.0; 1.0 3.0] +const b_vector = [1.0, 2.0] + +const alg = LUFactorization() +const prob = LinearProblem(A_matrix, b_vector) +const cache = init(prob, alg) + +function solve_linear(x) + # Create a new problem with a modified b vector + b_new = [x, 2.0 * x] + reinit!(cache, b_new) + solve!(cache) + return cache +end +end diff --git a/test/trim/linear_mkl.jl b/test/trim/linear_mkl.jl new file mode 100644 index 000000000..1033a3d14 --- /dev/null +++ b/test/trim/linear_mkl.jl @@ -0,0 +1,22 @@ +module TestMKLLUFactorization +using LinearSolve +using LinearAlgebra +using StaticArrays +import SciMLBase + +# Define a simple linear problem with a dense matrix +const A_matrix = [4.0 1.0; 1.0 3.0] +const b_vector = [1.0, 2.0] + +const alg = MKLLUFactorization() +const prob = LinearProblem(A_matrix, b_vector) +const cache = init(prob, alg) + +function solve_linear(x) + # Create a new problem with a modified b vector + b_new = [x, 2.0 * x] + reinit!(cache, b_new) + solve!(cache) + return cache +end +end diff --git a/test/trim/linear_rf.jl b/test/trim/linear_rf.jl new file mode 100644 index 000000000..8a61268c3 --- /dev/null +++ b/test/trim/linear_rf.jl @@ -0,0 +1,23 @@ +module TestRFLUFactorization +using LinearSolve +using LinearAlgebra +using StaticArrays +using RecursiveFactorization +import SciMLBase + +# Define a simple linear problem with a dense matrix +const A_matrix = [4.0 1.0; 1.0 3.0] +const b_vector = [1.0, 2.0] + +const alg = RFLUFactorization() +const prob = LinearProblem(A_matrix, b_vector) +const cache = init(prob, alg) + +function solve_linear(x) + # Create a new problem with a modified b vector + b_new = [x, 2.0 * x] + reinit!(cache, b_new) + solve!(cache) + return cache +end +end diff --git a/test/trim/main_lu.jl b/test/trim/main_lu.jl new file mode 100644 index 000000000..3bc97767e --- /dev/null +++ b/test/trim/main_lu.jl @@ -0,0 +1,8 @@ +using TrimTest + +function (@main)(argv::Vector{String})::Cint + x = parse(Float64, argv[1]) + sol = TrimTest.TestLUFactorization.solve_linear(x) + println(Core.stdout, sum(sol.u)) + return 0 +end diff --git a/test/trim/main_mkl.jl b/test/trim/main_mkl.jl new file mode 100644 index 000000000..c2a1128f2 --- /dev/null +++ b/test/trim/main_mkl.jl @@ -0,0 +1,8 @@ +using TrimTest + +function (@main)(argv::Vector{String})::Cint + x = parse(Float64, argv[1]) + sol = TrimTest.TestMKLLUFactorization.solve_linear(x) + println(Core.stdout, sum(sol.u)) + return 0 +end diff --git a/test/trim/main_rf.jl b/test/trim/main_rf.jl new file mode 100644 index 000000000..e16e7e67c --- /dev/null +++ b/test/trim/main_rf.jl @@ -0,0 +1,8 @@ +using TrimTest + +function (@main)(argv::Vector{String})::Cint + x = parse(Float64, argv[1]) + sol = TrimTest.TestRFLUFactorization.solve_linear(x) + println(Core.stdout, sum(sol.u)) + return 0 +end diff --git a/test/trim/runtests.jl b/test/trim/runtests.jl new file mode 100644 index 000000000..1ad48cb89 --- /dev/null +++ b/test/trim/runtests.jl @@ -0,0 +1,72 @@ +using SafeTestsets + +@safetestset "LUFactorization implementation" begin + using SciMLBase: successful_retcode + include("linear_lu.jl") + @test successful_retcode(TestLUFactorization.solve_linear(1.0).retcode) +end + +@safetestset "MKLLUFactorization implementation" begin + using SciMLBase: successful_retcode + include("linear_mkl.jl") + @test successful_retcode(TestMKLLUFactorization.solve_linear(1.0).retcode) +end + +@safetestset "RFLUFactorization implementation" begin + using SciMLBase: successful_retcode + include("linear_rf.jl") + @test successful_retcode(TestRFLUFactorization.solve_linear(1.0).retcode) +end + +@safetestset "Run trim" begin + # https://discourse.julialang.org/t/capture-stdout-and-stderr-in-case-a-command-fails/101772/3?u=romeov + """ + Run a Cmd object, returning the stdout & stderr contents plus the exit code + """ + function _execute(cmd::Cmd) + out = Pipe() + err = Pipe() + process = run(pipeline(ignorestatus(cmd); stdout = out, stderr = err)) + close(out.in) + close(err.in) + out = ( + stdout = String(read(out)), stderr = String(read(err)), + exitcode = process.exitcode + ) + return out + end + + JULIAC = normpath( + joinpath( + Sys.BINDIR, Base.DATAROOTDIR, "julia", "juliac", + "juliac.jl" + ) + ) + @test isfile(JULIAC) + + for (mainfile, expectedtopass) in [ + ("main_lu.jl", true), + ("main_mkl.jl", true), + ("main_rf.jl", true) + ] + binpath = tempname() + cmd = `$(Base.julia_cmd()) --project=. --depwarn=error $(JULIAC) --experimental --trim=unsafe-warn --output-exe $(binpath) $(mainfile)` + + # since we are calling Julia from Julia, we first need to clean some + # environment variables + clean_env = copy(ENV) + delete!(clean_env, "JULIA_PROJECT") + delete!(clean_env, "JULIA_LOAD_PATH") + # We could just check for success, but then failures are hard to debug. + # Instead we use `_execute` to also capture `stdout` and `stderr`. + # @test success(setenv(cmd, clean_env)) + trimcall = _execute(setenv(cmd, clean_env; dir = @__DIR__)) + if trimcall.exitcode != 0 && expectedtopass + @show trimcall.stdout + @show trimcall.stderr + end + @test trimcall.exitcode == 0 broken = !expectedtopass + @test isfile(binpath) broken = !expectedtopass + @test success(`$(binpath) 1.0`) broken = !expectedtopass + end +end diff --git a/test/trim/src/TrimTest.jl b/test/trim/src/TrimTest.jl new file mode 100644 index 000000000..ad9e43be6 --- /dev/null +++ b/test/trim/src/TrimTest.jl @@ -0,0 +1,7 @@ +module TrimTest + +include("../linear_lu.jl") +include("../linear_mkl.jl") +include("../linear_rf.jl") + +end From f392a2574263bbe56554359e769eee86e1735b89 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Thu, 13 Nov 2025 22:56:10 -0500 Subject: [PATCH 2/6] Remove JuliaFormatter from dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JuliaFormatter should not be a package dependency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Project.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Project.toml b/Project.toml index cf7858f8c..5f386a640 100644 --- a/Project.toml +++ b/Project.toml @@ -11,7 +11,6 @@ DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56" GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" -JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7" LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -105,7 +104,6 @@ GPUArraysCore = "0.2" HYPRE = "1.7" InteractiveUtils = "1.10" IterativeSolvers = "0.9.4" -JuliaFormatter = "2.2.0" KernelAbstractions = "0.9.30" Krylov = "0.10" KrylovKit = "0.10" From 9b8895413b96aede79d06d101ee7f3efa424c1c4 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Thu, 13 Nov 2025 23:41:42 -0500 Subject: [PATCH 3/6] Fix reinit! to use keyword argument for b MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed reinit!(cache, b_new) to reinit!(cache; b = b_new) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- test/trim/linear_lu.jl | 2 +- test/trim/linear_mkl.jl | 2 +- test/trim/linear_rf.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/trim/linear_lu.jl b/test/trim/linear_lu.jl index 630e0938f..5a6659e77 100644 --- a/test/trim/linear_lu.jl +++ b/test/trim/linear_lu.jl @@ -15,7 +15,7 @@ const cache = init(prob, alg) function solve_linear(x) # Create a new problem with a modified b vector b_new = [x, 2.0 * x] - reinit!(cache, b_new) + reinit!(cache; b = b_new) solve!(cache) return cache end diff --git a/test/trim/linear_mkl.jl b/test/trim/linear_mkl.jl index 1033a3d14..198e77075 100644 --- a/test/trim/linear_mkl.jl +++ b/test/trim/linear_mkl.jl @@ -15,7 +15,7 @@ const cache = init(prob, alg) function solve_linear(x) # Create a new problem with a modified b vector b_new = [x, 2.0 * x] - reinit!(cache, b_new) + reinit!(cache; b = b_new) solve!(cache) return cache end diff --git a/test/trim/linear_rf.jl b/test/trim/linear_rf.jl index 8a61268c3..3909b5a0b 100644 --- a/test/trim/linear_rf.jl +++ b/test/trim/linear_rf.jl @@ -16,7 +16,7 @@ const cache = init(prob, alg) function solve_linear(x) # Create a new problem with a modified b vector b_new = [x, 2.0 * x] - reinit!(cache, b_new) + reinit!(cache; b = b_new) solve!(cache) return cache end From a13d97bbce6f31fb9fe26d1735f8b1b22e2ceb8e Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Fri, 14 Nov 2025 00:21:48 -0500 Subject: [PATCH 4/6] Fix return value to return sol from solve!(cache) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed to capture and return the solution object from solve!(cache) instead of returning the cache itself. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- test/trim/linear_lu.jl | 4 ++-- test/trim/linear_mkl.jl | 4 ++-- test/trim/linear_rf.jl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/trim/linear_lu.jl b/test/trim/linear_lu.jl index 5a6659e77..733f2e6e8 100644 --- a/test/trim/linear_lu.jl +++ b/test/trim/linear_lu.jl @@ -16,7 +16,7 @@ function solve_linear(x) # Create a new problem with a modified b vector b_new = [x, 2.0 * x] reinit!(cache; b = b_new) - solve!(cache) - return cache + sol = solve!(cache) + return sol end end diff --git a/test/trim/linear_mkl.jl b/test/trim/linear_mkl.jl index 198e77075..76b20c386 100644 --- a/test/trim/linear_mkl.jl +++ b/test/trim/linear_mkl.jl @@ -16,7 +16,7 @@ function solve_linear(x) # Create a new problem with a modified b vector b_new = [x, 2.0 * x] reinit!(cache; b = b_new) - solve!(cache) - return cache + sol = solve!(cache) + return sol end end diff --git a/test/trim/linear_rf.jl b/test/trim/linear_rf.jl index 3909b5a0b..fb90403a1 100644 --- a/test/trim/linear_rf.jl +++ b/test/trim/linear_rf.jl @@ -17,7 +17,7 @@ function solve_linear(x) # Create a new problem with a modified b vector b_new = [x, 2.0 * x] reinit!(cache; b = b_new) - solve!(cache) - return cache + sol = solve!(cache) + return sol end end From 182346f3bf2bc338e331fd14eb2862c24b44ad20 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Fri, 14 Nov 2025 01:00:32 -0500 Subject: [PATCH 5/6] Fix test assertions and make MKL tests conditional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed tests to check solution values instead of retcode - Made MKL tests conditional on MKL availability - This fixes CI failures when MKL is not available 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- test/trim/runtests.jl | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/test/trim/runtests.jl b/test/trim/runtests.jl index 1ad48cb89..082d2e0d0 100644 --- a/test/trim/runtests.jl +++ b/test/trim/runtests.jl @@ -1,21 +1,30 @@ using SafeTestsets @safetestset "LUFactorization implementation" begin - using SciMLBase: successful_retcode + using LinearAlgebra include("linear_lu.jl") - @test successful_retcode(TestLUFactorization.solve_linear(1.0).retcode) + sol = TestLUFactorization.solve_linear(1.0) + @test sol.u ≈ [0.09090909090909091, 0.6363636363636364] end @safetestset "MKLLUFactorization implementation" begin - using SciMLBase: successful_retcode - include("linear_mkl.jl") - @test successful_retcode(TestMKLLUFactorization.solve_linear(1.0).retcode) + using LinearAlgebra + using LinearSolve + # Only test if MKL is available + if LinearSolve.usemkl(nothing) + include("linear_mkl.jl") + sol = TestMKLLUFactorization.solve_linear(1.0) + @test sol.u ≈ [0.09090909090909091, 0.6363636363636364] + else + @test_skip "MKL not available" + end end @safetestset "RFLUFactorization implementation" begin - using SciMLBase: successful_retcode + using LinearAlgebra include("linear_rf.jl") - @test successful_retcode(TestRFLUFactorization.solve_linear(1.0).retcode) + sol = TestRFLUFactorization.solve_linear(1.0) + @test sol.u ≈ [0.09090909090909091, 0.6363636363636364] end @safetestset "Run trim" begin @@ -44,11 +53,17 @@ end ) @test isfile(JULIAC) - for (mainfile, expectedtopass) in [ + using LinearSolve + # Build list of tests to run, conditionally including MKL + test_files = [ ("main_lu.jl", true), - ("main_mkl.jl", true), ("main_rf.jl", true) ] + if LinearSolve.usemkl(nothing) + push!(test_files, ("main_mkl.jl", true)) + end + + for (mainfile, expectedtopass) in test_files binpath = tempname() cmd = `$(Base.julia_cmd()) --project=. --depwarn=error $(JULIAC) --experimental --trim=unsafe-warn --output-exe $(binpath) $(mainfile)` From 286e9a67355a49104d0bea1e70eaeaa6fef63dda Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Fri, 14 Nov 2025 01:46:13 -0500 Subject: [PATCH 6/6] Fix usemkl check - it's a constant, not a function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed LinearSolve.usemkl(nothing) to LinearSolve.usemkl since usemkl is a constant boolean, not a function. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- test/trim/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/trim/runtests.jl b/test/trim/runtests.jl index 082d2e0d0..d26228281 100644 --- a/test/trim/runtests.jl +++ b/test/trim/runtests.jl @@ -11,7 +11,7 @@ end using LinearAlgebra using LinearSolve # Only test if MKL is available - if LinearSolve.usemkl(nothing) + if LinearSolve.usemkl include("linear_mkl.jl") sol = TestMKLLUFactorization.solve_linear(1.0) @test sol.u ≈ [0.09090909090909091, 0.6363636363636364] @@ -59,7 +59,7 @@ end ("main_lu.jl", true), ("main_rf.jl", true) ] - if LinearSolve.usemkl(nothing) + if LinearSolve.usemkl push!(test_files, ("main_mkl.jl", true)) end