Skip to content

Commit

Permalink
fix: fix SII implementation for caches, tests (#500)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
AayushSabharwal and thazhemadam authored Nov 13, 2024
1 parent f0ec343 commit 70c0581
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI_BracketingNonlinearSolve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,4 +106,4 @@ jobs:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
fail_ci_if_error: false
4 changes: 2 additions & 2 deletions .github/workflows/CI_NonlinearSolve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -126,4 +126,4 @@ jobs:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
fail_ci_if_error: false
4 changes: 2 additions & 2 deletions .github/workflows/CI_NonlinearSolveBase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -105,4 +105,4 @@ jobs:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
fail_ci_if_error: false
4 changes: 2 additions & 2 deletions .github/workflows/CI_NonlinearSolveFirstOrder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,4 +106,4 @@ jobs:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
fail_ci_if_error: false
4 changes: 2 additions & 2 deletions .github/workflows/CI_NonlinearSolveQuasiNewton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,4 +106,4 @@ jobs:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
fail_ci_if_error: false
4 changes: 2 additions & 2 deletions .github/workflows/CI_NonlinearSolveSpectralMethods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,4 +106,4 @@ jobs:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
fail_ci_if_error: false
4 changes: 2 additions & 2 deletions .github/workflows/CI_SciMLJacobianOperators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -90,4 +90,4 @@ jobs:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
fail_ci_if_error: false
4 changes: 2 additions & 2 deletions .github/workflows/CI_SimpleNonlinearSolve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -119,4 +119,4 @@ jobs:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
with:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion .github/workflows/Downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ jobs:
with:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion lib/NonlinearSolveBase/src/abstract_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/NonlinearSolveBase/src/polyalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
7 changes: 4 additions & 3 deletions test/mtk_cache_indexing_tests.jl
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 70c0581

Please sign in to comment.