-
-
Notifications
You must be signed in to change notification settings - Fork 72
Improve JET tests to cover all solvers #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ChrisRackauckas
merged 12 commits into
SciML:main
from
ChrisRackauckas-Claude:improve-jet-tests
Aug 9, 2025
Merged
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
796b864
Improve JET tests to cover all solvers
ChrisRackauckas f597c44
Fix JET tests to avoid test failures on CI
ChrisRackauckas 6b33b30
Use @test_broken for failing JET tests
ChrisRackauckas 2cd7d52
Simplify JET tests to fix CI failures
ChrisRackauckas 8eb929e
Fix JET tests: remove broken flag from passing tests
ChrisRackauckas 72b41be
Update test/nopre/jet.jl
ChrisRackauckas 54cd808
Delete jet_test_results.txt
ChrisRackauckas 179f110
Delete jet_test_output.txt
ChrisRackauckas 26aa442
Update test/nopre/jet.jl
ChrisRackauckas 0ca914b
Update test/nopre/jet.jl
ChrisRackauckas 910a2e5
Update test/nopre/jet.jl
ChrisRackauckas c70f3fe
Update test/nopre/jet.jl
ChrisRackauckas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Test Summary: | Pass Broken Total Time | ||
JET Tests for Dense Factorizations | 9 4 13 18.3s | ||
JET Tests for Extension Factorizations: Error During Test at /home/crackauc/sandbox/tmp_20250809_074544_96568/LinearSolve.jl/test/nopre/jet.jl:56 | ||
Unexpected Pass | ||
Expression: #= /home/crackauc/sandbox/tmp_20250809_074544_96568/LinearSolve.jl/test/nopre/jet.jl:56 =# JET.@test_opt solve(prob, MKLLUFactorization()) | ||
Got correct result, please change to @test if no longer broken. | ||
|
||
JET Tests for Extension Factorizations: Error During Test at /home/crackauc/sandbox/tmp_20250809_074544_96568/LinearSolve.jl/test/nopre/jet.jl:65 | ||
Test threw exception | ||
Expression: #= /home/crackauc/sandbox/tmp_20250809_074544_96568/LinearSolve.jl/test/nopre/jet.jl:65 =# JET.@test_opt solve(prob, CudaOffloadFactorization()) | ||
CudaOffloadFactorization requires that CUDA is loaded, i.e. `using CUDA` | ||
Stacktrace: | ||
[1] error(s::String) | ||
@ Base ./error.jl:35 | ||
[2] CudaOffloadFactorization | ||
@ ~/sandbox/tmp_20250809_074544_96568/LinearSolve.jl/src/extension_algs.jl:78 [inlined] | ||
[3] macro expansion | ||
@ ~/.julia/packages/JET/yNWjn/src/JETBase.jl:1004 [inlined] | ||
[4] macro expansion | ||
@ ~/sandbox/tmp_20250809_074544_96568/LinearSolve.jl/test/nopre/jet.jl:65 [inlined] | ||
[5] macro expansion | ||
@ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined] | ||
[6] top-level scope | ||
@ ~/sandbox/tmp_20250809_074544_96568/LinearSolve.jl/test/nopre/jet.jl:48 | ||
Test Summary: | Pass Error Broken Total Time | ||
JET Tests for Extension Factorizations | 1 2 3 6 9.9s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,110 @@ | ||
using LinearSolve, RecursiveFactorization, LinearAlgebra, SparseArrays, Test | ||
using JET | ||
|
||
# Dense problem setup | ||
A = rand(4, 4) | ||
b = rand(4) | ||
prob = LinearProblem(A, b) | ||
JET.@test_opt init(prob, nothing) | ||
JET.@test_opt solve(prob, LUFactorization()) | ||
JET.@test_opt solve(prob, GenericLUFactorization()) | ||
@test_skip JET.@test_opt solve(prob, QRFactorization()) | ||
JET.@test_opt solve(prob, DiagonalFactorization()) | ||
#JET.@test_opt solve(prob, SVDFactorization()) | ||
#JET.@test_opt solve(prob, KrylovJL_GMRES()) | ||
|
||
prob = LinearProblem(sparse(A), b) | ||
#JET.@test_opt solve(prob, UMFPACKFactorization()) | ||
#JET.@test_opt solve(prob, KLUFactorization()) | ||
#JET.@test_opt solve(prob, SparspakFactorization()) | ||
#JET.@test_opt solve(prob) | ||
|
||
# Symmetric positive definite matrix for Cholesky | ||
A_spd = A' * A + I | ||
prob_spd = LinearProblem(A_spd, b) | ||
|
||
# Symmetric matrix for LDLt | ||
A_sym = A + A' | ||
prob_sym = LinearProblem(A_sym, b) | ||
|
||
# Sparse problem setup | ||
A_sparse = sparse(A) | ||
prob_sparse = LinearProblem(A_sparse, b) | ||
|
||
# Sparse SPD for CHOLMODFactorization | ||
A_sparse_spd = sparse(A_spd) | ||
prob_sparse_spd = LinearProblem(A_sparse_spd, b) | ||
|
||
@testset "JET Tests for Dense Factorizations" begin | ||
# Working tests - these pass JET optimization checks | ||
JET.@test_opt init(prob, nothing) | ||
JET.@test_opt solve(prob, LUFactorization()) | ||
JET.@test_opt solve(prob, GenericLUFactorization()) | ||
JET.@test_opt solve(prob, DiagonalFactorization()) | ||
JET.@test_opt solve(prob, SimpleLUFactorization()) | ||
JET.@test_opt solve(prob_spd, NormalCholeskyFactorization()) | ||
JET.@test_opt solve(prob, NormalBunchKaufmanFactorization()) | ||
|
||
# CholeskyFactorization and SVDFactorization now pass JET tests | ||
JET.@test_opt solve(prob_spd, CholeskyFactorization()) | ||
JET.@test_opt solve(prob, SVDFactorization()) | ||
ChrisRackauckas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Tests with known type stability issues - marked as broken | ||
JET.@test_opt solve(prob, QRFactorization()) broken=true | ||
JET.@test_opt solve(prob_sym, LDLtFactorization()) broken=true | ||
JET.@test_opt solve(prob_sym, BunchKaufmanFactorization()) broken=true | ||
JET.@test_opt solve(prob, GenericFactorization()) broken=true | ||
end | ||
|
||
@testset "JET Tests for Extension Factorizations" begin | ||
# RecursiveFactorization.jl extensions | ||
JET.@test_opt solve(prob, RFLUFactorization()) | ||
|
||
# Tests with known type stability issues | ||
JET.@test_opt solve(prob, FastLUFactorization()) broken=true | ||
JET.@test_opt solve(prob, FastQRFactorization()) broken=true | ||
|
||
# Platform-specific factorizations (may not be available on all systems) | ||
if @isdefined(MKLLUFactorization) | ||
# MKLLUFactorization passes JET tests | ||
JET.@test_opt solve(prob, MKLLUFactorization()) | ||
end | ||
|
||
if Sys.isapple() && @isdefined(AppleAccelerateLUFactorization) | ||
JET.@test_opt solve(prob, AppleAccelerateLUFactorization()) broken=true | ||
end | ||
|
||
# CUDA/Metal factorizations (only test if CUDA/Metal are loaded) | ||
# CudaOffloadFactorization requires CUDA to be loaded, skip if not available | ||
if @isdefined(MetalLUFactorization) | ||
JET.@test_opt solve(prob, MetalLUFactorization()) broken=true | ||
end | ||
if @isdefined(BLISLUFactorization) | ||
JET.@test_opt solve(prob, BLISLUFactorization()) broken=true | ||
end | ||
end | ||
|
||
@testset "JET Tests for Sparse Factorizations" begin | ||
JET.@test_opt solve(prob_sparse, UMFPACKFactorization()) broken=true | ||
JET.@test_opt solve(prob_sparse, KLUFactorization()) broken=true | ||
JET.@test_opt solve(prob_sparse_spd, CHOLMODFactorization()) broken=true | ||
|
||
# SparspakFactorization requires Sparspak to be loaded | ||
# PardisoJL requires Pardiso to be loaded | ||
# CUSOLVERRFFactorization requires CUSOLVERRF to be loaded | ||
# These are tested in their respective extension test suites | ||
end | ||
|
||
@testset "JET Tests for Krylov Methods" begin | ||
# KrylovJL methods that pass JET tests | ||
JET.@test_opt solve(prob_spd, KrylovJL_CG()) | ||
JET.@test_opt solve(prob, KrylovJL_BICGSTAB()) | ||
JET.@test_opt solve(prob, KrylovJL_LSMR()) | ||
JET.@test_opt solve(prob, KrylovJL_CRAIGMR()) | ||
|
||
# SimpleGMRES passes JET tests | ||
JET.@test_opt solve(prob, SimpleGMRES()) | ||
ChrisRackauckas marked this conversation as resolved.
Show resolved
Hide resolved
ChrisRackauckas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# KrylovJL methods with known type stability issues | ||
JET.@test_opt solve(prob, KrylovJL_GMRES()) broken=true | ||
JET.@test_opt solve(prob_sym, KrylovJL_MINRES()) broken=true | ||
JET.@test_opt solve(prob_sym, KrylovJL_MINARES()) broken=true | ||
|
||
# Extension Krylov methods (require extensions) | ||
# KrylovKitJL_CG, KrylovKitJL_GMRES require KrylovKit to be loaded | ||
# IterativeSolversJL requires IterativeSolvers to be loaded | ||
# These are tested in their respective extension test suites | ||
end | ||
|
||
@testset "JET Tests for Default Solver" begin | ||
# Test the default solver selection | ||
JET.@test_opt solve(prob) broken=true | ||
JET.@test_opt solve(prob_sparse) broken=true | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.