From 70c0581d4f1e573438e07c046682a6241850e135 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Thu, 14 Nov 2024 03:25:37 +0530 Subject: [PATCH] fix: fix SII implementation for caches, tests (#500) * fix: fix SII implementation for caches * test: fix SII tests * ci: don't fail CI jobs if code coverage reporting fails --------- Co-authored-by: Anant Thazhemadam --- .github/workflows/CI_BracketingNonlinearSolve.yml | 4 ++-- .github/workflows/CI_NonlinearSolve.yml | 4 ++-- .github/workflows/CI_NonlinearSolveBase.yml | 4 ++-- .github/workflows/CI_NonlinearSolveFirstOrder.yml | 4 ++-- .github/workflows/CI_NonlinearSolveQuasiNewton.yml | 4 ++-- .github/workflows/CI_NonlinearSolveSpectralMethods.yml | 4 ++-- .github/workflows/CI_SciMLJacobianOperators.yml | 4 ++-- .github/workflows/CI_SimpleNonlinearSolve.yml | 4 ++-- .github/workflows/Documentation.yml | 2 +- .github/workflows/Downstream.yml | 2 +- lib/NonlinearSolveBase/src/abstract_types.jl | 2 +- lib/NonlinearSolveBase/src/polyalg.jl | 2 +- test/mtk_cache_indexing_tests.jl | 7 ++++--- 13 files changed, 24 insertions(+), 23 deletions(-) diff --git a/.github/workflows/CI_BracketingNonlinearSolve.yml b/.github/workflows/CI_BracketingNonlinearSolve.yml index 956fa33a2..03e5654f2 100644 --- a/.github/workflows/CI_BracketingNonlinearSolve.yml +++ b/.github/workflows/CI_BracketingNonlinearSolve.yml @@ -68,7 +68,7 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false downgrade: runs-on: ubuntu-latest @@ -106,4 +106,4 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/CI_NonlinearSolve.yml b/.github/workflows/CI_NonlinearSolve.yml index f685a7e7a..be4651464 100644 --- a/.github/workflows/CI_NonlinearSolve.yml +++ b/.github/workflows/CI_NonlinearSolve.yml @@ -82,7 +82,7 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false downgrade: runs-on: ubuntu-latest @@ -126,4 +126,4 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/CI_NonlinearSolveBase.yml b/.github/workflows/CI_NonlinearSolveBase.yml index 8b303ae2e..62868d191 100644 --- a/.github/workflows/CI_NonlinearSolveBase.yml +++ b/.github/workflows/CI_NonlinearSolveBase.yml @@ -67,7 +67,7 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false downgrade: runs-on: ubuntu-latest @@ -105,4 +105,4 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/CI_NonlinearSolveFirstOrder.yml b/.github/workflows/CI_NonlinearSolveFirstOrder.yml index 8f68f398b..e2313a3ad 100644 --- a/.github/workflows/CI_NonlinearSolveFirstOrder.yml +++ b/.github/workflows/CI_NonlinearSolveFirstOrder.yml @@ -68,7 +68,7 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false downgrade: runs-on: ubuntu-latest @@ -106,4 +106,4 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/CI_NonlinearSolveQuasiNewton.yml b/.github/workflows/CI_NonlinearSolveQuasiNewton.yml index 3c0904739..9715d5789 100644 --- a/.github/workflows/CI_NonlinearSolveQuasiNewton.yml +++ b/.github/workflows/CI_NonlinearSolveQuasiNewton.yml @@ -68,7 +68,7 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false downgrade: runs-on: ubuntu-latest @@ -106,4 +106,4 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/CI_NonlinearSolveSpectralMethods.yml b/.github/workflows/CI_NonlinearSolveSpectralMethods.yml index f39420efa..13cac0453 100644 --- a/.github/workflows/CI_NonlinearSolveSpectralMethods.yml +++ b/.github/workflows/CI_NonlinearSolveSpectralMethods.yml @@ -68,7 +68,7 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false downgrade: runs-on: ubuntu-latest @@ -106,4 +106,4 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/CI_SciMLJacobianOperators.yml b/.github/workflows/CI_SciMLJacobianOperators.yml index 4d1f6780d..1807da8a6 100644 --- a/.github/workflows/CI_SciMLJacobianOperators.yml +++ b/.github/workflows/CI_SciMLJacobianOperators.yml @@ -60,7 +60,7 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false downgrade: runs-on: ubuntu-latest @@ -90,4 +90,4 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/CI_SimpleNonlinearSolve.yml b/.github/workflows/CI_SimpleNonlinearSolve.yml index 0212232a8..63eb4b136 100644 --- a/.github/workflows/CI_SimpleNonlinearSolve.yml +++ b/.github/workflows/CI_SimpleNonlinearSolve.yml @@ -75,7 +75,7 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false downgrade: runs-on: ubuntu-latest @@ -119,4 +119,4 @@ jobs: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index af44cd769..9cca57cf9 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -39,4 +39,4 @@ jobs: with: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/.github/workflows/Downstream.yml b/.github/workflows/Downstream.yml index dc40d46f2..933ff30d9 100644 --- a/.github/workflows/Downstream.yml +++ b/.github/workflows/Downstream.yml @@ -73,4 +73,4 @@ jobs: with: file: lcov.info token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true + fail_ci_if_error: false diff --git a/lib/NonlinearSolveBase/src/abstract_types.jl b/lib/NonlinearSolveBase/src/abstract_types.jl index 6105f5125..6829e19c3 100644 --- a/lib/NonlinearSolveBase/src/abstract_types.jl +++ b/lib/NonlinearSolveBase/src/abstract_types.jl @@ -307,7 +307,7 @@ SciMLBase.isinplace(cache::AbstractNonlinearSolveCache) = SciMLBase.isinplace(ca ## SII Interface SII.symbolic_container(cache::AbstractNonlinearSolveCache) = cache.prob SII.parameter_values(cache::AbstractNonlinearSolveCache) = SII.parameter_values(cache.prob) -SII.state_values(cache::AbstractNonlinearSolveCache) = SII.state_values(cache.prob) +SII.state_values(cache::AbstractNonlinearSolveCache) = get_u(cache) function Base.getproperty(cache::AbstractNonlinearSolveCache, sym::Symbol) if sym === :ps diff --git a/lib/NonlinearSolveBase/src/polyalg.jl b/lib/NonlinearSolveBase/src/polyalg.jl index 54b61998f..76ba500dd 100644 --- a/lib/NonlinearSolveBase/src/polyalg.jl +++ b/lib/NonlinearSolveBase/src/polyalg.jl @@ -64,7 +64,7 @@ end function SII.symbolic_container(cache::NonlinearSolvePolyAlgorithmCache) return cache.caches[cache.current] end -SII.state_values(cache::NonlinearSolvePolyAlgorithmCache) = cache.u0 +SII.state_values(cache::NonlinearSolvePolyAlgorithmCache) = SII.state_values(SII.symbolic_container(cache)) function Base.show(io::IO, ::MIME"text/plain", cache::NonlinearSolvePolyAlgorithmCache) println(io, "NonlinearSolvePolyAlgorithmCache with \ diff --git a/test/mtk_cache_indexing_tests.jl b/test/mtk_cache_indexing_tests.jl index 3109d1612..cf149efd9 100644 --- a/test/mtk_cache_indexing_tests.jl +++ b/test/mtk_cache_indexing_tests.jl @@ -1,6 +1,7 @@ @testitem "Modeling Toolkit Cache Indexing" tags=[:downstream] begin using ModelingToolkit using ModelingToolkit: t_nounits as t + import NonlinearSolveBase, NonlinearSolveFirstOrder @parameters p d @variables X(t) @@ -11,9 +12,9 @@ nlprob = NonlinearProblem(nlsys, [X => 1.0], [p => 2.0, d => 3.0]) @testset "$integtype" for (alg, integtype) in [ - (NewtonRaphson(), NonlinearSolve.GeneralizedFirstOrderAlgorithmCache), - (FastShortcutNonlinearPolyalg(), NonlinearSolve.NonlinearSolvePolyAlgorithmCache), - (SimpleNewtonRaphson(), NonlinearSolve.NonlinearSolveNoInitCache) + (NewtonRaphson(), NonlinearSolveFirstOrder.GeneralizedFirstOrderAlgorithmCache), + (FastShortcutNonlinearPolyalg(), NonlinearSolveBase.NonlinearSolvePolyAlgorithmCache), + (SimpleNewtonRaphson(), NonlinearSolveBase.NonlinearSolveNoInitCache) ] nint = init(nlprob, alg) @test nint isa integtype