diff --git a/Project.toml b/Project.toml index f17c5faa21d..cca78d2fcb5 100644 --- a/Project.toml +++ b/Project.toml @@ -65,7 +65,7 @@ OrdinaryDiffEqVerner = "2" RecursiveArrayTools = "4.2.0" SciMLBase = "3" SciMLLogging = "2.0.0" -SciMLTesting = "1" +SciMLTesting = "1.7" julia = "1.10" [extras] diff --git a/lib/DelayDiffEq/Project.toml b/lib/DelayDiffEq/Project.toml index 932e1241122..9724383a810 100644 --- a/lib/DelayDiffEq/Project.toml +++ b/lib/DelayDiffEq/Project.toml @@ -66,7 +66,6 @@ DiffEqBase = "7" DiffEqCallbacks = "4.17.0" DiffEqDevTools = "3" DiffEqNoiseProcess = "5.30.0" -ExplicitImports = "1.13.1" FastBroadcast = "1.3" FiniteDiff = "2.27" ForwardDiff = "1.3.3" @@ -93,6 +92,7 @@ RecursiveArrayTools = "4.2.0" Reexport = "1.2.2" SafeTestsets = "0.1.0" SciMLBase = "3.10.0" +SciMLTesting = "1.7" SparseArrays = "<0.0.1, 1, 2" StochasticDiffEqCore = "2" StochasticDiffEqHighOrder = "2" @@ -119,7 +119,6 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DDEProblemLibrary = "f42792ee-6ffc-4e2a-ae83-8ee2f22de800" DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" -ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7" FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41" LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" OrdinaryDiffEqBDF = "6ad6398a-0878-4a85-9266-38940aa047c8" @@ -134,8 +133,9 @@ OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [targets] -test = ["ADTypes", "Aqua", "DDEProblemLibrary", "DiffEqCallbacks", "DiffEqDevTools", "ExplicitImports", "FiniteDiff", "LinearSolve", "OrdinaryDiffEqBDF", "OrdinaryDiffEqFeagin", "OrdinaryDiffEqHighOrderRK", "OrdinaryDiffEqLowOrderRK", "OrdinaryDiffEqLowStorageRK", "OrdinaryDiffEqSDIRK", "OrdinaryDiffEqSSPRK", "OrdinaryDiffEqTsit5", "OrdinaryDiffEqVerner", "Random", "RecursiveArrayTools", "SafeTestsets", "SparseArrays", "StochasticDiffEqCore", "StochasticDiffEqHighOrder", "StochasticDiffEqImplicit", "StochasticDiffEqLowOrder", "StochasticDiffEqROCK", "Test", "Unitful"] +test = ["ADTypes", "Aqua", "DDEProblemLibrary", "DiffEqCallbacks", "DiffEqDevTools", "FiniteDiff", "LinearSolve", "OrdinaryDiffEqBDF", "OrdinaryDiffEqFeagin", "OrdinaryDiffEqHighOrderRK", "OrdinaryDiffEqLowOrderRK", "OrdinaryDiffEqLowStorageRK", "OrdinaryDiffEqSDIRK", "OrdinaryDiffEqSSPRK", "OrdinaryDiffEqTsit5", "OrdinaryDiffEqVerner", "Random", "RecursiveArrayTools", "SafeTestsets", "SciMLTesting", "SparseArrays", "StochasticDiffEqCore", "StochasticDiffEqHighOrder", "StochasticDiffEqImplicit", "StochasticDiffEqLowOrder", "StochasticDiffEqROCK", "Test", "Unitful"] diff --git a/lib/DelayDiffEq/src/DelayDiffEq.jl b/lib/DelayDiffEq/src/DelayDiffEq.jl index 8a3a7127f1d..aef37670f7b 100644 --- a/lib/DelayDiffEq/src/DelayDiffEq.jl +++ b/lib/DelayDiffEq/src/DelayDiffEq.jl @@ -30,14 +30,15 @@ import FastBroadcast: @.. using OrdinaryDiffEqNonlinearSolve: NLAnderson, NLFunctional using OrdinaryDiffEqCore: AbstractNLSolverCache, SlowConvergence, - alg_extrapolates, alg_maximum_order, initialize! + alg_extrapolates, alg_maximum_order using OrdinaryDiffEqCore: StochasticDiffEqAlgorithm, StochasticDiffEqRODEAlgorithm using OrdinaryDiffEqRosenbrock: RosenbrockMutableCache using OrdinaryDiffEqFunctionMap: FunctionMap # using OrdinaryDiffEqDifferentiation: resize_grad_config!, resize_jac_config! -using DiffEqBase: is_diagonal_noise, DEVerbosity +using SciMLBase: is_diagonal_noise +using DiffEqBase: DEVerbosity # Explicit imports for functions using OrdinaryDiffEqCore: AutoSwitch, CompositeAlgorithm diff --git a/lib/DelayDiffEq/src/solve.jl b/lib/DelayDiffEq/src/solve.jl index 03d8b72a4bb..c6fbe370eae 100644 --- a/lib/DelayDiffEq/src/solve.jl +++ b/lib/DelayDiffEq/src/solve.jl @@ -682,7 +682,7 @@ struct DDEDefaultInit <: SciMLBase.DAEInitializationAlgorithm end function SciMLBase.initialize_dae!(integrator::DDEIntegrator, initializealg = integrator.initializealg) return OrdinaryDiffEqCore._initialize_dae!( integrator, integrator.sol.prob, initializealg, - Val(DiffEqBase.isinplace(integrator.sol.prob)) + Val(SciMLBase.isinplace(integrator.sol.prob)) ) end diff --git a/lib/DelayDiffEq/test/qa/qa_tests.jl b/lib/DelayDiffEq/test/qa/qa_tests.jl index 9022866e2a4..153c0de38dd 100644 --- a/lib/DelayDiffEq/test/qa/qa_tests.jl +++ b/lib/DelayDiffEq/test/qa/qa_tests.jl @@ -1,38 +1,68 @@ -using DelayDiffEq, Test +using SciMLTesting, DelayDiffEq, Test import SciMLBase +using OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, StochasticDiffEqAlgorithm, + StochasticDiffEqRODEAlgorithm, + StochasticDiffEqConstantCache, StochasticDiffEqMutableCache -@testset "Aqua Tests" begin - using Aqua +# Names that are non-public in their owning package on the registered releases +# resolved here. The OrdinaryDiffEqCore/Differentiation/NonlinearSolve/DiffEqBase +# solver-author extension API is now declared `public` on this branch, so those +# names are dropped from the ignore lists below. What remains is the genuine +# residual: DDE-specific integrator hooks that OrdinaryDiffEqCore has not made +# public, the SciMLBase problem/function/solution abstract types still pending a +# `public` declaration (SciML/SciMLBase.jl#1412), and true external internals. +const QUALIFIED_INTERNAL = ( + # SciMLBase abstract problem/function types, pending SciMLBase#1412. + :AbstractDDEFunction, :AbstractHistoryFunction, :AbstractSDDEFunction, + :AbstractSDEFunction, :DAEInitializationAlgorithm, + # SciMLBase init/save/step plumbing not yet public (make-public candidates). + :get_save_idxs_and_saved_subsystem, :has_initializeprob, :last_step_failed, + :postamble!, :save_discretes_if_enabled!, :unwrap_cache, + # DiffEqBase internal stats type. + :Stats, + # OrdinaryDiffEqCore DDE-specific integrator stepping / discontinuity / + # tstop / saveat hooks — reached by the DDE integrator but not part of the + # OrdinaryDiffEqCore public extension surface declared on this branch. + :_change_t_via_interpolation!, :current_interpolant!, + :determine_controller_datatype, :first_discontinuity, :get_chunksize_int, + :_get_next_step_tstop, :_get_tstop_target, :handle_discontinuities!, + :handle_dt!, :handle_starting_time_discontinuity!, :handle_tstop!, + :has_discontinuity, :initialize_callbacks!, :initialize_d_discontinuities, + :initialize_saveat, :initialize_tstops, :init_ith_default_cache, + :_loopfooter!, :loopfooter!, :loopheader!, :modify_dt_for_tstops!, + :pop_discontinuity!, :_postamble!, :_savevalues!, :_set_tstop_flag!, + :shift_past_discontinuity!, :update_uprev!, + # ForwardDiff internal type used in discontinuity tracking. + :Dual, +) - Aqua.test_all( - DelayDiffEq; ambiguities = false, piracies = false, - stale_deps = false, deps_compat = false - ) - Aqua.test_ambiguities(DelayDiffEq; recursive = false) - Aqua.test_stale_deps(DelayDiffEq) - Aqua.test_deps_compat(DelayDiffEq) - # Allow piracy for the default solver methods and SDE integration - using OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, StochasticDiffEqAlgorithm, - StochasticDiffEqRODEAlgorithm, - StochasticDiffEqConstantCache, StochasticDiffEqMutableCache - Aqua.test_piracies( - DelayDiffEq; - treat_as_own = [ - SciMLBase.DDEProblem, - OrdinaryDiffEqAlgorithm, - StochasticDiffEqAlgorithm, - StochasticDiffEqRODEAlgorithm, - StochasticDiffEqConstantCache, - StochasticDiffEqMutableCache, - ] - ) -end +# Explicit `using A: name` of names non-public in `A`. +const EXPLICIT_INTERNAL = ( + # SciMLBase abstract algorithm/problem types + pairing error, pending + # SciMLBase#1412. + :AbstractDDEAlgorithm, :AbstractSDDEProblem, :ProblemSolverPairingError, +) -@testset "Explicit Imports Tests" begin - using ExplicitImports - - @test check_no_implicit_imports(DelayDiffEq; skip = (Base, Core), ignore = (Symbol("@reexport"),)) === - nothing - @test check_no_stale_explicit_imports(DelayDiffEq, ignore = (:AbstractVerbositySpecifier, :Standard)) === nothing - @test check_all_qualified_accesses_via_owners(DelayDiffEq) === nothing -end +run_qa( + DelayDiffEq; + aqua_kwargs = (; + ambiguities = (; recursive = false), + # piracy is allowed for the default solver methods and SDE integration + piracies = (; + treat_as_own = [ + SciMLBase.DDEProblem, + OrdinaryDiffEqAlgorithm, + StochasticDiffEqAlgorithm, + StochasticDiffEqRODEAlgorithm, + StochasticDiffEqConstantCache, + StochasticDiffEqMutableCache, + ], + ), + ), + explicit_imports = true, + ei_kwargs = (; + no_implicit_imports = (; skip = (Base, Core)), + all_qualified_accesses_are_public = (; ignore = QUALIFIED_INTERNAL), + all_explicit_imports_are_public = (; ignore = EXPLICIT_INTERNAL), + ), +) diff --git a/lib/DiffEqBase/Project.toml b/lib/DiffEqBase/Project.toml index a3eea73ae63..d38d103f282 100644 --- a/lib/DiffEqBase/Project.toml +++ b/lib/DiffEqBase/Project.toml @@ -1,7 +1,7 @@ name = "DiffEqBase" uuid = "2b5f629d-d688-5b77-993f-72d75c75574e" authors = ["Chris Rackauckas "] -version = "7.6.0" +version = "7.6.1" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" diff --git a/lib/DiffEqBase/src/DiffEqBase.jl b/lib/DiffEqBase/src/DiffEqBase.jl index 86dfb0d792c..cfe597da37c 100644 --- a/lib/DiffEqBase/src/DiffEqBase.jl +++ b/lib/DiffEqBase/src/DiffEqBase.jl @@ -188,13 +188,23 @@ export SensitivityADPassThrough Expr( :public, :get_tstops, :get_tstops_array, :get_tstops_max, - :ExplicitRKTableau, :DECostFunction, :merge_problem_kwargs, + :ExplicitRKTableau, :ImplicitRKTableau, :DECostFunction, :merge_problem_kwargs, # Callback API (DiffEqBase-owned shared functionality used by downstream solvers) :apply_callback!, :apply_discrete_callback!, :CallbackCache, :find_first_continuous_callback, :find_callback_time, - :max_vector_callback_length, :get_condition, + :max_vector_callback_length, :max_vector_callback_length_int, :get_condition, # Default-callback API (integrator defaults overridable via solver keywords) - :ODE_DEFAULT_NORM, :ODE_DEFAULT_ISOUTOFDOMAIN, :ODE_DEFAULT_PROG_MESSAGE + :ODE_DEFAULT_NORM, :ODE_DEFAULT_ISOUTOFDOMAIN, :ODE_DEFAULT_PROG_MESSAGE, + :ODE_DEFAULT_UNSTABLE_CHECK, + # Tableau extension supertypes downstream tableau packages subtype + :Tableau, :ODERKTableau, + # Error-estimate residual hooks solvers call/extend + :calculate_residuals, :calculate_residuals!, + # Algorithm/dt setup hooks solvers specialize + :prepare_alg, :prob2dtmin, :timedepentdtmin, :check_prob_alg_pairing, + :default_factorize, :stripunits, + # Solver-author wrapper/tag types and convergence-testing entry type + :EvalFunc, :OrdinaryDiffEqTag, :ConvergenceSetup ) ) end diff --git a/lib/DiffEqDevTools/Project.toml b/lib/DiffEqDevTools/Project.toml index dca177021fe..e93e0a6148f 100644 --- a/lib/DiffEqDevTools/Project.toml +++ b/lib/DiffEqDevTools/Project.toml @@ -4,6 +4,7 @@ authors = ["Chris Rackauckas "] version = "3.1.2" [deps] +CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503" Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" @@ -48,6 +49,7 @@ StochasticDiffEqWeak = {path = "../StochasticDiffEqWeak"} [compat] BVProblemLibrary = "0.1" BoundaryValueDiffEq = "5" +CommonSolve = "0.2.4" DDEProblemLibrary = "0.1" DelayDiffEq = "6" DiffEqBase = "7" @@ -74,7 +76,7 @@ RecipesBase = "1.3.4" RecursiveArrayTools = "4.2.0" RootedTrees = "2" SDEProblemLibrary = "1" -SciMLBase = "3.10.0" +SciMLBase = "3.30" SciMLLogging = "2" SimpleNonlinearSolve = "2" Statistics = "1.10.0" diff --git a/lib/DiffEqDevTools/src/DiffEqDevTools.jl b/lib/DiffEqDevTools/src/DiffEqDevTools.jl index 17038d955d6..c5bc309b721 100644 --- a/lib/DiffEqDevTools/src/DiffEqDevTools.jl +++ b/lib/DiffEqDevTools/src/DiffEqDevTools.jl @@ -1,22 +1,39 @@ module DiffEqDevTools -using DiffEqBase: AbstractODEAlgorithm -using DiffEqBase, RecipesBase, RecursiveArrayTools, DiffEqNoiseProcess, StructArrays -using SimpleNonlinearSolve, LinearAlgebra, RootedTrees - -using LinearAlgebra, Distributed - -using Statistics +import DiffEqBase +using DiffEqBase: ExplicitRKTableau, ImplicitRKTableau +import RecipesBase +using RecipesBase: @recipe, @series +import RecursiveArrayTools +using RecursiveArrayTools: recursive_mean, vecvecapply +using DiffEqNoiseProcess: NoiseGrid, NoiseWrapper +import StructArrays +using StructArrays: StructArray +import SciMLBase +using SciMLBase: AbstractODEAlgorithm, AbstractODEProblem, + AbstractSDEProblem, AbstractEnsembleProblem, AbstractDAEProblem, + AbstractDEAlgorithm, AbstractTimeseriesSolution, + DAEProblem, EnsembleProblem, EnsembleSolution, EnsembleThreads, + NonlinearProblem, ODEProblem, ReturnCode, SDDEProblem, SDEProblem, remake +using CommonSolve: init, solve, step! +import SimpleNonlinearSolve +using SimpleNonlinearSolve: SimpleTrustRegion, AutoFiniteDiff +import LinearAlgebra +import RootedTrees +using RootedTrees: RootedTreeIterator, RungeKuttaMethod, residual_order_condition +import Distributed +import Statistics +using Statistics: mean, std import Base: length -import DiffEqBase: AbstractODEProblem, AbstractDDEProblem, AbstractDDEAlgorithm, - AbstractODESolution, AbstractRODEProblem, AbstractSDEProblem, - AbstractSDDEProblem, AbstractEnsembleProblem, - AbstractDAEProblem, AbstractBVProblem, @def, ConvergenceSetup, - AbstractDEAlgorithm, - ODERKTableau, AbstractTimeseriesSolution, ExplicitRKTableau, - ImplicitRKTableau +# These problem/solution/algorithm abstracts and `@def` are owned by SciMLBase but +# not yet declared `public` there; accessed via SciMLBase (their owner). +using SciMLBase: AbstractDDEAlgorithm, AbstractODESolution, AbstractRODEProblem, + AbstractSDDEProblem, AbstractBVProblem, @def +# `ConvergenceSetup` and `ODERKTableau` are defined and owned only in DiffEqBase +# (not re-exported by SciMLBase) and are not declared `public` there. +using DiffEqBase: ConvergenceSetup, ODERKTableau import LinearAlgebra: norm, I diff --git a/lib/DiffEqDevTools/src/benchmark.jl b/lib/DiffEqDevTools/src/benchmark.jl index bd529dc213e..b167d1a7781 100644 --- a/lib/DiffEqDevTools/src/benchmark.jl +++ b/lib/DiffEqDevTools/src/benchmark.jl @@ -531,7 +531,7 @@ function WorkPrecisionSet( _abstols = get(setups[i], :abstols, abstols) _reltols = get(setups[i], :reltols, reltols) _dts = get(setups[i], :dts, nothing) - filtered_setup = filter(p -> p.first in DiffEqBase.allowedkeywords, setups[i]) + filtered_setup = filter(p -> p.first in SciMLBase.allowedkeywords, setups[i]) wps[i] = WorkPrecision( prob, setups[i][:alg], _abstols, _reltols, _dts; @@ -547,7 +547,7 @@ function WorkPrecisionSet( end @def error_calculation begin - if !DiffEqBase.has_analytic(prob.f) + if !SciMLBase.has_analytic(prob.f) t = prob.tspan[1]:test_dt:prob.tspan[2] brownian_values = cumsum( [ @@ -578,7 +578,7 @@ end _abstols = get(setups[1], :abstols, abstols) _reltols = get(setups[1], :reltols, reltols) _dts = get(setups[1], :dts, zeros(length(_abstols))) - filtered_setup = filter(p -> p.first in DiffEqBase.allowedkeywords, setups[1]) + filtered_setup = filter(p -> p.first in SciMLBase.allowedkeywords, setups[1]) sol = solve( _prob, setups[1][:alg]; @@ -592,7 +592,7 @@ end _abstols = get(setups[k], :abstols, abstols) _reltols = get(setups[k], :reltols, reltols) _dts = get(setups[k], :dts, zeros(length(_abstols))) - filtered_setup = filter(p -> p.first in DiffEqBase.allowedkeywords, setups[k]) + filtered_setup = filter(p -> p.first in SciMLBase.allowedkeywords, setups[k]) sol = solve( _prob, setups[k][:alg]; @@ -601,7 +601,7 @@ end timeseries_errors = timeseries_errors, dense_errors = dense_errors ) - DiffEqBase.has_analytic(prob.f) ? err_sol = sol : err_sol = appxtrue(sol, true_sol) + SciMLBase.has_analytic(prob.f) ? err_sol = sol : err_sol = appxtrue(sol, true_sol) tmp_solutions[i, j, k] = err_sol end end @@ -615,11 +615,11 @@ function WorkPrecisionSet( kwargs... ) @assert names === nothing || length(setups) == length(names) - timeseries_errors = DiffEqBase.has_analytic(prob.f) && + timeseries_errors = SciMLBase.has_analytic(prob.f) && error_estimate ∈ TIMESERIES_ERRORS weak_timeseries_errors = error_estimate ∈ WEAK_TIMESERIES_ERRORS weak_dense_errors = error_estimate ∈ WEAK_DENSE_ERRORS - dense_errors = DiffEqBase.has_analytic(prob.f) && error_estimate ∈ DENSE_ERRORS + dense_errors = SciMLBase.has_analytic(prob.f) && error_estimate ∈ DENSE_ERRORS N = length(setups) M = length(abstols) times = Array{Float64}(undef, M, N) @@ -647,7 +647,7 @@ function WorkPrecisionSet( ] solutions = [ [ - DiffEqBase.calculate_ensemble_errors( + SciMLBase.calculate_ensemble_errors( sim; weak_timeseries_errors = weak_timeseries_errors, weak_dense_errors = weak_dense_errors @@ -670,7 +670,7 @@ function WorkPrecisionSet( for k in 1:N # precompile GC.gc() - filtered_setup = filter(p -> p.first in DiffEqBase.allowedkeywords, setups[k]) + filtered_setup = filter(p -> p.first in SciMLBase.allowedkeywords, setups[k]) _sol = solve( prob, setups[k][:alg]; @@ -740,7 +740,7 @@ function WorkPrecisionSet( _reltols = [get(setups[k], :reltols, reltols) for k in 1:N] _dts = [get(setups[k], :dts, zeros(length(_abstols))) for k in 1:N] for k in 1:N - filtered_setup = filter(p -> p.first in DiffEqBase.allowedkeywords, setups[k]) + filtered_setup = filter(p -> p.first in SciMLBase.allowedkeywords, setups[k]) for j in 1:M sol = solve( @@ -810,7 +810,7 @@ function WorkPrecisionSet( for k in 1:N # precompile GC.gc() - filtered_setup = filter(p -> p.first in DiffEqBase.allowedkeywords, setups[k]) + filtered_setup = filter(p -> p.first in SciMLBase.allowedkeywords, setups[k]) _sol = solve( prob, setups[k][:alg], ensemblealg; @@ -874,7 +874,7 @@ function WorkPrecisionSet( _abstols = get(setups[i], :abstols, abstols) _reltols = get(setups[i], :reltols, reltols) _dts = get(setups[i], :dts, nothing) - filtered_setup = filter(p -> p.first in DiffEqBase.allowedkeywords, setups[i]) + filtered_setup = filter(p -> p.first in SciMLBase.allowedkeywords, setups[i]) wps[i] = WorkPrecision( prob, setups[i][:alg], _abstols, _reltols, _dts; @@ -922,7 +922,7 @@ function get_sample_errors( tmp_solutions = vec(tmp_solutions) end - if DiffEqBase.has_analytic(prob.f) + if SciMLBase.has_analytic(prob.f) analytical_mean_end = mean(1:sample_error_runs) do i _dt = prob.tspan[2] - prob.tspan[1] if prob.u0 isa Number diff --git a/lib/DiffEqDevTools/src/convergence.jl b/lib/DiffEqDevTools/src/convergence.jl index cdf05ccc2c6..a194bc0a2f8 100644 --- a/lib/DiffEqDevTools/src/convergence.jl +++ b/lib/DiffEqDevTools/src/convergence.jl @@ -81,7 +81,7 @@ function test_convergence( if expected_value == nothing solutions = [ - DiffEqBase.calculate_ensemble_errors( + SciMLBase.calculate_ensemble_errors( sim; weak_timeseries_errors = weak_timeseries_errors, weak_dense_errors = weak_dense_errors @@ -239,7 +239,7 @@ function analyticless_test_convergence( end _solutions = [EnsembleSolution(tmp_solutions[:, i], 0.0, true) for i in 1:length(dts)] solutions = [ - DiffEqBase.calculate_ensemble_errors( + SciMLBase.calculate_ensemble_errors( sim; weak_timeseries_errors = weak_timeseries_errors, weak_dense_errors = weak_dense_errors diff --git a/lib/DiffEqDevTools/src/test_solution.jl b/lib/DiffEqDevTools/src/test_solution.jl index d1e4f9cccb3..42a805bdee1 100644 --- a/lib/DiffEqDevTools/src/test_solution.jl +++ b/lib/DiffEqDevTools/src/test_solution.jl @@ -105,7 +105,7 @@ function appxtrue(sol::AbstractODESolution, sol2::TestSolution) ) end end - return DiffEqBase.build_solution(sol, timeseries_analytic, errors) + return SciMLBase.build_solution(sol, timeseries_analytic, errors) end """ @@ -168,7 +168,7 @@ function appxtrue( ) end end - return DiffEqBase.build_solution(sol, timeseries_analytic, errors) + return SciMLBase.build_solution(sol, timeseries_analytic, errors) end function appxtrue(sim::EnsembleSolution, appx_setup; kwargs...) diff --git a/lib/DiffEqDevTools/test/qa/Project.toml b/lib/DiffEqDevTools/test/qa/Project.toml index e33dfe9e6f1..956e3a97f66 100644 --- a/lib/DiffEqDevTools/test/qa/Project.toml +++ b/lib/DiffEqDevTools/test/qa/Project.toml @@ -1,6 +1,7 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.DiffEqDevTools] @@ -9,4 +10,5 @@ path = "../.." [compat] Aqua = "0.8.11" DiffEqDevTools = "3" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/DiffEqDevTools/test/qa/qa.jl b/lib/DiffEqDevTools/test/qa/qa.jl index a62cf98b168..9752cb7d476 100644 --- a/lib/DiffEqDevTools/test/qa/qa.jl +++ b/lib/DiffEqDevTools/test/qa/qa.jl @@ -1,14 +1,22 @@ -using DiffEqDevTools -using Aqua -using Test +using SciMLTesting, DiffEqDevTools, Test -@testset "Aqua" begin - Aqua.test_all( - DiffEqDevTools; - ambiguities = false, - piracies = false, - unbound_args = false, - stale_deps = false, +run_qa( + DiffEqDevTools; + aqua_kwargs = (; + ambiguities = false, piracies = false, unbound_args = false, stale_deps = false, deps_compat = (; check_extras = false), - ) -end + ), + explicit_imports = true, + ei_kwargs = (; + # SciMLBase-owned solver-interface predicates accessed via SciMLBase (their + # owner) but not declared `public` in the registered SciMLBase release. + all_qualified_accesses_are_public = (; + ignore = (:allowedkeywords, :calculate_ensemble_errors), + ), + # SciMLBase-owned `@def`, imported from SciMLBase (its owner) but not declared + # `public` in the registered SciMLBase release. + all_explicit_imports_are_public = (; + ignore = (Symbol("@def"),), + ), + ), +) diff --git a/lib/ImplicitDiscreteSolve/Project.toml b/lib/ImplicitDiscreteSolve/Project.toml index 0ae69fd8d28..d53a7e823f5 100644 --- a/lib/ImplicitDiscreteSolve/Project.toml +++ b/lib/ImplicitDiscreteSolve/Project.toml @@ -4,6 +4,7 @@ authors = ["vyudu "] version = "2.1.2" [deps] +CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" NonlinearSolveBase = "be0214bd-f91f-a760-ac4e-3421ce2b2da0" NonlinearSolveFirstOrder = "5959db7a-ea39-4486-b5fe-2dd0bf03d60d" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" @@ -23,6 +24,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" DiffEqBase = {path = "../DiffEqBase"} [compat] +CommonSolve = "0.2.4" Pkg = "1" Test = "1.10.0" NonlinearSolveBase = "2.23.0" diff --git a/lib/ImplicitDiscreteSolve/src/ImplicitDiscreteSolve.jl b/lib/ImplicitDiscreteSolve/src/ImplicitDiscreteSolve.jl index 3df38212c69..bf619dda139 100644 --- a/lib/ImplicitDiscreteSolve/src/ImplicitDiscreteSolve.jl +++ b/lib/ImplicitDiscreteSolve/src/ImplicitDiscreteSolve.jl @@ -1,19 +1,21 @@ module ImplicitDiscreteSolve -using SciMLBase -using NonlinearSolveBase -using NonlinearSolveFirstOrder -using SymbolicIndexingInterface: parameter_symbols -import OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, alg_cache, OrdinaryDiffEqMutableCache, - OrdinaryDiffEqConstantCache, get_fsalfirstlast, isfsal, - initialize!, perform_step!, isdiscretecache, isdiscretealg, - alg_order, beta2_default, beta1_default, dt_required, - _initialize_dae!, DefaultInit, BrownFullBasicInit, OverrideInit, - @muladd, @.., _unwrap_val, OrdinaryDiffEqCore, isadaptive, - allows_null_u0, - AbstractController, AbstractControllerCache +using SciMLBase: SciMLBase, ImplicitDiscreteProblem, NonlinearFunction, + NonlinearLeastSquaresProblem, NonlinearProblem, ReturnCode, isinplace, + OverrideInit +import SciMLBase: alg_order, isadaptive +using NonlinearSolveBase: NonlinearSolveBase +using NonlinearSolveFirstOrder: NewtonRaphson +using CommonSolve: init, solve, step! +using DiffEqBase: DefaultInit +import DiffEqBase: initialize! +using OrdinaryDiffEqCore: OrdinaryDiffEqCore, OrdinaryDiffEqAlgorithm, + OrdinaryDiffEqMutableCache, AbstractController, AbstractControllerCache +import OrdinaryDiffEqCore: alg_cache, get_fsalfirstlast, isfsal, perform_step!, + isdiscretecache, isdiscretealg, beta2_default, beta1_default, dt_required, + _initialize_dae!, allows_null_u0 -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/ImplicitDiscreteSolve/test/qa/Project.toml b/lib/ImplicitDiscreteSolve/test/qa/Project.toml index 28e1ab0775c..418b8536c71 100644 --- a/lib/ImplicitDiscreteSolve/test/qa/Project.toml +++ b/lib/ImplicitDiscreteSolve/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" ImplicitDiscreteSolve = "3263718b-31ed-49cf-8a0f-35a466e8af96" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.ImplicitDiscreteSolve] @@ -16,4 +17,5 @@ Aqua = "0.8.11" ImplicitDiscreteSolve = "2" JET = "0.9, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/ImplicitDiscreteSolve/test/qa/qa.jl b/lib/ImplicitDiscreteSolve/test/qa/qa.jl index cc4d2e2ba1f..b9b405db284 100644 --- a/lib/ImplicitDiscreteSolve/test/qa/qa.jl +++ b/lib/ImplicitDiscreteSolve/test/qa/qa.jl @@ -1,9 +1,21 @@ -using ImplicitDiscreteSolve -using Aqua +using SciMLTesting, ImplicitDiscreteSolve, Test -@testset "Aqua" begin - Aqua.test_all( - ImplicitDiscreteSolve; - piracies = false - ) -end +run_qa( + ImplicitDiscreteSolve; + aqua_kwargs = (; piracies = false), + explicit_imports = true, + ei_kwargs = (; + all_qualified_accesses_are_public = (; + ignore = ( + # OrdinaryDiffEqCore controller-resolution internal (owner-internal, + # deliberately kept non-public in the make-public extension surface). + :_resolved_QT, + # NonlinearSolveBase solver internals (external, not public). + :get_fu, :get_u, :not_terminated, + :update_from_termination_cache!, :update_trace!, + # SciMLBase initialization-problem predicate (external, not public). + :has_initializeprob, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl index daebb467b57..970415acd9a 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl @@ -2,22 +2,25 @@ module OrdinaryDiffEqAdamsBashforthMoulton import OrdinaryDiffEqCore: OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, @cache, alg_cache, - initialize!, perform_step!, alg_order, default_controller, IController, + perform_step!, default_controller, IController, OrdinaryDiffEqAlgorithm, OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqAdamsVarOrderVarStepAlgorithm, - constvalue, calculate_residuals, calculate_residuals!, + constvalue, trivial_limiter!, get_fsalfirstlast, generic_solver_docstring, - full_cache, - _ad_chunksize_int, _ad_fdtype, _fixup_ad, @SciMLMessage + full_cache +import SciMLBase: alg_order +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals! import OrdinaryDiffEqLowOrderRK: BS3ConstantCache, BS3Cache, RK4ConstantCache, RK4Cache import RecursiveArrayTools: recursivefill! -using MuladdMacro, FastBroadcast +using MuladdMacro: @muladd +import FastBroadcast: @.. using FastBroadcast: Serial import OrdinaryDiffEqCore -using Reexport +using Reexport: @reexport +import SciMLBase @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/test/qa/Project.toml b/lib/OrdinaryDiffEqAdamsBashforthMoulton/test/qa/Project.toml index 87079fb5ab7..177fc10bcd4 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqAdamsBashforthMoulton = "89bda076-bce5-4f1c-845f-551c83cdda9a" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqAdamsBashforthMoulton] @@ -17,6 +18,7 @@ path = "../../../OrdinaryDiffEqCore" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqAdamsBashforthMoulton = "2" OrdinaryDiffEqCore = "4" diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/test/qa/qa.jl b/lib/OrdinaryDiffEqAdamsBashforthMoulton/test/qa/qa.jl index 5a1ce46d44d..fde19946ece 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/test/qa/qa.jl @@ -1,8 +1,14 @@ -using OrdinaryDiffEqAdamsBashforthMoulton -using Aqua +using SciMLTesting, OrdinaryDiffEqAdamsBashforthMoulton, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqAdamsBashforthMoulton - ) -end +run_qa( + OrdinaryDiffEqAdamsBashforthMoulton; + explicit_imports = true, + ei_kwargs = ( + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore internal limiter hook (owner-internal; + # deliberately not declared public, like the @fold/@threaded codegen macros). + :trivial_limiter!, + )), + ), +) diff --git a/lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl b/lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl index 994ec91e16c..3c5f198dcb9 100644 --- a/lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl +++ b/lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl @@ -1,44 +1,43 @@ module OrdinaryDiffEqBDF -import OrdinaryDiffEqCore: alg_order, calculate_residuals!, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, alg_extrapolates, - OrdinaryDiffEqAlgorithm, default_controller, IController, +import OrdinaryDiffEqCore: perform_step!, unwrap_alg, + alg_extrapolates, + default_controller, IController, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, OrdinaryDiffEqNewtonAdaptiveAlgorithm, OrdinaryDiffEqNewtonAlgorithm, AbstractController, - CompiledFloats, uses_uprev, - alg_cache, _vec, _reshape, @cache, + alg_cache, @cache, isfsal, full_cache, - constvalue, isadaptive, error_constant, + constvalue, error_constant, has_special_newton_error, trivial_limiter!, - issplit, qmin_default, qmax_default, gamma_default, + issplit, qmax_default, gamma_default, qsteady_min_default, qsteady_max_default, get_current_alg_order, get_current_adaptive_order, stepsize_controller!, step_accept_controller!, step_reject_controller!, post_newton_controller!, - accept_step_controller, get_EEst, set_EEst!, + get_EEst, setup_controller_cache, get_qmax, get_gamma, get_qsteady_min, get_qsteady_max, get_failfactor, CommonControllerOptions, resolve_basic, _resolved_QT, AbstractControllerCache, - DAEAlgorithm, _unwrap_val, DummyController, - get_fsalfirstlast, generic_solver_docstring, _ad_chunksize_int, _ad_fdtype, _fixup_ad, + DAEAlgorithm, + get_fsalfirstlast, generic_solver_docstring, _fixup_ad, _ode_interpolant, _ode_interpolant!, has_stiff_interpolation, - _ode_addsteps!, DerivativeOrderNotPossibleError, set_discontinuity + _ode_addsteps!, DerivativeOrderNotPossibleError, set_discontinuity, + DIRK, COEFFICIENT_MULTISTEP, isnewton, set_new_W! +import SciMLBase: alg_order, isadaptive, _unwrap_val +import DiffEqBase: calculate_residuals, calculate_residuals!, initialize! using OrdinaryDiffEqSDIRK: ESDIRKIMEXConstantCache, ESDIRKIMEXCache, ImplicitEulerESDIRKIMEXTableau using TruncatedStacktraces: @truncate_stacktrace using MuladdMacro: @muladd -using MacroTools: @capture using FastBroadcast: @.. using RecursiveArrayTools: recursivefill! using LinearAlgebra: mul!, I import ArrayInterface -using ArrayInterface: ismutable import OrdinaryDiffEqCore import OrdinaryDiffEqCore: default_controller @@ -53,14 +52,13 @@ else end end -using OrdinaryDiffEqDifferentiation: UJacobianWrapper using OrdinaryDiffEqNonlinearSolve: NLNewton, du_alias_or_new, build_nlsolver, - nlsolve!, nlsolvefail, isnewton, markfirststage!, - set_new_W!, DIRK, compute_step!, COEFFICIENT_MULTISTEP, - NonlinearSolveAlg -import ADTypes: AutoForwardDiff, AutoFiniteDiff, AbstractADType + nlsolve!, nlsolvefail, markfirststage! +import ADTypes: AutoForwardDiff -using Reexport +using Reexport: Reexport, @reexport +import SciMLBase +using SciMLBase: ODEProblem, derivative_discontinuity!, solve @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqBDF/test/qa/Project.toml b/lib/OrdinaryDiffEqBDF/test/qa/Project.toml index 52b08f00079..e89a6e76600 100644 --- a/lib/OrdinaryDiffEqBDF/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqBDF/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqBDF = "6ad6398a-0878-4a85-9266-38940aa047c8" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqBDF] @@ -17,6 +18,7 @@ path = "../../../OrdinaryDiffEqCore" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqBDF = "2" OrdinaryDiffEqCore = "4" diff --git a/lib/OrdinaryDiffEqBDF/test/qa/qa.jl b/lib/OrdinaryDiffEqBDF/test/qa/qa.jl index 7f2b04a54d1..fa9e2274347 100644 --- a/lib/OrdinaryDiffEqBDF/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqBDF/test/qa/qa.jl @@ -1,8 +1,26 @@ -using OrdinaryDiffEqBDF -using Aqua +using SciMLTesting, OrdinaryDiffEqBDF, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqBDF - ) -end +run_qa( + OrdinaryDiffEqBDF; + explicit_imports = true, + ei_kwargs = ( + all_qualified_accesses_are_public = (; + ignore = ( + # Precompile-workload test problems in OrdinaryDiffEqCore, kept + # non-public on purpose (test fixtures, not solver-author API). + :lorenz, :lorenz_oop, + ), + ), + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore owner-internal helpers (deliberately excluded + # from the public solver-author extension surface). + :_resolved_QT, :trivial_limiter!, + # SciMLBase internal. + :_unwrap_val, + # TruncatedStacktraces internal macro. + Symbol("@truncate_stacktrace"), + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqCore/Project.toml b/lib/OrdinaryDiffEqCore/Project.toml index b78175271dd..50f484f5411 100644 --- a/lib/OrdinaryDiffEqCore/Project.toml +++ b/lib/OrdinaryDiffEqCore/Project.toml @@ -9,7 +9,7 @@ Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" BinaryHeaps = "b2a6c25c-c996-4615-94ab-6e519ffb8690" -ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471" +CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56" @@ -52,7 +52,7 @@ Accessors = "0.1.42" Adapt = "4.3" ArrayInterface = "7.19" BinaryHeaps = "1" -ConcreteStructs = "0.2.3" +CommonSolve = "0.2.4" DiffEqBase = "7" DiffEqDevTools = "3" DifferentiationInterface = "0.7.18" diff --git a/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl b/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl index 1a68e5280e8..d1b7cd834cf 100644 --- a/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl +++ b/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl @@ -15,7 +15,7 @@ import Logging: @logmsg, LogLevel using MuladdMacro: @muladd -using LinearAlgebra: opnorm, I, UniformScaling, diag, rank, isdiag +using LinearAlgebra: opnorm, I, UniformScaling, diag, isdiag import PrecompileTools @@ -26,76 +26,86 @@ import FastPower: fastpower import SciMLBase: solve!, step!, isadaptive import DiffEqBase: initialize! -# DAE Initialization algorithms +# DAE Initialization algorithms. +# `ShampineCollocationInit`/`BrownFullBasicInit` are unused here but re-exported +# for dependent OrdinaryDiffEq.jl sublibraries that import them from this package. import DiffEqBase: DefaultInit, ShampineCollocationInit, BrownFullBasicInit -# Internal utils +# Internal utils. `DEVerbosity` is re-exported for dependent sublibraries. import DiffEqBase: ODE_DEFAULT_NORM, ODE_DEFAULT_ISOUTOFDOMAIN, ODE_DEFAULT_PROG_MESSAGE, ODE_DEFAULT_UNSTABLE_CHECK, - DEVerbosity, DEFAULT_VERBOSE, _process_verbose_param + DEVerbosity, _process_verbose_param -import SciMLOperators: AbstractSciMLOperator, AbstractSciMLScalarOperator, - MatrixOperator, FunctionOperator, - update_coefficients, update_coefficients!, DEFAULT_UPDATE_FUNC, +import SciMLOperators: MatrixOperator, FunctionOperator, + update_coefficients, update_coefficients!, isconstant -using DiffEqBase: DEIntegrator - import Random -import RecursiveArrayTools: chain, recursivecopy!, recursivecopy, recursive_bottom_eltype, recursive_unitless_bottom_eltype, recursive_unitless_eltype, copyat_or_push!, DiffEqArray, recursivefill! +import RecursiveArrayTools: recursivecopy!, recursivecopy, recursive_bottom_eltype, recursive_unitless_bottom_eltype, recursive_unitless_eltype, copyat_or_push!, DiffEqArray import RecursiveArrayTools using BinaryHeaps: BinaryHeap, FasterForward -using ArrayInterface: ArrayInterface, issingular +using ArrayInterface: ArrayInterface import TruncatedStacktraces: @truncate_stacktrace, VERBOSE_MSG # Integrator Interface -import SciMLBase: resize!, deleteat!, addat!, full_cache, user_cache, u_cache, du_cache, +import Base: resize! +import SciMLBase: deleteat!, addat!, full_cache, user_cache, u_cache, du_cache, resize_non_user_cache!, deleteat_non_user_cache!, addat_non_user_cache!, terminate!, get_du, get_dt, get_proposed_dt, set_proposed_dt!, savevalues!, add_tstop!, has_tstop, first_tstop, pop_tstop!, add_saveat!, set_reltol!, - set_abstol!, postamble!, last_step_failed, - isautodifferentiable -import DiffEqBase: get_tstops, get_tstops_array, get_tstops_max + set_abstol!, postamble!, last_step_failed +import DiffEqBase: get_tstops, get_tstops_array -using DiffEqBase: check_error!, @def, _vec, _reshape +# `check_error!` is owned by (and public in) SciMLBase, re-exported through DiffEqBase. +# `_vec`/`_reshape`/`unwrap_cache` are owned by SciMLBase and re-exported here for +# dependent OrdinaryDiffEq.jl sublibraries that import them from this package. +using SciMLBase: check_error!, _vec, _reshape, unwrap_cache -using FastBroadcast: @.., Serial, Threaded +using FastBroadcast: @.. using FunctionWrappers: FunctionWrapper using SciMLBase: NoInit, CheckInit, OverrideInit, AbstractDEProblem, _unwrap_val, ODEAliasSpecifier +# Names previously relied on implicitly through `@reexport using SciMLBase`. +using SciMLBase: SciMLBase, CallbackSet, ContinuousCallback, DAEProblem, + DAESolution, DiscreteProblem, DynamicalODEFunction, + IntervalNonlinearProblem, NonlinearLeastSquaresProblem, + ODEProblem, ReturnCode, SplitFunction, SplitSDEFunction, + VectorContinuousCallback, auto_dt_reset!, derivative_discontinuity!, + get_tmp_cache, isinplace, reinit! +using SciMLOperators: SciMLOperators +using CommonSolve: solve + import SciMLBase: AbstractNonlinearProblem, alg_order, LinearAliasSpecifier -import SciMLBase: unwrap_cache, - islinear -import DiffEqBase: calculate_residuals, - calculate_residuals!, @tight_loop_macros, - timedepentdtmin +import SciMLBase: islinear +# `calculate_residuals`/`calculate_residuals!` are unused here but re-exported for +# dependent OrdinaryDiffEq.jl sublibraries that import them from this package. +import DiffEqBase: timedepentdtmin, calculate_residuals, calculate_residuals! # MacroTools and Adapt imported but not directly used in OrdinaryDiffEqCore # using MacroTools, Adapt -import ADTypes: AutoFiniteDiff, AutoForwardDiff, AbstractADType, AutoSparse, dense_ad +import ADTypes: AutoFiniteDiff, AutoForwardDiff, AutoSparse, dense_ad import Accessors: @reset # SciMLStructures symbols imported but not directly used in OrdinaryDiffEqCore # using SciMLStructures: canonicalize, Tunable, isscimlstructure -using SciMLLogging: SciMLLogging, @SciMLMessage, MessageLevel, - None, Minimal, Standard, Detailed, All, Silent, InfoLevel, WarnLevel, ErrorLevel +# `Minimal` is unused here but re-exported for dependent OrdinaryDiffEq.jl +# sublibraries that import it from this package. +using SciMLLogging: SciMLLogging, @SciMLMessage, Standard, Minimal using SymbolicIndexingInterface: state_values import SymbolicIndexingInterface: parameter_values -using ConcreteStructs: @concrete - using EnumX: @enumx import EnzymeCore @@ -148,7 +158,7 @@ const TryAgain = SlowConvergence isdiscretecache(cache) = false -unitfulvalue(x) = DiffEqBase.unitfulvalue(x) +unitfulvalue(x) = SciMLBase.unitfulvalue(x) # Declare the documented custom-stepsize-controller author interface `public` so downstream # packages can drop their `OrdinaryDiffEqCore.X` non-public ExplicitImports ignores. These @@ -195,4 +205,69 @@ include("enzyme_rules.jl") include("precompilation_setup.jl") +# Solver-author extension API. These names are the documented/intended interface +# that downstream OrdinaryDiffEq.jl / StochasticDiffEq.jl solver packages subtype, +# extend, or call. They are made public (not exported) so that ExplicitImports' +# public-API checks recognize them as the supported extension surface. Genuine +# codegen/perf internals (@fold/@threaded/@OnDemandTableauExtract/@swap!) and +# precompile-workload helpers are deliberately NOT included here. +@static if VERSION >= v"1.11.0-DEV.469" + eval(Expr( + :public, + :AbstractController, :AbstractControllerCache, :AbstractNLSolver, :AbstractNLSolverAlgorithm, :AbstractNLSolverCache, :AbstractThreadingOption, + :accept_step_controller, :alg_adaptive_order, :alg_autodiff, :alg_cache, :alg_difftype, :alg_extrapolates, + :alg_maximum_order, :alg_stability_size, :AutoAlgSwitch, :AutoSwitch, :AutoSwitchCache, :BaseThreads, + :beta1_default, :beta2_default, Symbol("@cache"), :COEFFICIENT_MULTISTEP, :CommonControllerOptions, :CompositeAlgorithm, + :CompositeCache, :CompositeController, :CompositeControllerCache, :constvalue, :Convergence, :current_extrapolant, + :current_interpolant, :DAEAlgorithm, :default_autoswitch, :DefaultCache, :default_controller, :default_linear_interpolation, + :default_nlsolve, :DEOptions, :DIRK, :Divergence, :dt_required, :DummyController, + :DummyControllerCache, :explicit_rk_docstring, :ExponentialAlgorithm, :FastConvergence, :gamma_default, :generic_solver_docstring, + :get_current_adaptive_order, :get_current_alg_autodiff, :get_differential_vars, :get_EEst, :get_failfactor, :get_fsalfirstlast, + :get_gamma, :get_new_W_γdt_cutoff, :get_qmax, :get_qmax_first_step, :get_qmin, :get_qsteady_max, + :get_qsteady_min, :get_W, :GLM, :hermite_interpolant, :IController, :IControllerCache, + :ImplicitSecondOrderAlgorithm, :increment_accept!, :increment_nf!, :increment_reject!, :InterpolationData, :isautoswitch, + :is_composite_algorithm, :is_composite_cache, :is_constant_cache, :isdefaultalg, :isdtchangeable, :isfirstcall, + :isfirststage, :isfsal, :isimplicit, :isJcurrent, :is_mass_matrix_alg, :ismultistep, + :issplit, :isthreaded, :isWmethod, :MethodType, :NewtonAlgorithm, :nlsolve_f, + :NLStatus, :NORDSIECK_MULTISTEP, :_ode_addsteps!, :ode_addsteps!, :ODEIntegrator, :_ode_interpolant, + :OrdinaryDiffEqAdamsVarOrderVarStepAlgorithm, :OrdinaryDiffEqAdaptiveAlgorithm, :OrdinaryDiffEqAdaptiveExponentialAlgorithm, :OrdinaryDiffEqAdaptiveImplicitAlgorithm, :OrdinaryDiffEqAdaptiveImplicitSecondOrderAlgorithm, :OrdinaryDiffEqAdaptivePartitionedAlgorithm, + :OrdinaryDiffEqAlgorithm, :OrdinaryDiffEqCache, :OrdinaryDiffEqCompositeAlgorithm, :OrdinaryDiffEqConstantCache, :OrdinaryDiffEqExponentialAlgorithm, :OrdinaryDiffEqImplicitAlgorithm, + :OrdinaryDiffEqImplicitSecondOrderAlgorithm, :OrdinaryDiffEqInterpolation, :OrdinaryDiffEqLinearExponentialAlgorithm, :OrdinaryDiffEqMutableCache, :OrdinaryDiffEqNewtonAdaptiveAlgorithm, :OrdinaryDiffEqNewtonAlgorithm, + :OrdinaryDiffEqPartitionedAlgorithm, :OrdinaryDiffEqRosenbrockAdaptiveAlgorithm, :OrdinaryDiffEqRosenbrockAlgorithm, :PartitionedAlgorithm, :perform_step!, :PIController, + :PIControllerCache, :PIDController, :PIDControllerCache, :PolyesterThreads, :post_newton_controller!, :PredictiveController, + :PredictiveControllerCache, :qmax_default, :qmin_default, :reinit_controller!, :resize_J_W!, :resize_nlsolver!, + :RosenbrockAlgorithm, :Sequential, :set_EEst!, :set_new_W!, :setup_controller_cache, :set_W_γdt!, + :SlowConvergence, :step_accept_controller!, :step_reject_controller!, :stepsize_controller!, :StochasticDiffEqAdaptiveAlgorithm, :StochasticDiffEqAlgorithm, + :StochasticDiffEqCache, :StochasticDiffEqCompositeAlgorithm, :StochasticDiffEqConstantCache, :StochasticDiffEqJumpAdaptiveAlgorithm, :StochasticDiffEqJumpAlgorithm, :StochasticDiffEqJumpDiffusionAdaptiveAlgorithm, + :StochasticDiffEqJumpDiffusionAlgorithm, :StochasticDiffEqJumpNewtonAdaptiveAlgorithm, :StochasticDiffEqJumpNewtonDiffusionAdaptiveAlgorithm, :StochasticDiffEqMutableCache, :StochasticDiffEqNewtonAdaptiveAlgorithm, :StochasticDiffEqNewtonAlgorithm, + :StochasticDiffEqRODEAdaptiveAlgorithm, :StochasticDiffEqRODEAlgorithm, :StochasticDiffEqRODECompositeAlgorithm, :strip_cache, :sync_controllers!, :TryAgain, + :unwrap_alg, :uses_uprev, :VerySlowConvergence, + # Round 2: remaining cross-sublib / extension surface owned by OrdinaryDiffEqCore. + # Error / sentinel / dispatch-helper types shared across solver sublibs. + :CompiledFloats, :DerivativeOrderNotPossibleError, :DifferentialVarsUndefined, + # Interpolation kernels (companions to the public _ode_interpolant / ode_addsteps!). + :_ode_interpolant!, :ode_interpolant, :ode_interpolant!, :hermite_interpolant!, + :current_extrapolant!, :interpolation_differential_vars, + # Algorithm-trait predicates extended/queried by solver sublibs. + :standardtag, :concrete_jac, :has_autodiff, :has_dtnew_modification, + :has_special_newton_error, :has_stiff_interpolation, :alg_can_repeat_jac, + :allows_null_u0, :isaposteriori, :isdiscretealg, :isdiscretecache, :isdp8, + :isesdirk, :isfirk, :isnewton, :only_diagonal_mass_matrix, :fsal_typeof, + :ssp_coefficient, :fac_default_gamma, :qsteady_max_default, :qsteady_min_default, + # Order / stepsize / autodiff-config accessors used across sublibs. + :get_current_alg_order, :get_current_qmax, :get_chunksize, :_get_fdtype, + :_get_fwd_chunksize, :_get_fwd_chunksize_int, :_fixup_ad, :diffdir, + :error_constant, :unitfulvalue, + # Integrator step / cache / initialization hooks. + :_ode_init, :_determine_initdt, :ode_determine_initdt, :_initialize_dae!, + :postamble!, :apply_step!, :last_step_failed, :reset_alg_dependent_opts!, + :handle_callback_modifiers!, :set_discontinuity, :resolve_basic, + # Noise hooks used by the SDE/RODE solver sublibs. + :accept_noise!, :reinit_noise!, :reject_noise!, :save_noise!, :noise_curt, + :is_noise_saveable, + # Docstring builder used by solver sublibs. + :differentiation_rk_docstring, + )) +end + end diff --git a/lib/OrdinaryDiffEqCore/src/initdt.jl b/lib/OrdinaryDiffEqCore/src/initdt.jl index 67015a880f3..f4968abe3f7 100644 --- a/lib/OrdinaryDiffEqCore/src/initdt.jl +++ b/lib/OrdinaryDiffEqCore/src/initdt.jl @@ -16,7 +16,7 @@ oneunit_tType = oneunit(t) dtmax_tdir = tdir * dtmax - dtmin = nextfloat(max(integrator.opts.dtmin, convert(_tType, oneunit_tType * eps(DiffEqBase.value(t))))) + dtmin = nextfloat(max(integrator.opts.dtmin, convert(_tType, oneunit_tType * eps(SciMLBase.value(t))))) smalldt = max(dtmin, convert(_tType, oneunit_tType * 1 // 10^(6))) if integrator.isdae @@ -194,7 +194,7 @@ (d₁ < 1 // 10^(5)), smalldt, convert( _tType, - oneunit_tType * DiffEqBase.value( + oneunit_tType * SciMLBase.value( (d₀ / d₁) / 100 ) @@ -278,7 +278,7 @@ dt₁ = convert( _tType, oneunit_tType * - DiffEqBase.value( + SciMLBase.value( 10.0^(-(2 + log10(max_d₁d₂)) / order) ) ) @@ -335,7 +335,7 @@ end oneunit_tType = oneunit(t) dtmax_tdir = tdir * dtmax - dtmin = nextfloat(max(integrator.opts.dtmin, convert(_tType, oneunit_tType * eps(DiffEqBase.value(t))))) + dtmin = nextfloat(max(integrator.opts.dtmin, convert(_tType, oneunit_tType * eps(SciMLBase.value(t))))) smalldt = max(dtmin, convert(_tType, oneunit_tType * 1 // 10^(6))) if integrator.isdae @@ -386,7 +386,7 @@ end if d₀ < 1 // 10^(5) || d₁ < 1 // 10^(5) dt₀ = smalldt else - dt₀ = convert(_tType, oneunit_tType * DiffEqBase.value((d₀ / d₁) / 100)) + dt₀ = convert(_tType, oneunit_tType * SciMLBase.value((d₀ / d₁) / 100)) end dt₀ = min(dt₀, dtmax_tdir) dt₀_tdir = tdir * dt₀ @@ -417,7 +417,7 @@ end else dt₁ = _tType( oneunit_tType * - DiffEqBase.value( + SciMLBase.value( 10^(-(2 + log10(max_d₁d₂)) / order) ) ) diff --git a/lib/OrdinaryDiffEqCore/src/initialize_dae.jl b/lib/OrdinaryDiffEqCore/src/initialize_dae.jl index b29de2ed34a..62d7fe476d8 100644 --- a/lib/OrdinaryDiffEqCore/src/initialize_dae.jl +++ b/lib/OrdinaryDiffEqCore/src/initialize_dae.jl @@ -13,7 +13,7 @@ variable, then the system is not Index 1! ## Expansion -function DiffEqBase.initialize_dae!( +function SciMLBase.initialize_dae!( integrator::ODEIntegrator, initializealg = integrator.initializealg ) diff --git a/lib/OrdinaryDiffEqCore/src/integrators/controllers.jl b/lib/OrdinaryDiffEqCore/src/integrators/controllers.jl index 8b956cb9ebe..c653adfbf30 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/controllers.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/controllers.jl @@ -551,16 +551,16 @@ end @inline function stepsize_controller!(integrator, cache::IControllerCache, alg) (; qmin, qmax, gamma) = cache.controller.basic qmax = get_current_qmax(integrator, qmax) - EEst = DiffEqBase.value(get_EEst(integrator)) + EEst = SciMLBase.value(get_EEst(integrator)) if iszero(EEst) q = inv(qmax) else expo = 1 / (get_current_adaptive_order(alg, integrator.cache) + 1) qtmp = fastpower(EEst, expo) / gamma - @fastmath q = DiffEqBase.value(max(inv(qmax), min(inv(qmin), qtmp))) + @fastmath q = SciMLBase.value(max(inv(qmax), min(inv(qmin), qtmp))) # TODO: Shouldn't this be in `step_accept_controller!` as for the PI controller? - cache.dtreject = DiffEqBase.value(integrator.dt) / q + cache.dtreject = SciMLBase.value(integrator.dt) / q end return q end @@ -693,7 +693,7 @@ end (; qmin, qmax, gamma) = controller.basic qmax = get_current_qmax(integrator, qmax) (; beta1, beta2) = controller - EEst = DiffEqBase.value(get_EEst(integrator)) + EEst = SciMLBase.value(get_EEst(integrator)) if iszero(EEst) q = inv(qmax) @@ -710,7 +710,7 @@ function step_accept_controller!(integrator, cache::PIControllerCache, alg, q) (; controller) = cache (; qsteady_min, qsteady_max) = controller.basic qoldinit = controller.qoldinit - EEst = DiffEqBase.value(get_EEst(integrator)) + EEst = SciMLBase.value(get_EEst(integrator)) if qsteady_min <= q <= qsteady_max q = one(q) @@ -900,7 +900,7 @@ end (; controller) = cache beta1, beta2, beta3 = controller.beta - EEst = DiffEqBase.value(get_EEst(integrator)) + EEst = SciMLBase.value(get_EEst(integrator)) # If the error estimate is zero, we can increase the step size as much as # desired. This additional check fixes problems of the code below when the @@ -1082,7 +1082,7 @@ end @inline function stepsize_controller!(integrator, cache::PredictiveControllerCache, alg) (; qmin, qmax, gamma) = cache.controller.basic qmax = get_current_qmax(integrator, qmax) - EEst = DiffEqBase.value(get_EEst(integrator)) + EEst = SciMLBase.value(get_EEst(integrator)) if iszero(EEst) q = inv(qmax) else @@ -1099,7 +1099,7 @@ end end expo = 1 / (get_current_adaptive_order(alg, integrator.cache) + 1) qtmp = fastpower(EEst, expo) / fac - @fastmath q = DiffEqBase.value(max(inv(qmax), min(inv(qmin), qtmp))) + @fastmath q = SciMLBase.value(max(inv(qmax), min(inv(qmin), qtmp))) cache.qold = q end return q @@ -1110,7 +1110,7 @@ function step_accept_controller!(integrator, cache::PredictiveControllerCache, a (; qmin, qmax, gamma, qsteady_min, qsteady_max) = controller.basic qmax = get_current_qmax(integrator, qmax) - EEst = DiffEqBase.value(get_EEst(integrator)) + EEst = SciMLBase.value(get_EEst(integrator)) if integrator.success_iter > 0 expo = 1 / (get_current_adaptive_order(alg, integrator.cache) + 1) @@ -1124,7 +1124,7 @@ function step_accept_controller!(integrator, cache::PredictiveControllerCache, a if qsteady_min <= qacc <= qsteady_max qacc = one(qacc) end - cache.dtacc = DiffEqBase.value(integrator.dt) + cache.dtacc = SciMLBase.value(integrator.dt) cache.erracc = max(1.0e-2, EEst) return integrator.dt / qacc diff --git a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl index 28e07c2c7d4..845bdb66c13 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl @@ -56,7 +56,7 @@ function SciMLBase.reeval_internals_due_to_modification!( callback_initializealg = nothing ) if integrator.isdae - DiffEqBase.initialize_dae!( + SciMLBase.initialize_dae!( integrator, isnothing(callback_initializealg) ? integrator.initializealg : callback_initializealg @@ -587,7 +587,7 @@ function SciMLBase.reinit!( if reinit_dae && (integrator.isdae || SciMLBase.has_initializeprob(integrator.sol.prob.f)) - DiffEqBase.initialize_dae!(integrator) + SciMLBase.initialize_dae!(integrator) update_uprev!(integrator) end diff --git a/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl b/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl index dd9dc0a36bd..b405cdd5ac3 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl @@ -91,7 +91,7 @@ post_step_reject!(integrator) = nothing # For SDE: isdae=false skips DAE re-init; isfsal=false makes update_fsal! a no-op. function on_derivative_discontinuity_at_init!(integrator) if integrator.isdae - DiffEqBase.initialize_dae!(integrator) + SciMLBase.initialize_dae!(integrator) end update_uprev!(integrator) return update_fsal!(integrator) @@ -531,7 +531,7 @@ function _loopfooter!(integrator) end integrator.t = fixed_t_for_tstop_error!(integrator, ttmp) - dtnew = DiffEqBase.value( + dtnew = SciMLBase.value( step_accept_controller!( integrator, integrator.alg, @@ -564,7 +564,7 @@ function _loopfooter!(integrator) # Take value because if t is dual then maxeig can be dual if is_composite_cache(integrator.cache) cur_eigen_est = integrator.opts.internalnorm( - DiffEqBase.value(integrator.eigen_est), + SciMLBase.value(integrator.eigen_est), integrator.t ) cur_eigen_est > integrator.stats.maxeig && diff --git a/lib/OrdinaryDiffEqCore/src/misc_utils.jl b/lib/OrdinaryDiffEqCore/src/misc_utils.jl index a130166a388..d2f3ea15e54 100644 --- a/lib/OrdinaryDiffEqCore/src/misc_utils.jl +++ b/lib/OrdinaryDiffEqCore/src/misc_utils.jl @@ -29,12 +29,12 @@ end # Nest one layer of value in order to get rid of possible Dual{Complex} or Complex{Dual} issues # value should recurse for anything else. function constvalue(::Type{T}) where {T} - _T = DiffEqBase.value(T) - return _T <: Complex ? DiffEqBase.value(real(_T)) : DiffEqBase.value(_T) + _T = SciMLBase.value(T) + return _T <: Complex ? SciMLBase.value(real(_T)) : SciMLBase.value(_T) end function constvalue(x) - _x = DiffEqBase.value(x) - return _x isa Complex ? DiffEqBase.value(real(_x)) : DiffEqBase.value(_x) + _x = SciMLBase.value(x) + return _x isa Complex ? SciMLBase.value(real(_x)) : SciMLBase.value(_x) end function diffdir(integrator::SciMLBase.DEIntegrator) diff --git a/lib/OrdinaryDiffEqCore/src/solve.jl b/lib/OrdinaryDiffEqCore/src/solve.jl index e82fcbb80fb..e1240f747e6 100644 --- a/lib/OrdinaryDiffEqCore/src/solve.jl +++ b/lib/OrdinaryDiffEqCore/src/solve.jl @@ -11,10 +11,10 @@ Base.@constprop :aggressive function SciMLBase.__solve( return integrator.sol end -determine_controller_datatype(u::AbstractVector{<:Number}, internalnorm, ts::Tuple{<:Number, <:Number}) = promote_type(typeof(DiffEqBase.value(internalnorm(u, ts[1]))), typeof(DiffEqBase.value(internalnorm(u, ts[2]))), eltype(DiffEqBase.value.(ts))) -determine_controller_datatype(u, internalnorm, ts::Tuple{<:Number, <:Number}) = promote_type(typeof(DiffEqBase.value(ts[1])), typeof(DiffEqBase.value(ts[2]))) # This seems to be an assumption implicitly taken somewhere -determine_controller_datatype(u::AbstractVector{<:Number}, internalnorm, ts::Tuple{<:Integer, <:Integer}) = promote_type(typeof(DiffEqBase.value(internalnorm(u, ts[1]))), typeof(DiffEqBase.value(internalnorm(u, ts[2]))), eltype(float.(DiffEqBase.value(ts)))) -determine_controller_datatype(u, internalnorm, ts::Tuple{<:Integer, <:Integer}) = promote_type(typeof(float(DiffEqBase.value(ts[1]))), typeof(float(DiffEqBase.value(ts[2])))) # This seems to be an assumption implicitly taken somewhere +determine_controller_datatype(u::AbstractVector{<:Number}, internalnorm, ts::Tuple{<:Number, <:Number}) = promote_type(typeof(SciMLBase.value(internalnorm(u, ts[1]))), typeof(SciMLBase.value(internalnorm(u, ts[2]))), eltype(SciMLBase.value.(ts))) +determine_controller_datatype(u, internalnorm, ts::Tuple{<:Number, <:Number}) = promote_type(typeof(SciMLBase.value(ts[1])), typeof(SciMLBase.value(ts[2]))) # This seems to be an assumption implicitly taken somewhere +determine_controller_datatype(u::AbstractVector{<:Number}, internalnorm, ts::Tuple{<:Integer, <:Integer}) = promote_type(typeof(SciMLBase.value(internalnorm(u, ts[1]))), typeof(SciMLBase.value(internalnorm(u, ts[2]))), eltype(float.(SciMLBase.value(ts)))) +determine_controller_datatype(u, internalnorm, ts::Tuple{<:Integer, <:Integer}) = promote_type(typeof(float(SciMLBase.value(ts[1]))), typeof(float(SciMLBase.value(ts[2])))) # This seems to be an assumption implicitly taken somewhere mutable struct zero_func_struct{u1Type, uType, tType, kType, CacheType, idxsType, varsType, callbackType, outType, FunctionType, tType2, ParameterType} u₁::u1Type @@ -729,7 +729,7 @@ Base.@constprop :aggressive function _ode_init( if initialize_integrator if isdae || SciMLBase.has_initializeprob(prob.f) || prob isa SciMLBase.ImplicitDiscreteProblem - DiffEqBase.initialize_dae!(integrator) + SciMLBase.initialize_dae!(integrator) !isnothing(integrator.u) && update_uprev!(integrator) end diff --git a/lib/OrdinaryDiffEqCore/test/qa/Project.toml b/lib/OrdinaryDiffEqCore/test/qa/Project.toml index ef0cd1c61ff..beec6f9c9e6 100644 --- a/lib/OrdinaryDiffEqCore/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqCore/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -16,4 +17,5 @@ Aqua = "0.8.11" DiffEqBase = "7" JET = "0.9, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/OrdinaryDiffEqCore/test/qa/qa.jl b/lib/OrdinaryDiffEqCore/test/qa/qa.jl index b06c50545fb..b5624c83158 100644 --- a/lib/OrdinaryDiffEqCore/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqCore/test/qa/qa.jl @@ -1,11 +1,71 @@ -using OrdinaryDiffEqCore -using Aqua -using Test +using SciMLTesting, OrdinaryDiffEqCore, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqCore; - piracies = false, - unbound_args = false - ) -end +# `OrdinaryDiffEqCore.Predictor` is a generated `EnumX.@enumx` submodule, which +# ExplicitImports cannot statically analyze; allow it to be unanalyzable. +const UNANALYZABLE = (OrdinaryDiffEqCore.Predictor,) + +run_qa( + OrdinaryDiffEqCore; + aqua_kwargs = (; piracies = false, unbound_args = false), + explicit_imports = true, + ei_kwargs = (; + no_implicit_imports = (; allow_unanalyzable = UNANALYZABLE), + # These names are not used by OrdinaryDiffEqCore itself, but are imported + # into its namespace and re-imported by dependent OrdinaryDiffEq.jl + # sublibraries (e.g. `import OrdinaryDiffEqCore: calculate_residuals!`). + # ExplicitImports cannot see that cross-package usage, so it reports them + # as stale; they must remain part of this package's namespace contract. + no_stale_explicit_imports = (; + allow_unanalyzable = UNANALYZABLE, + ignore = ( + :BrownFullBasicInit, :ShampineCollocationInit, :DEVerbosity, + :Minimal, :_vec, :_reshape, :unwrap_cache, + :calculate_residuals, :calculate_residuals!, + ), + ), + # `constructorof` is owned by ConstructionBase but reached through SciMLBase + # (not a direct dependency); accessing it via SciMLBase is intentional. + all_qualified_accesses_via_owners = (; ignore = (:constructorof,)), + # Internal (non-`public`) names of upstream packages that OrdinaryDiffEqCore + # genuinely needs and that have no public replacement yet. + all_qualified_accesses_are_public = (; + ignore = ( + # Base / Core internals + Symbol("@max_methods"), :Experimental, :Typeof, :promote_op, + # ConstructionBase (owned there, accessed via SciMLBase) + :constructorof, + # SciMLOperators internal + :AbstractSciMLOperator, + # EnzymeCore / EnzymeCore.EnzymeRules internals + :EnzymeRules, :inactive_noinl, + # SciMLBase internals with no public replacement yet + :enable_interpolation_sensitivitymode, + :forwarddiff_chunksize, :get_root_indp, + :get_save_idxs_and_saved_subsystem, :has_initializeprob, + :has_lazy_interpolation, :late_binding_update_u0_p, :remaker_of, + :save_discretes_if_enabled!, :save_final_discretes!, + :strip_interpolation, :struct_as_namedtuple, :unitfulvalue, + :unwrap_cache, :value, + ), + ), + # Internal (non-`public`) names imported from upstream packages. + all_explicit_imports_are_public = (; + ignore = ( + # TruncatedStacktraces internals + Symbol("@truncate_stacktrace"), :VERBOSE_MSG, + # FunctionWrappers internal + :FunctionWrapper, + # FastPower internal + :fastpower, + # SciMLBase internals + :SENSITIVITY_INTERP_MESSAGE, :_unwrap_val, :last_step_failed, + :postamble!, + # DiffEqBase internal + :_process_verbose_param, + # Non-public names re-exported for dependent sublibraries + # (see `no_stale_explicit_imports` above). + :_vec, :_reshape, :unwrap_cache, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqDefault/src/OrdinaryDiffEqDefault.jl b/lib/OrdinaryDiffEqDefault/src/OrdinaryDiffEqDefault.jl index 2c1a359791c..cfa66b61498 100644 --- a/lib/OrdinaryDiffEqDefault/src/OrdinaryDiffEqDefault.jl +++ b/lib/OrdinaryDiffEqDefault/src/OrdinaryDiffEqDefault.jl @@ -1,22 +1,21 @@ module OrdinaryDiffEqDefault using OrdinaryDiffEqCore: alg_stability_size, beta2_default, beta1_default, AutoSwitchCache, - ODEIntegrator, trivial_limiter!, PIController, - CompositeAlgorithm, OrdinaryDiffEqAlgorithm, - OrdinaryDiffEqMutableCache, AutoAlgSwitch -using OrdinaryDiffEqVerner: Vern7, Vern8, Vern9, Vern6 + CompositeAlgorithm, AutoAlgSwitch +using OrdinaryDiffEqVerner: Vern7 using OrdinaryDiffEqTsit5: Tsit5 using OrdinaryDiffEqRosenbrock: Rosenbrock23, Rodas5P using OrdinaryDiffEqBDF: FBDF, DFBDF import OrdinaryDiffEqCore import OrdinaryDiffEqCore: is_mass_matrix_alg, default_autoswitch, isdefaultalg -import ADTypes: AutoFiniteDiff, AutoForwardDiff, AbstractADType +import ADTypes: AutoFiniteDiff import LinearSolve -using LinearAlgebra: I, isdiag -using EnumX +using LinearAlgebra: I +using EnumX: EnumX -using Reexport +using Reexport: Reexport, @reexport +using SciMLBase: SciMLBase, ODEProblem, DAEProblem, solve @reexport using SciMLBase include("default_alg.jl") diff --git a/lib/OrdinaryDiffEqDefault/test/qa/Project.toml b/lib/OrdinaryDiffEqDefault/test/qa/Project.toml index 292ddc0cb31..ef03a9cce22 100644 --- a/lib/OrdinaryDiffEqDefault/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqDefault/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqDefault = "50262376-6c5a-4cf5-baba-aaf4f84d72d7" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -16,4 +17,5 @@ Aqua = "0.8.11" JET = "0.9, 0.11" OrdinaryDiffEqCore = "4" OrdinaryDiffEqDefault = "2" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/OrdinaryDiffEqDefault/test/qa/qa.jl b/lib/OrdinaryDiffEqDefault/test/qa/qa.jl index da05ddc9cee..e6e9bfacee6 100644 --- a/lib/OrdinaryDiffEqDefault/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqDefault/test/qa/qa.jl @@ -1,9 +1,29 @@ -using OrdinaryDiffEqDefault -using Aqua +using SciMLTesting, OrdinaryDiffEqDefault, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqDefault; - piracies = false - ) -end +# `DefaultSolverChoice` is an `EnumX.@enumx`-generated submodule that +# ExplicitImports cannot statically analyze. Its members (`Tsit5`, `Vern7`, +# `Rosenbrock23`, `Rodas5P`, `FBDF`, ...) share names with the solver types +# imported into `OrdinaryDiffEqDefault`, so the stale-import analysis +# mis-attributes those still-used imports as unused. +const ENUM_SUBMODULE = (OrdinaryDiffEqDefault.DefaultSolverChoice,) + +run_qa( + OrdinaryDiffEqDefault; + aqua_kwargs = (; piracies = false), + explicit_imports = true, + ei_kwargs = (; + no_implicit_imports = (; allow_unanalyzable = ENUM_SUBMODULE), + no_stale_explicit_imports = (; + allow_unanalyzable = ENUM_SUBMODULE, + # Used by `default_alg.jl` (solver constructors) but mis-flagged + # stale because of the unanalyzable enum submodule above. + ignore = (:Tsit5, :Vern7, :Rosenbrock23, :Rodas5P, :FBDF), + ), + all_qualified_accesses_are_public = (; + # `lorenz`/`lorenz_oop` are OrdinaryDiffEqCore precompile-workload + # test problems (defined in `precompilation_setup.jl`), deliberately + # not part of its public extension surface. + ignore = (:lorenz, :lorenz_oop), + ), + ), +) diff --git a/lib/OrdinaryDiffEqDifferentiation/Project.toml b/lib/OrdinaryDiffEqDifferentiation/Project.toml index ed1b9c46f9d..a35ea8030b9 100644 --- a/lib/OrdinaryDiffEqDifferentiation/Project.toml +++ b/lib/OrdinaryDiffEqDifferentiation/Project.toml @@ -1,5 +1,5 @@ name = "OrdinaryDiffEqDifferentiation" -version = "3.2.1" +version = "3.2.2" uuid = "4302a76b-040a-498a-8c04-15b101fed76b" authors = ["Chris Rackauckas ", "Yingbo Ma "] diff --git a/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl b/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl index 5eba9a5d03b..96263bc1dcb 100644 --- a/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl +++ b/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl @@ -11,19 +11,18 @@ import FunctionWrappersWrappers import DiffEqBase import LinearAlgebra -import LinearAlgebra: Diagonal, I, UniformScaling, diagind, mul!, lmul!, axpby!, opnorm, lu -import LinearAlgebra: LowerTriangular, UpperTriangular +import LinearAlgebra: Diagonal, I, UniformScaling, diagind, opnorm +import LinearAlgebra: LowerTriangular import ArrayInterface -import ArrayInterface: fast_scalar_indexing, zeromatrix, lu_instance import StaticArraysCore: StaticArray, StaticMatrix -using DiffEqBase: TimeGradientWrapper, - UJacobianWrapper, TimeDerivativeWrapper, - UDerivativeWrapper -import SciMLBase: SciMLBase, constructorof, @set, isinplace, has_jvp, unwrapped_f, DEIntegrator, ODEFunction, SplitFunction, DynamicalODEFunction, DAEFunction, islinear, remake, solve!, isconstant -using SciMLBase: @set, @reset -import SciMLOperators: SciMLOperators, IdentityOperator, update_coefficients, update_coefficients!, MatrixOperator, AbstractSciMLOperator, ScalarOperator +# `_vec`, `_unwrap_val`, `UDerivativeWrapper`, `UJacobianWrapper` are owned by +# SciMLBase (OrdinaryDiffEqCore/DiffEqBase only re-export them), so import them +# from the owner to satisfy `all_explicit_imports_via_owners`. +using SciMLBase: UJacobianWrapper, UDerivativeWrapper, _vec, _unwrap_val +import SciMLBase: SciMLBase, @set, DEIntegrator, ODEFunction, SplitFunction, DAEFunction, islinear, remake, solve!, isconstant +import SciMLOperators: SciMLOperators, update_coefficients, update_coefficients!, MatrixOperator, AbstractSciMLOperator import SparseMatrixColorings: ConstantColoringAlgorithm, GreedyColoringAlgorithm, ColoringProblem, ncolors, column_colors, coloring, sparsity_pattern import OrdinaryDiffEqCore @@ -32,24 +31,18 @@ using OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, OrdinaryDiffEqAdaptiveImplici OrdinaryDiffEqImplicitAlgorithm, CompositeAlgorithm, OrdinaryDiffEqExponentialAlgorithm, OrdinaryDiffEqAdaptiveExponentialAlgorithm, - StochasticDiffEqNewtonAlgorithm, StochasticDiffEqNewtonAdaptiveAlgorithm, - StochasticDiffEqJumpNewtonAdaptiveAlgorithm, - StochasticDiffEqJumpNewtonDiffusionAdaptiveAlgorithm, AbstractNLSolver, nlsolve_f, issplit, - concrete_jac, unwrap_alg, OrdinaryDiffEqCache, _vec, standardtag, - isnewton, _unwrap_val, - set_new_W!, set_W_γdt!, alg_difftype, unwrap_cache, diffdir, + concrete_jac, unwrap_alg, OrdinaryDiffEqCache, + isnewton, + set_new_W!, set_W_γdt!, diffdir, get_W, isfirstcall, isfirststage, isJcurrent, get_new_W_γdt_cutoff, isWmethod, - TryAgain, DIRK, COEFFICIENT_MULTISTEP, NORDSIECK_MULTISTEP, GLM, - FastConvergence, Convergence, SlowConvergence, - VerySlowConvergence, Divergence, NLStatus, MethodType, constvalue, @SciMLMessage + TryAgain, + Divergence, constvalue, @SciMLMessage -import OrdinaryDiffEqCore: get_chunksize, resize_J_W!, resize_nlsolver!, alg_autodiff, - _get_fwd_tag +import OrdinaryDiffEqCore: get_chunksize, resize_J_W!, alg_autodiff import ConstructionBase -using ConstructionBase: constructorof import DifferentiationInterface as DI @@ -83,4 +76,17 @@ include("derivative_utils.jl") include("derivative_wrappers.jl") include("operators.jl") +# Documented solver-author extension API: the Jacobian/W-matrix and +# differentiation-config hooks that downstream OrdinaryDiffEq solver sublibraries +# build on. Codegen/perf internals are intentionally left non-public. +@static if VERSION >= v"1.11.0-DEV.469" + eval(Expr(:public, + :build_J_W, :build_grad_config, :build_jac_config, :build_uf, + :calc_J, :calc_J!, :calc_tderivative, :calc_tderivative!, + :calc_rosenbrock_differentiation, :calc_rosenbrock_differentiation!, + :jacobian!, :jacobian2W!, :update_W!, + :resize_grad_config!, :resize_jac_config!, + :dolinsolve, :wrapprecs, :is_always_new, :islinearfunction, :issuccess_W)) +end + end diff --git a/lib/OrdinaryDiffEqDifferentiation/test/qa/Project.toml b/lib/OrdinaryDiffEqDifferentiation/test/qa/Project.toml index 21801030488..e878fbec165 100644 --- a/lib/OrdinaryDiffEqDifferentiation/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqDifferentiation/test/qa/Project.toml @@ -1,10 +1,15 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +[sources.DiffEqBase] +path = "../../../DiffEqBase" + [sources.OrdinaryDiffEqCore] path = "../../../OrdinaryDiffEqCore" @@ -13,7 +18,9 @@ path = "../.." [compat] Aqua = "0.8.11" +DiffEqBase = "7" JET = "0.9, 0.11" OrdinaryDiffEqCore = "4" OrdinaryDiffEqDifferentiation = "3" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/OrdinaryDiffEqDifferentiation/test/qa/qa.jl b/lib/OrdinaryDiffEqDifferentiation/test/qa/qa.jl index 35a110b433d..ccbcc923c96 100644 --- a/lib/OrdinaryDiffEqDifferentiation/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqDifferentiation/test/qa/qa.jl @@ -1,10 +1,55 @@ -using OrdinaryDiffEqDifferentiation -using Aqua +using SciMLTesting, OrdinaryDiffEqDifferentiation, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqDifferentiation; - piracies = false, - ambiguities = false - ) -end +# Residual ExplicitImports ignores. After the solver-author extension API of +# OrdinaryDiffEqCore / OrdinaryDiffEqDifferentiation / DiffEqBase was declared +# `public` (Julia 1.11+ `public`), the only names left are genuine non-public +# externals, this sublib's own internal sparse-handling API, and a small set of +# OrdinaryDiffEqCore names not yet in that public block (make-public follow-ups, +# tracked in SciML/OrdinaryDiffEq.jl#3776). +run_qa( + OrdinaryDiffEqDifferentiation; + aqua_kwargs = (; piracies = false, ambiguities = false), + explicit_imports = true, + ei_kwargs = (; + # `@set` (Accessors) and `@SciMLMessage` (SciMLLogging) are re-exported by + # SciMLBase / OrdinaryDiffEqCore; their owners are not direct deps. + all_explicit_imports_via_owners = (; ignore = (Symbol("@set"), Symbol("@SciMLMessage"))), + all_qualified_accesses_via_owners = (; ignore = (Symbol("@set"),)), + all_explicit_imports_are_public = (; + ignore = ( + # Accessors `@set` / SciMLLogging `@SciMLMessage` re-exported by + # SciMLBase / OrdinaryDiffEqCore (owners are not direct deps) + Symbol("@set"), Symbol("@SciMLMessage"), + # SciMLBase internal helpers (make-public candidates) + :_unwrap_val, :_vec, + # OrdinaryDiffEqCore internals not yet in its public block + :concrete_jac, :diffdir, :get_chunksize, :isnewton, + # other framework internals + :AbstractSciMLOperator, # SciMLOperators + :StaticArray, :StaticMatrix, # StaticArraysCore + ), + ), + all_qualified_accesses_are_public = (; + ignore = ( + Symbol("@pure"), # Base + Symbol("@set"), # Accessors macro re-exported by SciMLBase + :AbstractSciMLOperator, # SciMLOperators + # LinearSolve internals + :DefaultLinearSolver, :InvPreconditioner, :LinearCache, + :init_cacheval, :needs_concrete_A, + # ForwardDiff internals + :JacobianConfig, :Tag, :pickchunksize, + # OrdinaryDiffEqCore internal not yet in its public block + :_get_fwd_chunksize_int, + # SciMLBase Jacobian-interface predicates (make-public candidates) + :has_Wfact_t, :has_colorvec, :has_jac_du, :has_jac_u, + # DifferentiationInterface internals + Symbol("prepare!_derivative"), Symbol("prepare!_jacobian"), + # this sublib's own internal sparse-handling API, accessed + # qualified from OrdinaryDiffEqDifferentiationSparseArraysExt + :get_nzval, :is_sparse, :is_sparse_csc, :nonzeros, + Symbol("set_all_nzval!"), :spzeros, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl b/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl index 9c9aa385a3f..bfd6eb685eb 100644 --- a/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl +++ b/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl @@ -1,21 +1,27 @@ module OrdinaryDiffEqExplicitRK -import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, alg_stability_size, +import OrdinaryDiffEqCore: alg_adaptive_order, alg_stability_size, OrdinaryDiffEqAdaptiveAlgorithm, @cache, alg_cache, OrdinaryDiffEqConstantCache, unwrap_alg, - OrdinaryDiffEqMutableCache, initialize!, perform_step!, isfsal, - CompositeAlgorithm, calculate_residuals!, calculate_residuals, - full_cache, get_fsalfirstlast, + OrdinaryDiffEqMutableCache, perform_step!, isfsal, + CompositeAlgorithm, + get_fsalfirstlast, _ode_interpolant, _ode_interpolant!, - _ode_addsteps!, copyat_or_push!, + _ode_addsteps!, DerivativeOrderNotPossibleError -using TruncatedStacktraces: @truncate_stacktrace -using RecursiveArrayTools, FastBroadcast, MuladdMacro, DiffEqBase +import SciMLBase: alg_order +import DiffEqBase: calculate_residuals, calculate_residuals!, initialize! +using TruncatedStacktraces: TruncatedStacktraces, @truncate_stacktrace +using RecursiveArrayTools: RecursiveArrayTools, copyat_or_push!, recursivefill! +using FastBroadcast: FastBroadcast, @.. +using MuladdMacro: MuladdMacro, @muladd +using DiffEqBase: DiffEqBase import LinearAlgebra: norm import OrdinaryDiffEqCore +using SciMLBase: SciMLBase -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase include("algorithms.jl") include("alg_utils.jl") diff --git a/lib/OrdinaryDiffEqExplicitRK/test/qa/Project.toml b/lib/OrdinaryDiffEqExplicitRK/test/qa/Project.toml index dfcd43e19df..a4da92f52b2 100644 --- a/lib/OrdinaryDiffEqExplicitRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqExplicitRK/test/qa/Project.toml @@ -1,23 +1,26 @@ [deps] AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqExplicitRK = "9286f039-9fbf-40e8-bf65-aa933bdc4db0" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[sources.OrdinaryDiffEqExplicitRK] -path = "../../" - -[sources.OrdinaryDiffEqCore] -path = "../../../OrdinaryDiffEqCore" +[sources] +DiffEqBase = {path = "../../../DiffEqBase"} +OrdinaryDiffEqCore = {path = "../../../OrdinaryDiffEqCore"} +OrdinaryDiffEqExplicitRK = {path = "../.."} [compat] AllocCheck = "0.2" Aqua = "0.8.11" +DiffEqBase = "6, 7" JET = "0.9, 0.11" -julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqExplicitRK = "2" SciMLBase = "3" +SciMLTesting = "1.7" +julia = "1.10" diff --git a/lib/OrdinaryDiffEqExplicitRK/test/qa/qa.jl b/lib/OrdinaryDiffEqExplicitRK/test/qa/qa.jl index b4c63ca2d70..ecd43246396 100644 --- a/lib/OrdinaryDiffEqExplicitRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqExplicitRK/test/qa/qa.jl @@ -1,8 +1,20 @@ -using OrdinaryDiffEqExplicitRK -using Aqua +using SciMLTesting, OrdinaryDiffEqExplicitRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqExplicitRK - ) -end +run_qa( + OrdinaryDiffEqExplicitRK; + explicit_imports = true, + ei_kwargs = (; + all_explicit_imports_are_public = (; + ignore = ( + # TruncatedStacktraces-owned macro (external, not `public`). + Symbol("@truncate_stacktrace"), + ), + ), + all_qualified_accesses_are_public = (; + ignore = ( + # Base.Cartesian codegen macros (external, not `public`). + Symbol("@nexprs"), Symbol("@nif"), + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqExplicitTableaus/test/qa/Project.toml b/lib/OrdinaryDiffEqExplicitTableaus/test/qa/Project.toml index ed0ce48e713..d9c87ad9373 100644 --- a/lib/OrdinaryDiffEqExplicitTableaus/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqExplicitTableaus/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqExplicitTableaus = "3278f1b1-0f5c-4cde-98e0-ba5eb00db955" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.DiffEqBase] @@ -16,5 +17,6 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqExplicitTableaus = "2" +SciMLTesting = "1.7" Test = "1" julia = "1.10" diff --git a/lib/OrdinaryDiffEqExplicitTableaus/test/qa/qa.jl b/lib/OrdinaryDiffEqExplicitTableaus/test/qa/qa.jl index 8b907941026..0b7933835ba 100644 --- a/lib/OrdinaryDiffEqExplicitTableaus/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqExplicitTableaus/test/qa/qa.jl @@ -1,12 +1,8 @@ -using OrdinaryDiffEqExplicitTableaus -using Aqua +using SciMLTesting, OrdinaryDiffEqExplicitTableaus, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(OrdinaryDiffEqExplicitTableaus) -end - -@testset "JET" begin - JET.test_package(OrdinaryDiffEqExplicitTableaus; target_defined_modules = true) -end +run_qa( + OrdinaryDiffEqExplicitTableaus; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, +) diff --git a/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl b/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl index 4689df60712..cd695cf0426 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl @@ -1,30 +1,35 @@ module OrdinaryDiffEqExponentialRK -import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, ismultistep, +import OrdinaryDiffEqCore: alg_adaptive_order, ismultistep, OrdinaryDiffEqExponentialAlgorithm, - _unwrap_val, OrdinaryDiffEqMutableCache, + OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, @cache, alg_cache, - initialize!, perform_step!, unwrap_alg, - OrdinaryDiffEqAdaptiveExponentialAlgorithm, CompositeAlgorithm, + perform_step!, unwrap_alg, + OrdinaryDiffEqAdaptiveExponentialAlgorithm, ExponentialAlgorithm, fsal_typeof, isdtchangeable, - calculate_residuals, calculate_residuals!, full_cache, get_fsalfirstlast, - generic_solver_docstring, _ad_chunksize_int, _ad_fdtype, _fixup_ad + generic_solver_docstring, _fixup_ad import OrdinaryDiffEqCore -using RecursiveArrayTools -using MuladdMacro, FastBroadcast +using RecursiveArrayTools: RecursiveArrayTools +import RecursiveArrayTools: recursivecopy! +using MuladdMacro: MuladdMacro, @muladd +using FastBroadcast: FastBroadcast, @.. using LinearAlgebra: axpy!, mul! import DiffEqBase -import DiffEqBase: prepare_alg -using ExponentialUtilities -import RecursiveArrayTools: recursivecopy! -using OrdinaryDiffEqDifferentiation: build_jac_config, UJacobianWrapper, UDerivativeWrapper, - calc_J, calc_J! -import ADTypes: AutoForwardDiff, AbstractADType +import DiffEqBase: calculate_residuals, calculate_residuals!, initialize! +using ExponentialUtilities: ExponentialUtilities, ExpvCache, KrylovSubspace, + PhivCache, arnoldi, arnoldi!, expv, expv!, phi, + phiv, phiv!, phiv_timestep, phiv_timestep! +# alg_order / _unwrap_val are owned by SciMLBase (re-exported through OrdinaryDiffEqCore); +# import from the owner to satisfy ExplicitImports' via-owners check. +import SciMLBase: alg_order, _unwrap_val, UJacobianWrapper, UDerivativeWrapper +using OrdinaryDiffEqDifferentiation: build_jac_config, calc_J, calc_J! +import ADTypes: AutoForwardDiff -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase +using SciMLBase: SciMLBase, SplitFunction include("algorithms.jl") include("alg_utils.jl") diff --git a/lib/OrdinaryDiffEqExponentialRK/test/qa/Project.toml b/lib/OrdinaryDiffEqExponentialRK/test/qa/Project.toml index 4c8b01a682a..f21fc7c8b64 100644 --- a/lib/OrdinaryDiffEqExponentialRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqExponentialRK/test/qa/Project.toml @@ -1,23 +1,29 @@ [deps] AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqExponentialRK = "e0540318-69ee-4070-8777-9e2de6de23de" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[sources.OrdinaryDiffEqExponentialRK] -path = "../../" - -[sources.OrdinaryDiffEqCore] -path = "../../../OrdinaryDiffEqCore" +[sources] +DiffEqBase = {path = "../../../DiffEqBase"} +OrdinaryDiffEqCore = {path = "../../../OrdinaryDiffEqCore"} +OrdinaryDiffEqDifferentiation = {path = "../../../OrdinaryDiffEqDifferentiation"} +OrdinaryDiffEqExponentialRK = {path = "../.."} [compat] AllocCheck = "0.2" Aqua = "0.8.11" +DiffEqBase = "7" JET = "0.9, 0.11" -julia = "1.10" OrdinaryDiffEqCore = "4" +OrdinaryDiffEqDifferentiation = "3" OrdinaryDiffEqExponentialRK = "2" SciMLBase = "3" +SciMLTesting = "1.7" +julia = "1.10" diff --git a/lib/OrdinaryDiffEqExponentialRK/test/qa/qa.jl b/lib/OrdinaryDiffEqExponentialRK/test/qa/qa.jl index 7697d47cb5a..4514bf7907c 100644 --- a/lib/OrdinaryDiffEqExponentialRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqExponentialRK/test/qa/qa.jl @@ -1,8 +1,16 @@ -using OrdinaryDiffEqExponentialRK -using Aqua +using SciMLTesting, OrdinaryDiffEqExponentialRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqExponentialRK - ) -end +run_qa( + OrdinaryDiffEqExponentialRK; + explicit_imports = true, + ei_kwargs = ( + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore owner-internal helpers (deliberately not in the + # solver-author public API surface declared upstream). + :_fixup_ad, :fsal_typeof, + # SciMLBase internal; pending a `public` declaration (SciMLBase#1412). + :_unwrap_val, + )), + ), +) diff --git a/lib/OrdinaryDiffEqExtrapolation/Project.toml b/lib/OrdinaryDiffEqExtrapolation/Project.toml index 92bcfdee0ab..3c3b80405b5 100644 --- a/lib/OrdinaryDiffEqExtrapolation/Project.toml +++ b/lib/OrdinaryDiffEqExtrapolation/Project.toml @@ -15,6 +15,8 @@ RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" FastPower = "a4df4552-cc26-4903-aec0-212e50a0e84b" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLLogging = "a6db7da4-7206-11f0-1eab-35f2a5dbe1d1" +SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" [extras] Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" @@ -49,6 +51,8 @@ DiffEqBase = "7" Polyester = "0.7" Reexport = "1.2.2" SafeTestsets = "0.1.0" +SciMLLogging = "2" +SciMLOperators = "1" [targets] test = ["DiffEqDevTools", "Polyester", "Random", "RecursiveFactorization", "SafeTestsets", "Test", "Pkg"] diff --git a/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl b/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl index 461afd780bd..805e48c926f 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl @@ -1,39 +1,50 @@ module OrdinaryDiffEqExtrapolation -import OrdinaryDiffEqCore: alg_order, alg_maximum_order, get_current_adaptive_order, - get_current_alg_order, calculate_residuals!, +import OrdinaryDiffEqCore: alg_maximum_order, get_current_adaptive_order, + get_current_alg_order, accept_step_controller, beta2_default, beta1_default, gamma_default, - initialize!, perform_step!, @cache, unwrap_alg, - isthreaded, isadaptive, PIController, - step_accept_controller!, calculate_residuals, + perform_step!, @cache, unwrap_alg, + isthreaded, PIController, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, reset_alg_dependent_opts!, AbstractController, step_accept_controller!, step_reject_controller!, OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqAdaptiveImplicitAlgorithm, alg_cache, CompiledFloats, @threaded, stepsize_controller!, - full_cache, qmin_default, qmax_default, - constvalue, PolyesterThreads, Sequential, BaseThreads, - _digest_beta1_beta2, timedepentdtmin, _unwrap_val, - _reshape, _vec, get_fsalfirstlast, generic_solver_docstring, - differentiation_rk_docstring, _ad_chunksize_int, _ad_fdtype, _fixup_ad, - LinearAliasSpecifier, @SciMLMessage, Minimal - -using FastBroadcast, MuladdMacro, RecursiveArrayTools, LinearSolve + full_cache, qmin_default, + constvalue, PolyesterThreads, + _fixup_ad, + get_fsalfirstlast, generic_solver_docstring, + differentiation_rk_docstring, + LinearAliasSpecifier +import OrdinaryDiffEqCore: default_controller, AbstractControllerCache, setup_controller_cache, + get_qmin, get_qmax import OrdinaryDiffEqCore + +# Owned by SciMLBase / DiffEqBase / SciMLOperators, re-exported through +# OrdinaryDiffEqCore / OrdinaryDiffEqDifferentiation — import from the owners directly so +# ExplicitImports' owner check is satisfied. +import SciMLBase: alg_order, _unwrap_val, _reshape, _vec, + TimeDerivativeWrapper, UDerivativeWrapper, + TimeGradientWrapper, UJacobianWrapper +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals!, timedepentdtmin + +using FastBroadcast: FastBroadcast, @.. +using MuladdMacro: MuladdMacro, @muladd +using RecursiveArrayTools: RecursiveArrayTools, recursivefill! +using LinearSolve: LinearSolve, RFLUFactorization import FastPower -import OrdinaryDiffEqDifferentiation: TimeDerivativeWrapper, UDerivativeWrapper, calc_J, - WOperator, TimeGradientWrapper, UJacobianWrapper, +using SciMLOperators: SciMLOperators, WOperator +import SciMLLogging: @SciMLMessage +import OrdinaryDiffEqDifferentiation: calc_J, build_grad_config, build_jac_config, calc_J!, jacobian2W!, dolinsolve -import ADTypes: AutoForwardDiff, AbstractADType - -import OrdinaryDiffEqCore: default_controller, AbstractControllerCache, setup_controller_cache, - get_qmin, get_qmax +import ADTypes: AutoForwardDiff -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase +using SciMLBase: SciMLBase, LinearProblem, init include("algorithms.jl") include("alg_utils.jl") diff --git a/lib/OrdinaryDiffEqExtrapolation/test/qa/Project.toml b/lib/OrdinaryDiffEqExtrapolation/test/qa/Project.toml index ff76759238d..4cc1c7c5546 100644 --- a/lib/OrdinaryDiffEqExtrapolation/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqExtrapolation/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqExtrapolation = "becaefa8-8ca2-5cf9-886d-c06f3d2bd2c4" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqExtrapolation] @@ -17,6 +18,7 @@ path = "../../../OrdinaryDiffEqCore" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqExtrapolation = "2" diff --git a/lib/OrdinaryDiffEqExtrapolation/test/qa/qa.jl b/lib/OrdinaryDiffEqExtrapolation/test/qa/qa.jl index b2f09dee0bf..759afc97903 100644 --- a/lib/OrdinaryDiffEqExtrapolation/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqExtrapolation/test/qa/qa.jl @@ -1,8 +1,33 @@ -using OrdinaryDiffEqExtrapolation -using Aqua +using SciMLTesting, OrdinaryDiffEqExtrapolation, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqExtrapolation - ) -end +# After the solver-author extension API was declared `public` in OrdinaryDiffEqCore / +# OrdinaryDiffEqDifferentiation / OrdinaryDiffEqNonlinearSolve / DiffEqBase, the only +# remaining ExplicitImports public-API exceptions are the genuinely-internal names +# below that have no public replacement: OrdinaryDiffEqCore's private `@threaded` +# codegen macro and `_resolved_QT` controller helper, plus a handful of upstream +# (SciMLBase / FastPower / Base.Threads) internals. Everything else is clean. +# Tracked for a future make-public pass; see SciML/OrdinaryDiffEq.jl#3776. +run_qa( + OrdinaryDiffEqExtrapolation; + explicit_imports = true, + ei_kwargs = (; + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore private codegen macro (deliberately kept non-public) + Symbol("@threaded"), + # SciMLBase internals (reshaping / val-unwrap helpers, no public replacement) + :_reshape, :_unwrap_val, :_vec, + ), + ), + all_qualified_accesses_are_public = (; + ignore = ( + # OrdinaryDiffEqCore owner-internal (controller QT resolution) + :_resolved_QT, + # other upstream internals + :fastpower, # FastPower + :has_Wfact, # SciMLBase + :maxthreadid, # Base.Threads + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl b/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl index 70fa90df7e1..626941241b3 100644 --- a/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl +++ b/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl @@ -1,41 +1,48 @@ module OrdinaryDiffEqFIRK -import OrdinaryDiffEqCore: alg_order, calculate_residuals!, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, default_controller, PredictiveController, PIController, - OrdinaryDiffEqAlgorithm, OrdinaryDiffEqNewtonAdaptiveAlgorithm, +import OrdinaryDiffEqCore: unwrap_alg, + default_controller, PredictiveController, PIController, + OrdinaryDiffEqNewtonAdaptiveAlgorithm, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, - OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev, - alg_cache, _vec, _reshape, @cache, @threaded, isthreaded, - PolyesterThreads, - isfsal, full_cache, constvalue, _unwrap_val, + alg_cache, @threaded, isthreaded, + constvalue, differentiation_rk_docstring, trivial_limiter!, - _ode_interpolant!, _ode_addsteps!, AbstractController, qmax_default, alg_adaptive_order, - stepsize_controller!, step_accept_controller!, - step_reject_controller!, + step_accept_controller!, step_reject_controller!, alg_can_repeat_jac, NewtonAlgorithm, - fac_default_gamma, get_current_adaptive_order, get_fsalfirstlast, get_current_alg_order, - isfirk, generic_solver_docstring, - _ad_chunksize_int, _ad_fdtype, _fixup_ad, - LinearAliasSpecifier, set_discontinuity -using MuladdMacro, DiffEqBase, RecursiveArrayTools, Polyester -using SciMLOperators: AbstractSciMLOperator -using LinearAlgebra: I, UniformScaling, mul!, lu, dot, eigvals + isfirk, + _fixup_ad, perform_step!, + LinearAliasSpecifier, set_discontinuity, + Convergence, FastConvergence, NLStatus, + VerySlowConvergence, Divergence, get_new_W_γdt_cutoff +import SciMLBase +import SciMLBase: alg_order, _vec, _reshape, _unwrap_val, + UDerivativeWrapper, UJacobianWrapper, value, + LinearProblem, get_tmp_cache, init +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals! +using MuladdMacro: @muladd +using RecursiveArrayTools: recursivefill! +import Polyester +using LinearAlgebra: I, UniformScaling, mul!, lu, dot import LinearSolve import FastBroadcast: @.. import OrdinaryDiffEqCore -import OrdinaryDiffEqCore: _ode_interpolant, _ode_interpolant!, has_stiff_interpolation +import OrdinaryDiffEqCore: _ode_interpolant, _ode_interpolant!, _ode_addsteps!, + has_stiff_interpolation import FastPower: fastpower -using OrdinaryDiffEqDifferentiation: UJacobianWrapper, build_J_W, build_jac_config, - UDerivativeWrapper, calc_J!, dolinsolve, calc_J, +using OrdinaryDiffEqDifferentiation: build_J_W, build_jac_config, + calc_J!, dolinsolve, calc_J, islinearfunction -using OrdinaryDiffEqNonlinearSolve: du_alias_or_new, Convergence, FastConvergence, NLStatus, - VerySlowConvergence, - Divergence, get_new_W_γdt_cutoff -import ADTypes: AutoForwardDiff, AbstractADType +import ADTypes: AutoForwardDiff +import SciMLOperators +import SciMLOperators: AbstractSciMLOperator +# Load-bearing runtime dependency: provides the nonlinear-solver machinery the FIRK +# integrators dispatch into. The convergence-state names FIRK uses are owned by +# OrdinaryDiffEqCore (imported above), so this is a module-only import to keep the +# dependency from registering as stale. +import OrdinaryDiffEqNonlinearSolve import OrdinaryDiffEqCore: PredictiveControllerCache @@ -50,7 +57,7 @@ else end end -using Reexport +using Reexport: @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqFIRK/src/controllers.jl b/lib/OrdinaryDiffEqFIRK/src/controllers.jl index 473c9be9dfe..140707e95de 100644 --- a/lib/OrdinaryDiffEqFIRK/src/controllers.jl +++ b/lib/OrdinaryDiffEqFIRK/src/controllers.jl @@ -7,7 +7,7 @@ function step_accept_controller!( (; cache) = integrator (; num_stages, step, iter, hist_iter, index) = cache - EEst = DiffEqBase.value(OrdinaryDiffEqCore.get_EEst(integrator)) + EEst = value(OrdinaryDiffEqCore.get_EEst(integrator)) if integrator.success_iter > 0 expo = 1 / (get_current_adaptive_order(alg, cache) + 1) diff --git a/lib/OrdinaryDiffEqFIRK/test/qa/Project.toml b/lib/OrdinaryDiffEqFIRK/test/qa/Project.toml index afa4cd0c969..751a7063442 100644 --- a/lib/OrdinaryDiffEqFIRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqFIRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqFIRK = "5960d6e9-dd7a-4743-88e7-cf307b64f125" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqFIRK] @@ -17,6 +18,7 @@ path = "../../../OrdinaryDiffEqCore" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqFIRK = "2" diff --git a/lib/OrdinaryDiffEqFIRK/test/qa/qa.jl b/lib/OrdinaryDiffEqFIRK/test/qa/qa.jl index c5183342538..ed57373371d 100644 --- a/lib/OrdinaryDiffEqFIRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqFIRK/test/qa/qa.jl @@ -1,8 +1,26 @@ -using OrdinaryDiffEqFIRK -using Aqua +using SciMLTesting, OrdinaryDiffEqFIRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqFIRK - ) -end +# The solver-author API of OrdinaryDiffEqCore / OrdinaryDiffEqDifferentiation / +# OrdinaryDiffEqNonlinearSolve / DiffEqBase is now declared `public` on this branch, +# so those names no longer need ignoring. The residual below is the genuine set of +# non-public internals with no public alternative, grouped by owning package. Any +# name later made public will surface as an Unexpected Pass and can be dropped. +# See SciML/OrdinaryDiffEq.jl#3776. +run_qa( + OrdinaryDiffEqFIRK; + explicit_imports = true, + ei_kwargs = ( + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore — private codegen macro / default no-op limiter, + # kept owner-internal (no public alternative). + Symbol("@threaded"), :trivial_limiter!, + # SciMLBase internal helpers (pending public decl, SciMLBase#1412). + :_reshape, :_unwrap_val, :_vec, :value, + # Genuine external deps, non-public in their owner. + :fastpower, # FastPower + :AbstractSciMLOperator, # SciMLOperators + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl b/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl index e1ed9f5c528..8c247a96498 100644 --- a/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl +++ b/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl @@ -1,21 +1,20 @@ module OrdinaryDiffEqFeagin -import OrdinaryDiffEqCore: alg_order, calculate_residuals!, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, - OrdinaryDiffEqAlgorithm, +import OrdinaryDiffEqCore: perform_step!, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, - OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev, - alg_cache, _vec, _reshape, @cache, isfsal, full_cache, - constvalue, _unwrap_val, get_fsalfirstlast, - generic_solver_docstring, trivial_limiter!, - _ode_interpolant!, _ode_addsteps! -using FastBroadcast, MuladdMacro, RecursiveArrayTools -using DiffEqBase: @def, @tight_loop_macros -using FastBroadcast: Serial + OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, + alg_cache, @cache, full_cache, + constvalue, get_fsalfirstlast, + generic_solver_docstring, trivial_limiter! +import SciMLBase: alg_order +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals! +import FastBroadcast: @.. +import MuladdMacro: @muladd +import RecursiveArrayTools: recursivefill! +using DiffEqBase: @tight_loop_macros import OrdinaryDiffEqCore -using Reexport +using Reexport: @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqFeagin/test/qa/Project.toml b/lib/OrdinaryDiffEqFeagin/test/qa/Project.toml index 4ea99a92378..01fb780a9ca 100644 --- a/lib/OrdinaryDiffEqFeagin/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqFeagin/test/qa/Project.toml @@ -1,12 +1,17 @@ [deps] AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqFeagin = "101fe9f7-ebb6-4678-b671-3a81e7194747" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +[sources.DiffEqBase] +path = "../../../DiffEqBase" + [sources.OrdinaryDiffEqCore] path = "../../../OrdinaryDiffEqCore" @@ -16,7 +21,9 @@ path = "../../" [compat] AllocCheck = "0.2" Aqua = "0.8.11" +DiffEqBase = "7" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqFeagin = "2" diff --git a/lib/OrdinaryDiffEqFeagin/test/qa/qa.jl b/lib/OrdinaryDiffEqFeagin/test/qa/qa.jl index 1676c92185f..13eac13824d 100644 --- a/lib/OrdinaryDiffEqFeagin/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqFeagin/test/qa/qa.jl @@ -1,8 +1,18 @@ -using OrdinaryDiffEqFeagin -using Aqua +using SciMLTesting, OrdinaryDiffEqFeagin, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqFeagin - ) -end +run_qa( + OrdinaryDiffEqFeagin; + explicit_imports = true, + ei_kwargs = (; + # `@reexport using SciMLBase` deliberately re-exports SciMLBase's API + # as part of this solver package's public surface. + no_implicit_imports = (; ignore = (:SciMLBase,)), + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore-owned internals, deliberately not `public`. + :CompiledFloats, :trivial_limiter!, + # DiffEqBase-owned internal macro, deliberately not `public`. + Symbol("@tight_loop_macros"), + )), + ), +) diff --git a/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl b/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl index 5217b73d8a0..eefdd5c73ce 100644 --- a/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl +++ b/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl @@ -1,20 +1,22 @@ module OrdinaryDiffEqFunctionMap import OrdinaryDiffEqCore: isfsal, beta2_default, beta1_default, OrdinaryDiffEqAlgorithm, - initialize!, perform_step!, unwrap_alg, + perform_step!, unwrap_alg, OrdinaryDiffEqMutableCache, alg_cache, @cache, _ode_addsteps!, _ode_interpolant!, _ode_interpolant, get_fsalfirstlast, - alg_order, OrdinaryDiffEqConstantCache, dt_required, + OrdinaryDiffEqConstantCache, dt_required, isdiscretecache, isdiscretealg, full_cache -using DiffEqBase +using DiffEqBase: DiffEqBase +import DiffEqBase: initialize! import RecursiveArrayTools: recursivecopy! import FastBroadcast: @.. import MuladdMacro: @muladd -using FastBroadcast: Serial import OrdinaryDiffEqCore -using Reexport +using Reexport: Reexport, @reexport +using SciMLBase: SciMLBase +import SciMLBase: alg_order @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqFunctionMap/src/fixed_timestep_perform_step.jl b/lib/OrdinaryDiffEqFunctionMap/src/fixed_timestep_perform_step.jl index 4e5fee9313b..b6bc0210c8a 100644 --- a/lib/OrdinaryDiffEqFunctionMap/src/fixed_timestep_perform_step.jl +++ b/lib/OrdinaryDiffEqFunctionMap/src/fixed_timestep_perform_step.jl @@ -7,10 +7,10 @@ function perform_step!(integrator, cache::FunctionMapCache, repeat_step = false) (; u, uprev, dt, t, f, p) = integrator alg = unwrap_alg(integrator, nothing) (; tmp) = cache - return if integrator.f != DiffEqBase.DISCRETE_INPLACE_DEFAULT && + return if integrator.f != SciMLBase.DISCRETE_INPLACE_DEFAULT && !( integrator.f isa DiffEqBase.EvalFunc && - integrator.f.f === DiffEqBase.DISCRETE_INPLACE_DEFAULT + integrator.f.f === SciMLBase.DISCRETE_INPLACE_DEFAULT ) if FunctionMap_scale_by_time(alg) f(tmp, uprev, p, t + dt) @@ -25,10 +25,10 @@ end function perform_step!(integrator, cache::FunctionMapConstantCache, repeat_step = false) (; uprev, dt, t, f, p) = integrator alg = unwrap_alg(integrator, nothing) - return if integrator.f != DiffEqBase.DISCRETE_OUTOFPLACE_DEFAULT && + return if integrator.f != SciMLBase.DISCRETE_OUTOFPLACE_DEFAULT && !( integrator.f isa DiffEqBase.EvalFunc && - integrator.f.f === DiffEqBase.DISCRETE_OUTOFPLACE_DEFAULT + integrator.f.f === SciMLBase.DISCRETE_OUTOFPLACE_DEFAULT ) if FunctionMap_scale_by_time(alg) tmp = f(uprev, p, t + dt) diff --git a/lib/OrdinaryDiffEqFunctionMap/test/qa/Project.toml b/lib/OrdinaryDiffEqFunctionMap/test/qa/Project.toml index d186da2b614..8f15ba89e18 100644 --- a/lib/OrdinaryDiffEqFunctionMap/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqFunctionMap/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqFunctionMap = "d3585ca7-f5d3-4ba6-8057-292ed1abd90f" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqFunctionMap = "2" diff --git a/lib/OrdinaryDiffEqFunctionMap/test/qa/qa.jl b/lib/OrdinaryDiffEqFunctionMap/test/qa/qa.jl index 9c7f1076f31..ef0ba066122 100644 --- a/lib/OrdinaryDiffEqFunctionMap/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqFunctionMap/test/qa/qa.jl @@ -1,9 +1,13 @@ -using OrdinaryDiffEqFunctionMap -using Aqua +using SciMLTesting, OrdinaryDiffEqFunctionMap, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqFunctionMap; - piracies = false # Piracy is necessary for default algorithm dispatch - ) -end +run_qa( + OrdinaryDiffEqFunctionMap; + aqua_kwargs = (; piracies = false), # piracy is needed for default-algorithm dispatch + explicit_imports = true, + ei_kwargs = (; + # SciMLBase-owned default-solve sentinels; non-public in SciMLBase. + all_qualified_accesses_are_public = (; + ignore = (:DISCRETE_INPLACE_DEFAULT, :DISCRETE_OUTOFPLACE_DEFAULT), + ), + ), +) diff --git a/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl b/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl index b99588f5bde..c249fcf96d3 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl +++ b/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl @@ -1,23 +1,24 @@ module OrdinaryDiffEqHighOrderRK -import OrdinaryDiffEqCore: alg_order, qmax_default, qmin_default, beta2_default, +import OrdinaryDiffEqCore: qmax_default, qmin_default, beta2_default, beta1_default, explicit_rk_docstring, OrdinaryDiffEqAdaptiveAlgorithm, trivial_limiter!, _ode_addsteps!, @cache, OrdinaryDiffEqMutableCache, constvalue, - alg_cache, uses_uprev, initialize!, perform_step!, + alg_cache, perform_step!, OrdinaryDiffEqConstantCache, - calculate_residuals!, calculate_residuals, CompiledFloats, - copyat_or_push!, get_fsalfirstlast, + CompiledFloats, + get_fsalfirstlast, unwrap_alg, _ode_interpolant, _ode_interpolant!, DerivativeOrderNotPossibleError, full_cache, isdp8 using FastBroadcast: Serial import MuladdMacro: @muladd -using DiffEqBase import FastBroadcast: @.. -import RecursiveArrayTools: recursivefill! -using DiffEqBase: @def, @tight_loop_macros +import RecursiveArrayTools: recursivefill!, copyat_or_push! +import DiffEqBase: @tight_loop_macros, calculate_residuals, calculate_residuals!, + initialize! +import SciMLBase: alg_order import OrdinaryDiffEqCore using Reexport diff --git a/lib/OrdinaryDiffEqHighOrderRK/test/qa/Project.toml b/lib/OrdinaryDiffEqHighOrderRK/test/qa/Project.toml index 2e5fad54188..f160d3c0bd9 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqHighOrderRK/test/qa/Project.toml @@ -1,23 +1,25 @@ [deps] AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqHighOrderRK = "d28bc4f8-55e1-4f49-af69-84c1a99f0f58" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[sources.OrdinaryDiffEqCore] -path = "../../../OrdinaryDiffEqCore" - -[sources.OrdinaryDiffEqHighOrderRK] -path = "../../" +[sources] +DiffEqBase = {path = "../../../DiffEqBase"} +OrdinaryDiffEqCore = {path = "../../../OrdinaryDiffEqCore"} +OrdinaryDiffEqHighOrderRK = {path = "../.."} [compat] AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" -julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqHighOrderRK = "2" SciMLBase = "3" +SciMLTesting = "1.7" +julia = "1.10" diff --git a/lib/OrdinaryDiffEqHighOrderRK/test/qa/qa.jl b/lib/OrdinaryDiffEqHighOrderRK/test/qa/qa.jl index 1e7b55be83e..07750eecc2f 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqHighOrderRK/test/qa/qa.jl @@ -1,8 +1,25 @@ -using OrdinaryDiffEqHighOrderRK -using Aqua +using SciMLTesting, OrdinaryDiffEqHighOrderRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqHighOrderRK - ) -end +run_qa( + OrdinaryDiffEqHighOrderRK; + explicit_imports = true, + ei_kwargs = ( + # `@reexport using SciMLBase` is the intended public-API reexport; it + # necessarily brings the `SciMLBase`/`Reexport`/`@reexport` bindings in + # implicitly, which there is no way to make explicit. + no_implicit_imports = (ignore = (:SciMLBase, :Reexport, Symbol("@reexport")),), + # `@tight_loop_macros` is used inside the `@muladd`-expanded perform_step/ + # addsteps bodies, which ExplicitImports cannot see, so it reads as a stale + # positive; it is a DiffEqBase-internal codegen macro (not public upstream). + no_stale_explicit_imports = (ignore = (Symbol("@tight_loop_macros"),),), + all_explicit_imports_are_public = ( + ignore = ( + # DiffEqBase-internal codegen macro (not declared public upstream). + Symbol("@tight_loop_macros"), + # OrdinaryDiffEqCore-internal no-op limiter default, deliberately + # kept non-public. + :trivial_limiter!, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl b/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl index 4704424e650..381f53f329f 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl +++ b/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl @@ -1,20 +1,21 @@ module OrdinaryDiffEqIMEXMultistep -import OrdinaryDiffEqCore: alg_order, issplit, OrdinaryDiffEqNewtonAlgorithm, _unwrap_val, +import OrdinaryDiffEqCore: issplit, OrdinaryDiffEqNewtonAlgorithm, OrdinaryDiffEqConstantCache, OrdinaryDiffEqMutableCache, - @cache, alg_cache, initialize!, perform_step!, - full_cache, get_fsalfirstlast, @SciMLMessage, - generic_solver_docstring, _ad_chunksize_int, _ad_fdtype, _fixup_ad + @cache, alg_cache, perform_step!, + full_cache, get_fsalfirstlast, + generic_solver_docstring, _fixup_ad +import SciMLBase: alg_order, _unwrap_val +import DiffEqBase: initialize! -using FastBroadcast +using FastBroadcast: @.. import OrdinaryDiffEqCore -using OrdinaryDiffEqDifferentiation: dolinsolve using OrdinaryDiffEqNonlinearSolve: NLNewton, build_nlsolver, markfirststage!, nlsolve!, nlsolvefail, du_alias_or_new -import ADTypes: AutoForwardDiff, AbstractADType +import ADTypes: AutoForwardDiff -using Reexport +using Reexport: @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqIMEXMultistep/test/qa/Project.toml b/lib/OrdinaryDiffEqIMEXMultistep/test/qa/Project.toml index 01f5176f2f2..773d04a5ddc 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqIMEXMultistep/test/qa/Project.toml @@ -1,23 +1,29 @@ [deps] AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqIMEXMultistep = "9f002381-b378-40b7-97a6-27a27c83f129" +OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[sources.OrdinaryDiffEqCore] -path = "../../../OrdinaryDiffEqCore" - -[sources.OrdinaryDiffEqIMEXMultistep] -path = "../../" +[sources] +DiffEqBase = {path = "../../../DiffEqBase"} +OrdinaryDiffEqCore = {path = "../../../OrdinaryDiffEqCore"} +OrdinaryDiffEqDifferentiation = {path = "../../../OrdinaryDiffEqDifferentiation"} +OrdinaryDiffEqIMEXMultistep = {path = "../.."} +OrdinaryDiffEqNonlinearSolve = {path = "../../../OrdinaryDiffEqNonlinearSolve"} [compat] AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" -julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqIMEXMultistep = "2" SciMLBase = "3" +SciMLTesting = "1.7" +julia = "1.10" diff --git a/lib/OrdinaryDiffEqIMEXMultistep/test/qa/qa.jl b/lib/OrdinaryDiffEqIMEXMultistep/test/qa/qa.jl index 0448efc483c..6d0681289cf 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqIMEXMultistep/test/qa/qa.jl @@ -1,8 +1,16 @@ -using OrdinaryDiffEqIMEXMultistep -using Aqua +using SciMLTesting, OrdinaryDiffEqIMEXMultistep, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqIMEXMultistep - ) -end +run_qa( + OrdinaryDiffEqIMEXMultistep; + explicit_imports = true, + ei_kwargs = (; + # `@reexport using SciMLBase` brings the `SciMLBase` module name into scope + # implicitly; this is the intended SciML re-export pattern, not a stray import. + no_implicit_imports = (; ignore = (:SciMLBase,)), + # Solver-internal helpers imported from their owning packages but deliberately + # kept non-public there: + # OrdinaryDiffEqCore: `_fixup_ad` (autodiff-fixup private helper) + # SciMLBase: `_unwrap_val` + all_explicit_imports_are_public = (; ignore = (:_fixup_ad, :_unwrap_val)), + ), +) diff --git a/lib/OrdinaryDiffEqImplicitTableaus/test/qa/Project.toml b/lib/OrdinaryDiffEqImplicitTableaus/test/qa/Project.toml index 015ac946172..e1313ac9b97 100644 --- a/lib/OrdinaryDiffEqImplicitTableaus/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqImplicitTableaus/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqImplicitTableaus = "75f66a49-58fc-43e3-9173-2340726368f7" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.DiffEqBase] @@ -16,5 +17,6 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqImplicitTableaus = "2" +SciMLTesting = "1.7" Test = "1" julia = "1.10" diff --git a/lib/OrdinaryDiffEqImplicitTableaus/test/qa/qa.jl b/lib/OrdinaryDiffEqImplicitTableaus/test/qa/qa.jl index 0f531741bd5..2b0e61c8ee8 100644 --- a/lib/OrdinaryDiffEqImplicitTableaus/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqImplicitTableaus/test/qa/qa.jl @@ -1,12 +1,8 @@ -using OrdinaryDiffEqImplicitTableaus -using Aqua +using SciMLTesting, OrdinaryDiffEqImplicitTableaus, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(OrdinaryDiffEqImplicitTableaus) -end - -@testset "JET" begin - JET.test_package(OrdinaryDiffEqImplicitTableaus; target_defined_modules = true) -end +run_qa( + OrdinaryDiffEqImplicitTableaus; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, +) diff --git a/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl b/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl index 986c0ef4ddc..44d6f1f7086 100644 --- a/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl +++ b/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl @@ -1,24 +1,28 @@ module OrdinaryDiffEqLinear -import OrdinaryDiffEqCore: alg_order, alg_extrapolates, dt_required, +import OrdinaryDiffEqCore: alg_extrapolates, dt_required, OrdinaryDiffEqLinearExponentialAlgorithm, OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqAlgorithm, - OrdinaryDiffEqExponentialAlgorithm, OrdinaryDiffEqMutableCache, @cache, alg_cache, OrdinaryDiffEqConstantCache, - initialize!, perform_step!, unwrap_alg, - calculate_residuals!, get_fsalfirstlast, - _vec, isdtchangeable, full_cache, + perform_step!, unwrap_alg, + get_fsalfirstlast, + isdtchangeable, full_cache, generic_solver_docstring using LinearAlgebra: mul!, I -using SciMLOperators: AbstractSciMLOperator -using ExponentialUtilities -using RecursiveArrayTools +using SciMLOperators: AbstractSciMLOperator, update_coefficients, update_coefficients! +using ExponentialUtilities: ExponentialUtilities, ExpMethodGeneric, ExpvCache, + KrylovSubspace, PhivCache, arnoldi!, exponential!, + expv, expv!, expv_timestep, expv_timestep! +using RecursiveArrayTools: recursivefill! import OrdinaryDiffEqCore import DiffEqBase +import DiffEqBase: calculate_residuals!, initialize! +import SciMLBase: alg_order, _vec -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase +using SciMLBase: SciMLBase, SciMLOperators, SplitFunction include("algorithms.jl") include("alg_utils.jl") diff --git a/lib/OrdinaryDiffEqLinear/test/qa/Project.toml b/lib/OrdinaryDiffEqLinear/test/qa/Project.toml index cea60e4f6cd..39582102a95 100644 --- a/lib/OrdinaryDiffEqLinear/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqLinear/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqLinear = "521117fe-8c41-49f8-b3b6-30780b3f0fb5" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqLinear = "2" diff --git a/lib/OrdinaryDiffEqLinear/test/qa/qa.jl b/lib/OrdinaryDiffEqLinear/test/qa/qa.jl index 223770117fc..30a24c023eb 100644 --- a/lib/OrdinaryDiffEqLinear/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqLinear/test/qa/qa.jl @@ -1,8 +1,25 @@ -using OrdinaryDiffEqLinear -using Aqua +using SciMLTesting, OrdinaryDiffEqLinear, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqLinear - ) -end +run_qa( + OrdinaryDiffEqLinear; + explicit_imports = true, + ei_kwargs = (; + # Residual non-public names below have no public-API replacement yet. + # The OrdinaryDiffEqCore/DiffEqBase solver-author API is now declared + # public on this branch, so those names are no longer ignored here. + all_explicit_imports_are_public = (; + ignore = ( + # SciMLOperators internal abstract type, non-public + :AbstractSciMLOperator, + # SciMLBase internal (owner of _vec), non-public + :_vec, + ), + ), + all_qualified_accesses_are_public = (; + ignore = ( + # ExponentialUtilities internal cache allocator, non-public + :alloc_mem, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqLowOrderRK/Project.toml b/lib/OrdinaryDiffEqLowOrderRK/Project.toml index 8ef9657128b..b6c5db207b8 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/Project.toml +++ b/lib/OrdinaryDiffEqLowOrderRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqLowOrderRK" uuid = "1344f307-1e59-4825-a18e-ace9aa3fa4c6" authors = ["ParamThakkar123 "] -version = "2.1.1" +version = "2.1.2" [deps] MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl b/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl index c68f6134b78..b4d4181b137 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl @@ -1,33 +1,34 @@ module OrdinaryDiffEqLowOrderRK -import OrdinaryDiffEqCore: alg_order, isfsal, beta2_default, beta1_default, +import OrdinaryDiffEqCore: isfsal, beta2_default, beta1_default, alg_stability_size, ssp_coefficient, OrdinaryDiffEqAlgorithm, OrdinaryDiffEqExponentialAlgorithm, explicit_rk_docstring, generic_solver_docstring, trivial_limiter!, OrdinaryDiffEqAdaptiveAlgorithm, - unwrap_alg, initialize!, perform_step!, - calculate_residuals, - calculate_residuals!, _ode_addsteps!, @OnDemandTableauExtract, + unwrap_alg, perform_step!, + _ode_addsteps!, @OnDemandTableauExtract, constvalue, - OrdinaryDiffEqMutableCache, uses_uprev, + OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, @fold, @cache, CompiledFloats, alg_cache, CompositeAlgorithm, AutoAlgSwitch, _ode_interpolant, _ode_interpolant!, full_cache, accept_step_controller, DerivativeOrderNotPossibleError, - du_cache, u_cache, get_fsalfirstlast, copyat_or_push!, _unwrap_val -using SciMLBase + du_cache, u_cache, get_fsalfirstlast +using SciMLBase: SciMLBase +import SciMLBase: alg_order, @def, _unwrap_val import MuladdMacro: @muladd import FastBroadcast: @.. import LinearAlgebra: norm -import RecursiveArrayTools: recursivefill!, recursive_unitless_bottom_eltype +import RecursiveArrayTools: recursivefill!, recursive_unitless_bottom_eltype, + copyat_or_push! using FastBroadcast: Serial -using DiffEqBase: @def, @tight_loop_macros -import DiffEqBase: prepare_alg +using DiffEqBase: @tight_loop_macros, calculate_residuals, calculate_residuals! +import DiffEqBase: prepare_alg, initialize! import OrdinaryDiffEqCore -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase include("algorithms.jl") @@ -48,4 +49,13 @@ export Euler, SplitEuler, Heun, Ralston, Midpoint, RK4, Alshina2, Alshina3, Alshina6, AutoDP5, Ralston4 +# Cross-sublibrary cache/tableau types that other OrdinaryDiffEq solver +# sublibraries (e.g. OrdinaryDiffEqAdamsBashforthMoulton) reference to reuse +# these low-order RK steps. Marked public so those references are recognized as +# a supported extension API rather than internal access. +@static if VERSION >= v"1.11.0-DEV.469" + eval(Expr(:public, + :BS3Cache, :BS3ConstantCache, :RK4Cache, :RK4ConstantCache)) +end + end diff --git a/lib/OrdinaryDiffEqLowOrderRK/test/qa/Project.toml b/lib/OrdinaryDiffEqLowOrderRK/test/qa/Project.toml index a0f327c0f1e..f93678b0c8a 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqLowOrderRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqLowOrderRK = "2" diff --git a/lib/OrdinaryDiffEqLowOrderRK/test/qa/qa.jl b/lib/OrdinaryDiffEqLowOrderRK/test/qa/qa.jl index d4e8d474cc4..7c6f85946f1 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/test/qa/qa.jl @@ -1,8 +1,34 @@ -using OrdinaryDiffEqLowOrderRK -using Aqua +using SciMLTesting, OrdinaryDiffEqLowOrderRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqLowOrderRK - ) -end +run_qa( + OrdinaryDiffEqLowOrderRK; + explicit_imports = true, + ei_kwargs = (; + # SciMLBase's has_lazy_interpolation interpolation trait, accessed via its + # owner module. Not declared public on the registered SciMLBase release. + all_qualified_accesses_are_public = (; + ignore = ( + :has_lazy_interpolation, # SciMLBase + ), + ), + # Owner-internal names imported from their owning module but deliberately + # NOT declared `public`. OrdinaryDiffEqCore's public solver-author API is + # now declared public on this branch; the residual here is the codegen/perf + # macros and a few helpers/types that OrdinaryDiffEqCore keeps internal, + # DiffEqBase's private @tight_loop_macros, and SciMLBase internals. + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore (owner-internal; not part of the public + # solver-author surface declared in OrdinaryDiffEqCore) + :CompiledFloats, :DerivativeOrderNotPossibleError, + Symbol("@fold"), :_ode_interpolant!, + Symbol("@OnDemandTableauExtract"), + :ssp_coefficient, :trivial_limiter!, + # DiffEqBase (private loop macro) + Symbol("@tight_loop_macros"), + # SciMLBase + Symbol("@def"), :_unwrap_val, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqLowStorageRK/Project.toml b/lib/OrdinaryDiffEqLowStorageRK/Project.toml index d1ba47fdc6c..b8ec27ddd85 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/Project.toml +++ b/lib/OrdinaryDiffEqLowStorageRK/Project.toml @@ -4,6 +4,7 @@ authors = ["ParamThakkar123 "] version = "3.1.1" [deps] +CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" @@ -30,6 +31,7 @@ DiffEqBase = {path = "../DiffEqBase"} DiffEqDevTools = {path = "../DiffEqDevTools"} [compat] +CommonSolve = "0.2.4" Pkg = "1" Test = "<0.0.1, 1" FastBroadcast = "1.3" diff --git a/lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl b/lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl index 82d338344b2..001684119da 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl @@ -1,26 +1,29 @@ module OrdinaryDiffEqLowStorageRK -import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, calculate_residuals!, - beta2_default, beta1_default, gamma_default, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, ssp_coefficient, +import OrdinaryDiffEqCore: perform_step!, OrdinaryDiffEqAlgorithm, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, OrdinaryDiffEqAdaptiveAlgorithm, uses_uprev, PIDController, - alg_cache, _vec, _reshape, @cache, isfsal, full_cache, - constvalue, _unwrap_val, - trivial_limiter!, perform_step!, initialize!, - explicit_rk_docstring, get_fsalfirstlast -using FastBroadcast, MuladdMacro, RecursiveArrayTools, Adapt -using FastBroadcast: Serial -import RecursiveArrayTools: recursive_unitless_bottom_eltype + alg_cache, @cache, isfsal, full_cache, + constvalue, + trivial_limiter!, + explicit_rk_docstring, get_fsalfirstlast, + default_controller import OrdinaryDiffEqCore - -import OrdinaryDiffEqCore: default_controller - -using Reexport +# `alg_order` is owned by and public in SciMLBase; `initialize!` is owned by and +# public in DiffEqBase. Import from the true public owners (not re-exporters). +import SciMLBase: alg_order +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals! +using FastBroadcast: FastBroadcast, @.., Serial +using MuladdMacro: MuladdMacro, @muladd +using RecursiveArrayTools: RecursiveArrayTools, recursivefill! +using Adapt: Adapt, adapt +using CommonSolve: solve + +using Reexport: Reexport, @reexport @reexport using SciMLBase +using SciMLBase: SciMLBase, ODEProblem include("arrayfuse.jl") include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqLowStorageRK/test/qa/Project.toml b/lib/OrdinaryDiffEqLowStorageRK/test/qa/Project.toml index 833271b5e7b..383aa417289 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqLowStorageRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqLowStorageRK = "b0944070-b475-4768-8dec-fb6eb410534d" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqLowStorageRK = "3" diff --git a/lib/OrdinaryDiffEqLowStorageRK/test/qa/qa.jl b/lib/OrdinaryDiffEqLowStorageRK/test/qa/qa.jl index 1c6ae493bf4..aec612cd9c0 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/test/qa/qa.jl @@ -1,8 +1,23 @@ -using OrdinaryDiffEqLowStorageRK -using Aqua +using SciMLTesting, OrdinaryDiffEqLowStorageRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqLowStorageRK - ) -end +run_qa( + OrdinaryDiffEqLowStorageRK; + explicit_imports = true, + ei_kwargs = ( + # Every remaining name is a genuine non-public internal of its owner. The + # solver-author API of OrdinaryDiffEqCore / DiffEqBase is now declared + # `public`, so those ignores were dropped. + all_qualified_accesses_are_public = (; + ignore = ( + # OrdinaryDiffEqCore precompile-workload probes (owner-internal) + :lorenz, :lorenz_oop, + # Base.Broadcast internals used in ArrayFuse copyto!/materialize! + :Broadcasted, :materialize!, + )), + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore default no-op limiter (owner-internal) + :trivial_limiter!, + )), + ), +) diff --git a/lib/OrdinaryDiffEqNonlinearSolve/Project.toml b/lib/OrdinaryDiffEqNonlinearSolve/Project.toml index d77cbadbc47..8f44b6f56d0 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/Project.toml +++ b/lib/OrdinaryDiffEqNonlinearSolve/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqNonlinearSolve" uuid = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" authors = ["Chris Rackauckas ", "Yingbo Ma "] -version = "2.0.1" +version = "2.0.2" [deps] NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" @@ -22,8 +22,8 @@ ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226" SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" +ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" [extras] Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" @@ -62,7 +62,7 @@ OrdinaryDiffEqFIRK = "2" OrdinaryDiffEqRosenbrock = "2" OrdinaryDiffEqSDIRK = "2" Statistics = "1.10.0" -SciMLBase = "3.10.0" +SciMLBase = "3.30" OrdinaryDiffEqCore = "4" SimpleNonlinearSolve = "2.11.1" FastClosures = "0.3.2" @@ -78,7 +78,7 @@ PreallocationTools = "1.1.2" DiffEqBase = "7" SafeTestsets = "0.1.0" SciMLOperators = "1.15" -SciMLStructures = "1.7" +ConstructionBase = "1" [targets] test = ["DiffEqDevTools", "LineSearches", "ODEProblemLibrary", "OrdinaryDiffEqBDF", "OrdinaryDiffEqFIRK", "OrdinaryDiffEqRosenbrock", "OrdinaryDiffEqSDIRK", "Random", "SafeTestsets", "StaticArrays", "Statistics", "Test", "Pkg"] diff --git a/lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl b/lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl index beda98b52cf..a96bfd9b1a5 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl +++ b/lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl @@ -1,35 +1,37 @@ module OrdinaryDiffEqNonlinearSolve -using ADTypes: ADTypes, dense_ad, AutoForwardDiff, AutoFiniteDiff +using ADTypes: ADTypes, AutoForwardDiff, AutoFiniteDiff import SciMLBase -import SciMLBase: init, solve, solve!, remake +import SciMLBase: init, solve, remake using SciMLBase: DAEFunction, DEIntegrator, NonlinearFunction, NonlinearProblem, NonlinearLeastSquaresProblem, LinearProblem, ODEProblem, DAEProblem, - update_coefficients!, get_tmp_cache, AbstractSciMLOperator, ReturnCode, - AbstractNonlinearProblem, LinearAliasSpecifier + update_coefficients!, get_tmp_cache, ReturnCode, + AbstractNonlinearProblem, LinearAliasSpecifier, + _vec, _reshape, postamble!, alg_order, isadaptive import DiffEqBase +import DiffEqBase: OrdinaryDiffEqTag, calculate_residuals, calculate_residuals!, + BrownFullBasicInit, ShampineCollocationInit +import ConstructionBase import PreallocationTools: DiffCache, get_tmp using SimpleNonlinearSolve: SimpleTrustRegion, SimpleGaussNewton using NonlinearSolve: FastShortcutNonlinearPolyalg, FastShortcutNLLSPolyalg, NewtonRaphson, - step!, NonlinearVerbosity + step! using MuladdMacro: @muladd using FastBroadcast: @.. import FastClosures: @closure -using LinearAlgebra: UniformScaling, UpperTriangular, givens, cond, dot, lmul!, axpy! +using LinearAlgebra: UniformScaling, UpperTriangular, givens, cond, dot, lmul!, axpy!, + I, rmul!, norm, mul!, ldiv! import LinearAlgebra using SparseArrays: SparseMatrixCSC -import ArrayInterface: ArrayInterface, ismutable, restructure -import LinearSolve: OperatorAssumptions +import ArrayInterface: ArrayInterface import LinearSolve -import ForwardDiff: ForwardDiff, pickchunksize +import ForwardDiff: ForwardDiff using ForwardDiff: Dual -using LinearSolve: I, rmul!, norm, mul!, ldiv! using RecursiveArrayTools: recursivecopy! -import SciMLStructures: canonicalize, Tunable, isscimlstructure import OrdinaryDiffEqCore -import SciMLOperators: islinear +import SciMLOperators: islinear, AbstractSciMLOperator import OrdinaryDiffEqCore: nlsolve_f, set_new_W!, set_W_γdt! import OrdinaryDiffEqCore: default_nlsolve @@ -37,33 +39,26 @@ import OrdinaryDiffEqCore: default_nlsolve using OrdinaryDiffEqCore: resize_nlsolver!, _initialize_dae!, AbstractNLSolverAlgorithm, AbstractNLSolverCache, AbstractNLSolver, NewtonAlgorithm, - OverrideInit, ShampineCollocationInit, BrownFullBasicInit, - _vec, _unwrap_val, DAEAlgorithm, - OrdinaryDiffEqAdaptiveImplicitAlgorithm, - OrdinaryDiffEqImplicitAlgorithm, - OrdinaryDiffEqCompositeAlgorithm, - _reshape, calculate_residuals, calculate_residuals!, - has_special_newton_error, isadaptive, - TryAgain, DIRK, COEFFICIENT_MULTISTEP, NORDSIECK_MULTISTEP, GLM, - FastConvergence, Convergence, - SlowConvergence, VerySlowConvergence, Divergence, NLStatus, - MethodType, alg_order, error_constant, - alg_extrapolates, resize_J_W!, has_autodiff + DAEAlgorithm, + has_special_newton_error, + TryAgain, DIRK, COEFFICIENT_MULTISTEP, + Convergence, + Divergence, NLStatus, + MethodType, error_constant, + alg_extrapolates, resize_J_W!, alg_autodiff import OrdinaryDiffEqCore: _initialize_dae!, isnewton, get_W, isfirstcall, isfirststage, isJcurrent, get_new_W_γdt_cutoff, resize_nlsolver!, apply_step!, - postamble!, @SciMLMessage + @SciMLMessage import OrdinaryDiffEqDifferentiation: update_W!, is_always_new, build_uf, build_J_W, WOperator, StaticWOperator, wrapprecs, - build_jac_config, dolinsolve, alg_autodiff, + build_jac_config, dolinsolve, resize_jac_config!, jacobian2W!, jacobian! import StaticArraysCore: StaticArray -import DiffEqBase: OrdinaryDiffEqTag - include("type.jl") include("utils.jl") include("nlsolve.jl") @@ -73,4 +68,28 @@ include("initialize_dae.jl") export BrownFullBasicInit, ShampineCollocationInit +# Declare the documented solver-author extension API `public` so downstream solver +# packages (the OrdinaryDiffEq solver sublibs, DelayDiffEq's fixed-point solver, etc.) +# can drop their `OrdinaryDiffEqNonlinearSolve.X` non-public ExplicitImports ignores. +# These are the nonlinear-solver algorithm types and the stepping/build hooks that +# downstream packages legitimately construct and extend. The `public` keyword is only +# parseable on Julia >= 1.11.0-DEV.469, so it is gated to keep the 1.10 floor parsing. +# Pure internal codegen/perf helpers are intentionally left non-public. +@static if VERSION >= v"1.11.0-DEV.469" + eval( + Expr( + :public, + # Nonlinear-solver algorithm types + :NLNewton, :NLFunctional, :NLAnderson, + # Solver construction + :build_nlsolver, + # Stepping / status hooks extended and called by downstream solvers + :nlsolve!, :nlsolvefail, :compute_step!, :initial_η, + :markfirststage!, :du_alias_or_new, + # Anderson-acceleration kernels (DelayDiffEq fixed-point solver reuses these) + :anderson, :anderson! + ) + ) +end + end diff --git a/lib/OrdinaryDiffEqNonlinearSolve/src/initialize_dae.jl b/lib/OrdinaryDiffEqNonlinearSolve/src/initialize_dae.jl index d1b8bf583c8..62b0295bef5 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/src/initialize_dae.jl +++ b/lib/OrdinaryDiffEqNonlinearSolve/src/initialize_dae.jl @@ -176,7 +176,7 @@ function _initialize_dae!( # _u0 should be non-dual since NonlinearSolve does not differentiate the solver # These non-dual values are thus used to make the caches #_du = SciMLBase.value.(du) - _u0 = DiffEqBase.value.(u0) + _u0 = SciMLBase.value.(u0) # If not doing auto-diff of the solver, save an allocation if typeof(u0) === typeof(_u0) @@ -195,7 +195,7 @@ function _initialize_dae!( end nlequation! = @closure (out, u, p) -> begin - TP = DiffEqBase.anyeltypedual(p) + TP = SciMLBase.anyeltypedual(p) if TP <: Dual T = Base.promote_type(eltype(u), TP) else @@ -370,7 +370,7 @@ function _initialize_dae!( # _du and _u should be non-dual since NonlinearSolve does not differentiate the solver # These non-dual values are thus used to make the caches #_du = SciMLBase.value.(du) - _u0 = DiffEqBase.value.(u0) + _u0 = SciMLBase.value.(u0) # If not doing auto-diff of the solver, save an allocation if typeof(u0) === typeof(_u0) @@ -388,7 +388,7 @@ function _initialize_dae!( end nlequation! = @closure (out, u, p) -> begin - TP = DiffEqBase.anyeltypedual(p) + TP = SciMLBase.anyeltypedual(p) if TP <: Dual T = Base.promote_type(eltype(u), TP) else @@ -549,11 +549,11 @@ function _initialize_dae!( alg_u = @view u[algebraic_vars] # These non-dual values are thus used to make the caches - _u = DiffEqBase.value.(u) + _u = SciMLBase.value.(u) # If auto-diff of the solver, should be non-dual since NonlinearSolve does not differentiate the solver if typeof(u) !== typeof(_u) - tmp = DiffEqBase.value.(tmp) + tmp = SciMLBase.value.(tmp) end isAD = alg_autodiff(integrator.alg) isa AutoForwardDiff || typeof(u) !== typeof(_u) @@ -571,7 +571,7 @@ function _initialize_dae!( end nlequation! = @closure (out, x, p) -> begin - TP = DiffEqBase.anyeltypedual(p) + TP = SciMLBase.anyeltypedual(p) if TP <: Dual T = Base.promote_type(eltype(x), TP) else @@ -706,8 +706,8 @@ function _initialize_dae!( # _du and _u should be non-dual since NonlinearSolve does not differentiate the solver # These non-dual values are thus used to make the caches - _du = DiffEqBase.value.(du) - _u = DiffEqBase.value.(u) + _du = SciMLBase.value.(du) + _u = SciMLBase.value.(u) # If not doing auto-diff of the solver, save an allocation if typeof(u) === typeof(_u) @@ -738,7 +738,7 @@ function _initialize_dae!( end nlequation! = @closure (out, x, p) -> begin - TP = DiffEqBase.anyeltypedual(p) + TP = SciMLBase.anyeltypedual(p) if TP <: Dual T = Base.promote_type(eltype(x), TP) else diff --git a/lib/OrdinaryDiffEqNonlinearSolve/src/nlsolve.jl b/lib/OrdinaryDiffEqNonlinearSolve/src/nlsolve.jl index 9d61596bf52..b86e0edf65e 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/src/nlsolve.jl +++ b/lib/OrdinaryDiffEqNonlinearSolve/src/nlsolve.jl @@ -120,7 +120,7 @@ function nlsolve!( apply_step!(nlsolver, integrator) # check for convergence - η = DiffEqBase.value(θ / (1 - θ)) + η = SciMLBase.value(θ / (1 - θ)) # don't trust θ for non-adaptive on first iter because the solver doesn't provide feedback # for us to know whether our previous nlsolve converged sufficiently well check_η_convergence = ( @@ -184,7 +184,7 @@ function apply_step!( return nothing end -function postamble!(nlsolver::NLSolver, integrator::SciMLBase.DEIntegrator) +function SciMLBase.postamble!(nlsolver::NLSolver, integrator::SciMLBase.DEIntegrator) if SciMLBase.has_stats(integrator) integrator.stats.nnonliniter += nlsolver.iter diff --git a/lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl b/lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl index 63fcf4ea67a..25f8da80e95 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl +++ b/lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl @@ -98,7 +98,7 @@ mutable struct DAEResidualJacobianWrapper{ end end -function SciMLBase.setproperties(wrap::DAEResidualJacobianWrapper, patch::NamedTuple) +function ConstructionBase.setproperties(wrap::DAEResidualJacobianWrapper, patch::NamedTuple) for key in keys(patch) setproperty!(wrap, key, patch[key]) end diff --git a/lib/OrdinaryDiffEqNonlinearSolve/test/qa/Project.toml b/lib/OrdinaryDiffEqNonlinearSolve/test/qa/Project.toml index 4d16af19249..45d6b71e87d 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqNonlinearSolve/test/qa/Project.toml @@ -7,6 +7,7 @@ OrdinaryDiffEqBDF = "6ad6398a-0878-4a85-9266-38940aa047c8" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" OrdinaryDiffEqRosenbrock = "43230ef6-c299-4910-a778-202eb28ce4ce" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -29,4 +30,5 @@ OrdinaryDiffEqBDF = "2" OrdinaryDiffEqCore = "4" OrdinaryDiffEqNonlinearSolve = "2" OrdinaryDiffEqRosenbrock = "2" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/OrdinaryDiffEqNonlinearSolve/test/qa/qa.jl b/lib/OrdinaryDiffEqNonlinearSolve/test/qa/qa.jl index d4e7ff9d2a5..573ebfc67e7 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqNonlinearSolve/test/qa/qa.jl @@ -1,9 +1,44 @@ -using OrdinaryDiffEqNonlinearSolve -using Aqua +using SciMLTesting, OrdinaryDiffEqNonlinearSolve, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqNonlinearSolve; - piracies = false - ) -end +run_qa( + OrdinaryDiffEqNonlinearSolve; + aqua_kwargs = (; piracies = false), + explicit_imports = true, + ei_kwargs = (; + # Names imported from a re-exporter rather than their defining package. + # `@SciMLMessage` is owned by SciMLLogging but reached through OrdinaryDiffEqCore + # (SciMLLogging is not a direct dependency); `WOperator`/`StaticWOperator` are the + # OrdinaryDiffEqDifferentiation W-operator types, which ExplicitImports attributes + # to SciMLOperators (their abstract supertype's package). + all_explicit_imports_via_owners = (; + ignore = (Symbol("@SciMLMessage"), :WOperator, :StaticWOperator), + ), + # Non-public names of upstream packages with no public alternative. Each is owned + # by the package it is imported from; remove an entry once that package marks the + # name `public`/exports it. Tracked in SciML/OrdinaryDiffEq.jl#3776. + all_explicit_imports_are_public = (; + ignore = ( + # `@SciMLMessage` reached through OrdinaryDiffEqCore (owner SciMLLogging). + Symbol("@SciMLMessage"), + # SciMLBase internals (owner of these names but not public). + :_vec, :_reshape, :postamble!, + # SciMLOperators abstract type (not public). + :AbstractSciMLOperator, + # OrdinaryDiffEqDifferentiation W-operator types (attributed to SciMLOperators). + :WOperator, :StaticWOperator, + # ForwardDiff / StaticArraysCore internals. + :Dual, :StaticArray, + ), + ), + # Qualified `Module.name` accesses to non-public names with no public alternative. + all_qualified_accesses_are_public = (; + ignore = ( + # SciMLBase internals. + :value, :anyeltypedual, :forwarddiff_chunksize, + :has_Wfact, :has_Wfact_t, :has_jac_u, :has_jac_du, :postamble!, + # ForwardDiff internals. + :Tag, :pickchunksize, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl b/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl index 5dd6e4a6936..ce618452407 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl @@ -1,26 +1,33 @@ module OrdinaryDiffEqNordsieck -import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, +# `alg_order` is owned (and public) by SciMLBase; import it from its owner. +import SciMLBase: alg_order +# `initialize!`, `calculate_residuals`, `calculate_residuals!` are owned by +# DiffEqBase (re-provided through OrdinaryDiffEqCore); import them from the owner +# so the ExplicitImports owner check passes. `initialize!` is public in +# DiffEqBase; the `calculate_residuals` pair is DiffEqBase-internal. +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals! +import OrdinaryDiffEqCore: alg_adaptive_order, qmin_default, qmax_default, qsteady_min_default, qsteady_max_default, - get_current_alg_order, DummyController, + get_current_alg_order, AbstractController, AbstractControllerCache, OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqAdamsVarOrderVarStepAlgorithm, alg_cache, OrdinaryDiffEqMutableCache, - OrdinaryDiffEqConstantCache, initialize!, - initialize!, perform_step!, stepsize_controller!, + OrdinaryDiffEqConstantCache, + perform_step!, stepsize_controller!, step_accept_controller!, step_reject_controller!, accept_step_controller, post_newton_controller!, setup_controller_cache, get_qmin, get_qmax, get_qsteady_min, - get_qsteady_max, get_EEst, CommonControllerOptions, resolve_basic, _resolved_QT, - calculate_residuals, calculate_residuals!, + get_qsteady_max, get_EEst, set_EEst!, increment_nf!, + CommonControllerOptions, resolve_basic, _resolved_QT, get_current_adaptive_order, get_fsalfirstlast, ode_interpolant, ode_interpolant!, trivial_limiter!, generic_solver_docstring, default_controller -using MuladdMacro, FastBroadcast, RecursiveArrayTools +using MuladdMacro: @muladd +using FastBroadcast: @.., Serial +using RecursiveArrayTools: recursivefill! import LinearAlgebra: rmul! -using FastBroadcast: Serial using OrdinaryDiffEqTsit5: Tsit5ConstantCache, Tsit5Cache -import OrdinaryDiffEqCore using Reexport @reexport using SciMLBase diff --git a/lib/OrdinaryDiffEqNordsieck/src/alg_utils.jl b/lib/OrdinaryDiffEqNordsieck/src/alg_utils.jl index cfcee8e687e..f473fe1614e 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/alg_utils.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/alg_utils.jl @@ -13,7 +13,7 @@ qsteady_max_default(::JVODE) = 3 // 2 get_current_alg_order(alg::JVODE, cache) = get_current_adaptive_order(alg, cache) -function OrdinaryDiffEqCore.default_controller(QT, alg::JVODE) +function default_controller(QT, alg::JVODE) # Thread the alg-struct kwargs through to the controller so that # `JVODE(qmax = 20)` keeps working. return JVODEController( diff --git a/lib/OrdinaryDiffEqNordsieck/src/controllers.jl b/lib/OrdinaryDiffEqNordsieck/src/controllers.jl index 90279794cbe..23e2927d608 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/controllers.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/controllers.jl @@ -38,20 +38,20 @@ end # Algorithm owns the stepsize logic; controller cache delegates back to # alg-level dispatch (mirroring how DummyControllerCache used to behave). -@inline OrdinaryDiffEqCore.stepsize_controller!(integrator, ::JVODEControllerCache, alg) = +@inline stepsize_controller!(integrator, ::JVODEControllerCache, alg) = stepsize_controller!(integrator, alg) -@inline OrdinaryDiffEqCore.step_accept_controller!(integrator, ::JVODEControllerCache, alg, q) = +@inline step_accept_controller!(integrator, ::JVODEControllerCache, alg, q) = step_accept_controller!(integrator, alg, q) -@inline OrdinaryDiffEqCore.step_reject_controller!(integrator, ::JVODEControllerCache, alg) = +@inline step_reject_controller!(integrator, ::JVODEControllerCache, alg) = step_reject_controller!(integrator, alg) -@inline OrdinaryDiffEqCore.post_newton_controller!(integrator, ::JVODEControllerCache, alg) = +@inline post_newton_controller!(integrator, ::JVODEControllerCache, alg) = post_newton_controller!(integrator, alg) -@inline OrdinaryDiffEqCore.accept_step_controller( +@inline accept_step_controller( integrator, cache::JVODEControllerCache, alg, ) = get_EEst(cache) <= 1 function stepsize_controller!(integrator, alg::JVODE) - if iszero(OrdinaryDiffEqCore.get_EEst(integrator)) + if iszero(get_EEst(integrator)) η = get_qmax(integrator) else η = integrator.cache.η diff --git a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl index 95bfed3e2de..72973341cee 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator, cache::AN5ConstantCache) integrator.kshortsize = 7 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -44,7 +44,7 @@ end perform_predict!(cache) cache.Δ = integrator.u - integrator.uprev update_nordsieck_vector!(cache) - if integrator.opts.adaptive && OrdinaryDiffEqCore.get_EEst(integrator) >= one(OrdinaryDiffEqCore.get_EEst(integrator)) + if integrator.opts.adaptive && get_EEst(integrator) >= one(get_EEst(integrator)) cache.order = 1 end else @@ -75,8 +75,8 @@ end integrator.opts.reltol, integrator.opts.internalnorm, t ) - OrdinaryDiffEqCore.set_EEst!(integrator, integrator.opts.internalnorm(atmp, t) * cache.c_LTE) - if OrdinaryDiffEqCore.get_EEst(integrator) > one(OrdinaryDiffEqCore.get_EEst(integrator)) + set_EEst!(integrator, integrator.opts.internalnorm(atmp, t) * cache.c_LTE) + if get_EEst(integrator) > one(get_EEst(integrator)) for i in 1:5 dts[i] = dts[i + 1] end @@ -107,7 +107,7 @@ function initialize!(integrator, cache::AN5Cache) integrator.k[6] = cache.tsit5cache.k6 integrator.k[7] = cache.tsit5cache.k7 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - return OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + return increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::AN5Cache, repeat_step = false) @@ -145,7 +145,7 @@ end perform_predict!(cache) @.. broadcast = false cache.Δ = integrator.u - integrator.uprev update_nordsieck_vector!(cache) - if integrator.opts.adaptive && OrdinaryDiffEqCore.get_EEst(integrator) >= one(OrdinaryDiffEqCore.get_EEst(integrator)) + if integrator.opts.adaptive && get_EEst(integrator) >= one(get_EEst(integrator)) cache.order = 1 end else @@ -176,8 +176,8 @@ end atmp, cache.Δ, uprev, integrator.u, integrator.opts.abstol, integrator.opts.reltol, integrator.opts.internalnorm, t ) - OrdinaryDiffEqCore.set_EEst!(integrator, integrator.opts.internalnorm(atmp, t) * cache.c_LTE) - if OrdinaryDiffEqCore.get_EEst(integrator) > one(OrdinaryDiffEqCore.get_EEst(integrator)) + set_EEst!(integrator, integrator.opts.internalnorm(atmp, t) * cache.c_LTE) + if get_EEst(integrator) > one(get_EEst(integrator)) for i in 1:5 dts[i] = dts[i + 1] end @@ -200,7 +200,7 @@ function initialize!(integrator, cache::JVODEConstantCache) integrator.kshortsize = 7 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -219,7 +219,7 @@ end cache.order = 1 z[1] = integrator.uprev z[2] = f(uprev, p, t) * dt - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) dts[1] = dt end # Reset time @@ -247,8 +247,8 @@ end cache.Δ, uprev, integrator.u, integrator.opts.abstol, integrator.opts.reltol, integrator.opts.internalnorm, t ) - OrdinaryDiffEqCore.set_EEst!(integrator, integrator.opts.internalnorm(atmp, t) * cache.c_LTE) - if OrdinaryDiffEqCore.get_EEst(integrator) > one(OrdinaryDiffEqCore.get_EEst(integrator)) + set_EEst!(integrator, integrator.opts.internalnorm(atmp, t) * cache.c_LTE) + if get_EEst(integrator) > one(get_EEst(integrator)) for i in 1:12 dts[i] = dts[i + 1] end @@ -275,7 +275,7 @@ function initialize!(integrator, cache::JVODECache) integrator.k[6] = cache.tsit5cache.k6 integrator.k[7] = cache.tsit5cache.k7 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - return OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + return increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::JVODECache, repeat_step = false) @@ -286,7 +286,7 @@ end cache.order = 1 @.. broadcast = false z[1] = integrator.uprev f(z[2], uprev, p, t) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) @.. broadcast = false z[2] = z[2] * dt dts[1] = dt end @@ -318,8 +318,8 @@ end atmp, cache.Δ, uprev, integrator.u, integrator.opts.abstol, integrator.opts.reltol, integrator.opts.internalnorm, t ) - OrdinaryDiffEqCore.set_EEst!(integrator, integrator.opts.internalnorm(atmp, t) * cache.c_LTE) - if OrdinaryDiffEqCore.get_EEst(integrator) > one(OrdinaryDiffEqCore.get_EEst(integrator)) + set_EEst!(integrator, integrator.opts.internalnorm(atmp, t) * cache.c_LTE) + if get_EEst(integrator) > one(get_EEst(integrator)) for i in 1:12 dts[i] = dts[i + 1] end diff --git a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_utils.jl b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_utils.jl index 0a48d242f55..88c8f8bef53 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_utils.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_utils.jl @@ -33,14 +33,14 @@ function nordsieck_prepare_next!(integrator, cache::T) where {T} (; maxη, order, L) = cache # TODO: further clean up (; bias1, bias2, bias3, addon) = integrator.alg - if OrdinaryDiffEqCore.get_EEst(integrator) > one(OrdinaryDiffEqCore.get_EEst(integrator)) + if get_EEst(integrator) > one(get_EEst(integrator)) nordsieck_rewind!(cache) cache.n_wait = max(2, cache.n_wait) cache.nextorder = order - cache.η = inv((bias2 * OrdinaryDiffEqCore.get_EEst(integrator))^inv(L) + addon) + cache.η = inv((bias2 * get_EEst(integrator))^inv(L) + addon) return nothing end - cache.ηq = inv((bias2 * OrdinaryDiffEqCore.get_EEst(integrator))^inv(L) + addon) + cache.ηq = inv((bias2 * get_EEst(integrator))^inv(L) + addon) stepsize_η!(integrator, cache, cache.order) if !is_nordsieck_change_order(cache) cache.η = cache.ηq @@ -218,7 +218,7 @@ function nlsolve_functional!(integrator, cache::T) where {T} (; ratetmp) = cache integrator.f(ratetmp, z[1], p, dt + t) end - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) maxiters = 3 div_rate = 2 # Zero out the difference vector @@ -258,7 +258,7 @@ function nlsolve_functional!(integrator, cache::T) where {T} return false end δ_prev = δ - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) isconstcache ? (ratetmp = integrator.f(integrator.u, p, dt + t)) : integrator.f(ratetmp, integrator.u, p, dt + t) end @@ -394,7 +394,7 @@ function stepsize_η!(integrator, cache, order) bias2 = integrator.alg.bias2 addon = integrator.alg.addon L = order + 1 - cache.ηq = inv((bias2 * OrdinaryDiffEqCore.get_EEst(integrator))^inv(L) + addon) + cache.ηq = inv((bias2 * get_EEst(integrator))^inv(L) + addon) return cache.ηq end diff --git a/lib/OrdinaryDiffEqNordsieck/test/qa/Project.toml b/lib/OrdinaryDiffEqNordsieck/test/qa/Project.toml index be6682b9685..ebd006275e8 100644 --- a/lib/OrdinaryDiffEqNordsieck/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqNordsieck/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqNordsieck = "c9986a66-5c92-4813-8696-a7ec84c806c8" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqNordsieck = "2" diff --git a/lib/OrdinaryDiffEqNordsieck/test/qa/qa.jl b/lib/OrdinaryDiffEqNordsieck/test/qa/qa.jl index 2e713c847a1..129418082ca 100644 --- a/lib/OrdinaryDiffEqNordsieck/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqNordsieck/test/qa/qa.jl @@ -1,8 +1,29 @@ -using OrdinaryDiffEqNordsieck -using Aqua +using SciMLTesting, OrdinaryDiffEqNordsieck, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqNordsieck - ) -end +run_qa( + OrdinaryDiffEqNordsieck; + explicit_imports = true, + ei_kwargs = (; + # `@reexport using SciMLBase` is the package's public-API surface; the + # reexport idiom is an unavoidable implicit import of these three names. + no_implicit_imports = (; + ignore = (:SciMLBase, :Reexport, Symbol("@reexport")), + ), + # Genuine solver-author internals that their owners deliberately keep + # non-public. Everything OrdinaryDiffEqCore made public for the solver + # extension API has been dropped; drop each remaining entry once its + # owner marks it public upstream (tracked in SciML/OrdinaryDiffEq.jl#3776). + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore internals (not in the public extension API) + :_resolved_QT, :resolve_basic, + :get_current_alg_order, + :qsteady_min_default, :qsteady_max_default, + :ode_interpolant, :ode_interpolant!, + :trivial_limiter!, + # OrdinaryDiffEqTsit5 first-step caches (owner-internal) + :Tsit5Cache, :Tsit5ConstantCache, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl b/lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl index b17eac7c195..c66ad8c470e 100644 --- a/lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl +++ b/lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl @@ -1,24 +1,26 @@ module OrdinaryDiffEqPDIRK -import OrdinaryDiffEqCore: isfsal, alg_order, _unwrap_val, +import OrdinaryDiffEqCore: isfsal, OrdinaryDiffEqNewtonAlgorithm, OrdinaryDiffEqConstantCache, OrdinaryDiffEqMutableCache, constvalue, alg_cache, - uses_uprev, unwrap_alg, @cache, - @threaded, initialize!, perform_step!, isthreaded, + unwrap_alg, @cache, + @threaded, perform_step!, isthreaded, full_cache, get_fsalfirstlast, differentiation_rk_docstring, - _ad_chunksize_int, _ad_fdtype, _fixup_ad + _fixup_ad +import SciMLBase: alg_order, _unwrap_val +import DiffEqBase: initialize! import MuladdMacro: @muladd import FastBroadcast: @.. -using Reexport +using Reexport: Reexport, @reexport +using SciMLBase: SciMLBase @reexport using SciMLBase -using OrdinaryDiffEqDifferentiation: dolinsolve using OrdinaryDiffEqNonlinearSolve: NLNewton, build_nlsolver, nlsolve!, nlsolvefail, markfirststage! -import ADTypes: AutoForwardDiff, AbstractADType +import ADTypes: AutoForwardDiff include("algorithms.jl") include("alg_utils.jl") diff --git a/lib/OrdinaryDiffEqPDIRK/test/qa/Project.toml b/lib/OrdinaryDiffEqPDIRK/test/qa/Project.toml index 09b727af69a..4e7f797566a 100644 --- a/lib/OrdinaryDiffEqPDIRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqPDIRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqPDIRK = "5dd0a6cf-3d4b-4314-aa06-06d4e299bc89" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqPDIRK = "2" diff --git a/lib/OrdinaryDiffEqPDIRK/test/qa/qa.jl b/lib/OrdinaryDiffEqPDIRK/test/qa/qa.jl index 588e4c58b8f..6c1c594e198 100644 --- a/lib/OrdinaryDiffEqPDIRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqPDIRK/test/qa/qa.jl @@ -1,8 +1,17 @@ -using OrdinaryDiffEqPDIRK -using Aqua +using SciMLTesting, OrdinaryDiffEqPDIRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqPDIRK - ) -end +run_qa( + OrdinaryDiffEqPDIRK; + explicit_imports = true, + ei_kwargs = (; + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore: `@threaded` is a private codegen/perf macro, + # deliberately kept non-public upstream (owner-internal). + Symbol("@threaded"), + # SciMLBase: not declared public on the registered release. + :_unwrap_val, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqPRK/src/OrdinaryDiffEqPRK.jl b/lib/OrdinaryDiffEqPRK/src/OrdinaryDiffEqPRK.jl index c2d45445a51..07db7e19237 100644 --- a/lib/OrdinaryDiffEqPRK/src/OrdinaryDiffEqPRK.jl +++ b/lib/OrdinaryDiffEqPRK/src/OrdinaryDiffEqPRK.jl @@ -1,15 +1,17 @@ module OrdinaryDiffEqPRK -import OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, alg_order, OrdinaryDiffEqMutableCache, +import OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, constvalue, @cache, alg_cache, get_fsalfirstlast, - unwrap_alg, perform_step!, @threaded, initialize!, isthreaded, - full_cache, generic_solver_docstring + unwrap_alg, perform_step!, @threaded, isthreaded, + generic_solver_docstring +import SciMLBase: alg_order, full_cache +import DiffEqBase: initialize! import MuladdMacro: @muladd import FastBroadcast: @.. - -using Reexport +using Reexport: Reexport, @reexport +using SciMLBase: SciMLBase @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqPRK/test/qa/Project.toml b/lib/OrdinaryDiffEqPRK/test/qa/Project.toml index 46327273f97..08e02d7332c 100644 --- a/lib/OrdinaryDiffEqPRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqPRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqPRK = "5b33eab2-c0f1-4480-b2c3-94bc1e80bda1" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqPRK = "2" diff --git a/lib/OrdinaryDiffEqPRK/test/qa/qa.jl b/lib/OrdinaryDiffEqPRK/test/qa/qa.jl index ce2afd1e8b5..a46221003bf 100644 --- a/lib/OrdinaryDiffEqPRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqPRK/test/qa/qa.jl @@ -1,8 +1,15 @@ -using OrdinaryDiffEqPRK -using Aqua +using SciMLTesting, OrdinaryDiffEqPRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqPRK - ) -end +run_qa( + OrdinaryDiffEqPRK; + explicit_imports = true, + ei_kwargs = (; + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore: deliberately non-public codegen macro + # (kept internal alongside @fold/@OnDemandTableauExtract/@swap!). + Symbol("@threaded"), + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl b/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl index 8bb7de03e45..a537a1da2e8 100644 --- a/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl +++ b/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl @@ -3,17 +3,19 @@ module OrdinaryDiffEqQPRK import OrdinaryDiffEqCore: OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqConstantCache, explicit_rk_docstring, @cache, OrdinaryDiffEqMutableCache, - OrdinaryDiffEqAdaptiveAlgorithm, @fold, @OnDemandTableauExtract, - trivial_limiter!, alg_cache, alg_order, initialize!, + @fold, @OnDemandTableauExtract, + trivial_limiter!, alg_cache, perform_step!, get_fsalfirstlast, - constvalue, calculate_residuals!, calculate_residuals, - full_cache -using FastBroadcast: Serial -using MuladdMacro, FastBroadcast + constvalue +import SciMLBase: alg_order +import DiffEqBase: initialize!, calculate_residuals!, calculate_residuals +using FastBroadcast: FastBroadcast, Serial, @.. +using MuladdMacro: MuladdMacro, @muladd using RecursiveArrayTools: recursive_unitless_bottom_eltype, recursivefill! import OrdinaryDiffEqCore -using Reexport +using SciMLBase: SciMLBase +using Reexport: Reexport, @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqQPRK/test/qa/Project.toml b/lib/OrdinaryDiffEqQPRK/test/qa/Project.toml index 04f6e75b42d..5ce32b38bef 100644 --- a/lib/OrdinaryDiffEqQPRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqQPRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqQPRK = "04162be5-8125-4266-98ed-640baecc6514" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqQPRK = "2" diff --git a/lib/OrdinaryDiffEqQPRK/test/qa/qa.jl b/lib/OrdinaryDiffEqQPRK/test/qa/qa.jl index 79f03b7c4c8..2bcc54b5a9e 100644 --- a/lib/OrdinaryDiffEqQPRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqQPRK/test/qa/qa.jl @@ -1,8 +1,15 @@ -using OrdinaryDiffEqQPRK -using Aqua +using SciMLTesting, OrdinaryDiffEqQPRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqQPRK - ) -end +run_qa( + OrdinaryDiffEqQPRK; + explicit_imports = true, + ei_kwargs = ( + all_explicit_imports_are_public = ( + ignore = ( + # OrdinaryDiffEqCore owner-internal codegen macros and default limiter + # (deliberately not declared public: private codegen/perf surface). + Symbol("@fold"), Symbol("@OnDemandTableauExtract"), :trivial_limiter!, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl b/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl index 0816dbb63f9..4f204553584 100644 --- a/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl +++ b/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl @@ -1,23 +1,27 @@ module OrdinaryDiffEqRKN -import OrdinaryDiffEqCore: alg_order, calculate_residuals!, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, alg_extrapolates, +import OrdinaryDiffEqCore: perform_step!, + alg_extrapolates, OrdinaryDiffEqAlgorithm, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, OrdinaryDiffEqAdaptivePartitionedAlgorithm, OrdinaryDiffEqPartitionedAlgorithm, - OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev, - alg_cache, _vec, _reshape, @cache, isfsal, full_cache, - constvalue, _unwrap_val, _ode_interpolant, + CompiledFloats, + alg_cache, @cache, full_cache, + constvalue, _ode_interpolant, get_fsalfirstlast, - trivial_limiter!, _ode_interpolant!, _ode_addsteps!, + _ode_interpolant!, generic_solver_docstring -using FastBroadcast, MuladdMacro, RecursiveArrayTools -using DiffEqBase: @def, @tight_loop_macros +import SciMLBase: alg_order, @def +using SciMLBase: SciMLBase +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals!, + @tight_loop_macros +using FastBroadcast: FastBroadcast, @.. +using MuladdMacro: MuladdMacro, @muladd +using RecursiveArrayTools: RecursiveArrayTools, ArrayPartition, recursivefill! import OrdinaryDiffEqCore -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqRKN/test/qa/Project.toml b/lib/OrdinaryDiffEqRKN/test/qa/Project.toml index 353fbe7f5d4..420e1b60e20 100644 --- a/lib/OrdinaryDiffEqRKN/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqRKN/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqRKN = "af6ede74-add8-4cfd-b1df-9a4dbb109d7a" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqRKN = "2" diff --git a/lib/OrdinaryDiffEqRKN/test/qa/qa.jl b/lib/OrdinaryDiffEqRKN/test/qa/qa.jl index 8ef2c300957..e1d6e31e47b 100644 --- a/lib/OrdinaryDiffEqRKN/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqRKN/test/qa/qa.jl @@ -1,8 +1,16 @@ -using OrdinaryDiffEqRKN -using Aqua +using SciMLTesting, OrdinaryDiffEqRKN, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqRKN - ) -end +run_qa( + OrdinaryDiffEqRKN; + explicit_imports = true, + ei_kwargs = (; + all_explicit_imports_are_public = (; + ignore = ( + # SciMLBase codegen macro, deliberately kept non-public by its owner. + Symbol("@def"), + # DiffEqBase perf macro, deliberately kept non-public by its owner. + Symbol("@tight_loop_macros"), + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqRosenbrock/Project.toml b/lib/OrdinaryDiffEqRosenbrock/Project.toml index c36958ede50..6121c0ca912 100644 --- a/lib/OrdinaryDiffEqRosenbrock/Project.toml +++ b/lib/OrdinaryDiffEqRosenbrock/Project.toml @@ -1,6 +1,6 @@ name = "OrdinaryDiffEqRosenbrock" uuid = "43230ef6-c299-4910-a778-202eb28ce4ce" -version = "2.3.1" +version = "2.3.2" authors = ["ParamThakkar123 "] [deps] diff --git a/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl b/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl index 50153bacbc4..bd4ee9c8e08 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl @@ -1,6 +1,6 @@ module OrdinaryDiffEqRosenbrock -import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, isWmethod, isfsal, _unwrap_val, +import OrdinaryDiffEqCore: alg_adaptive_order, isWmethod, isfsal, _unwrap_val, OrdinaryDiffEqRosenbrockAlgorithm, @cache, alg_cache, initialize!, calculate_residuals!, OrdinaryDiffEqMutableCache, @@ -12,34 +12,43 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, isWmethod, isfsal, _un constvalue, only_diagonal_mass_matrix, calculate_residuals, has_stiff_interpolation, ODEIntegrator, resize_non_user_cache!, _ode_addsteps!, full_cache, - DerivativeOrderNotPossibleError, _ad_chunksize_int, _ad_fdtype, _fixup_ad, - LinearAliasSpecifier, copyat_or_push!, DifferentialVarsUndefined -using MuladdMacro, FastBroadcast, RecursiveArrayTools -import MacroTools: namify -using MacroTools: @capture + DerivativeOrderNotPossibleError, _fixup_ad, + LinearAliasSpecifier, copyat_or_push!, DifferentialVarsUndefined, resize_J_W! +using MuladdMacro: MuladdMacro, @muladd +using FastBroadcast: FastBroadcast, @.. +using RecursiveArrayTools: RecursiveArrayTools, recursivefill! using DiffEqBase: @def import DifferentiationInterface as DI import LinearSolve -import LinearSolve: UniformScaling import ForwardDiff -using FiniteDiff -using LinearAlgebra: mul!, diag, diagm, I, Diagonal, norm, lu, lu! -using ADTypes +using FiniteDiff: FiniteDiff +using LinearAlgebra: mul!, I, norm, lu, UniformScaling +using ADTypes: ADTypes, AutoFiniteDiff, AutoForwardDiff import OrdinaryDiffEqCore, OrdinaryDiffEqDifferentiation -using OrdinaryDiffEqDifferentiation: TimeDerivativeWrapper, TimeGradientWrapper, - UDerivativeWrapper, UJacobianWrapper, - wrapprecs, calc_tderivative, build_grad_config, +using OrdinaryDiffEqDifferentiation: wrapprecs, calc_tderivative, build_grad_config, build_jac_config, issuccess_W, jacobian2W!, resize_jac_config!, resize_grad_config!, - calc_W, calc_rosenbrock_differentiation!, build_J_W, - UJacobianWrapper, dolinsolve, WOperator, resize_J_W! + calc_rosenbrock_differentiation!, build_J_W, + dolinsolve, WOperator using OrdinaryDiffEqDifferentiation: calc_rosenbrock_differentiation -using OrdinaryDiffEqRosenbrockTableaus -using Reexport +using OrdinaryDiffEqRosenbrockTableaus: OrdinaryDiffEqRosenbrockTableaus, + GRK4ARodasTableau, GRK4TRodasTableau, ROS2PRRodasTableau, ROS2RodasTableau, + ROS2SRodasTableau, ROS34PRwRodasTableau, ROS34PW1aRodasTableau, + ROS34PW1bRodasTableau, ROS34PW2RodasTableau, ROS3PRL2RodasTableau, + ROS3PRLRodasTableau, ROS3PRRodasTableau, ROS3PRodasTableau, ROS3RodasTableau, + Rodas3PRodasTableau, Rodas3RodasTableau, Rodas42Tableau, Rodas4P2Tableau, + Rodas4PTableau, Rodas4PWTableau, Rodas4Tableau, Rodas5Tableau, RodasTableau, + Ros4LStabRodasTableau, RosShamp4RodasTableau, RosenbrockW6S4OSRodasTableau, + Scholz4_7RodasTableau, Veldd4RodasTableau, Velds4RodasTableau +using Reexport: Reexport, @reexport @reexport using SciMLBase +using SciMLBase: SciMLBase, LinearProblem, ODEProblem, init, solve, + TimeDerivativeWrapper, TimeGradientWrapper, UDerivativeWrapper, UJacobianWrapper +# alg_order is owned by and public in SciMLBase; import (not using) so methods can be extended +import SciMLBase: alg_order import OrdinaryDiffEqCore: alg_autodiff import OrdinaryDiffEqCore @@ -205,4 +214,12 @@ export Rosenbrock23, Rosenbrock32, RosShamp4, Veldd4, Velds4, GRK4T, GRK4A, ROS3PRL, ROS3PRL2, ROK4a, ROS2, ROS2PR, ROS2S, ROS3, ROS3PR, Scholz4_7 +# Abstract Rosenbrock cache supertype that other OrdinaryDiffEq consumers +# (e.g. DelayDiffEq) reference to special-case Rosenbrock cache resizing. +# Marked public so that cross-package reference is recognized as a supported +# extension API rather than internal access. +@static if VERSION >= v"1.11.0-DEV.469" + eval(Expr(:public, :RosenbrockMutableCache)) +end + end diff --git a/lib/OrdinaryDiffEqRosenbrock/test/qa/Project.toml b/lib/OrdinaryDiffEqRosenbrock/test/qa/Project.toml index 75be151e8d7..0f9c800a15c 100644 --- a/lib/OrdinaryDiffEqRosenbrock/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqRosenbrock/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqRosenbrock = "43230ef6-c299-4910-a778-202eb28ce4ce" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -20,4 +21,5 @@ JET = "0.9, 0.11" OrdinaryDiffEqCore = "4" OrdinaryDiffEqRosenbrock = "2" SciMLBase = "3" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/OrdinaryDiffEqRosenbrock/test/qa/qa.jl b/lib/OrdinaryDiffEqRosenbrock/test/qa/qa.jl index c9e65b9ee89..1af09042e61 100644 --- a/lib/OrdinaryDiffEqRosenbrock/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqRosenbrock/test/qa/qa.jl @@ -1,8 +1,39 @@ -using OrdinaryDiffEqRosenbrock -using Aqua - -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqRosenbrock - ) -end +using SciMLTesting, OrdinaryDiffEqRosenbrock, Test + +# OrdinaryDiffEqRosenbrock consumes the solver-author extension API of its sibling +# packages, most of which is now declared public (so those names are no longer +# listed here). The names below are the genuine residual: cross-package internals +# whose *owner* does not make them public, plus a couple of owner-internal Core +# helpers. Each is grouped and commented by owning package so that any name later +# made public will surface as an Unexpected Pass and can be dropped. See +# SciML/OrdinaryDiffEq.jl#3776. + +# Explicitly-imported names that are non-public in (and/or owned outside) the +# module they are imported from. +const ROSENBROCK_INTERNAL_EXPLICIT_IMPORTS = ( + Symbol("@def"), # owner SciMLBase (MacroTools codegen macro), non-public + :_reshape, :_unwrap_val, :_vec, # owner SciMLBase, non-public internals + :calculate_residuals, :calculate_residuals!, :initialize!, # owner DiffEqBase, non-public + :copyat_or_push!, # owner RecursiveArrayTools, non-public + :WOperator, # owner SciMLOperators, non-public + :trivial_limiter!, # OrdinaryDiffEqCore owner-internal, non-public +) + +# Qualified accesses to names that are non-public in (and/or owned outside) the +# module they are accessed through. +const ROSENBROCK_INTERNAL_QUALIFIED_ACCESSES = ( + Symbol("@set"), # owner Accessors, accessed via SciMLBase.@set, non-public + :lorenz, :lorenz_oop, # OrdinaryDiffEqCore precompile-workload helpers, non-public + :setindex, # Base internal, non-public +) + +run_qa( + OrdinaryDiffEqRosenbrock; + explicit_imports = true, + ei_kwargs = ( + all_explicit_imports_via_owners = (; ignore = ROSENBROCK_INTERNAL_EXPLICIT_IMPORTS), + all_explicit_imports_are_public = (; ignore = ROSENBROCK_INTERNAL_EXPLICIT_IMPORTS), + all_qualified_accesses_via_owners = (; ignore = ROSENBROCK_INTERNAL_QUALIFIED_ACCESSES), + all_qualified_accesses_are_public = (; ignore = ROSENBROCK_INTERNAL_QUALIFIED_ACCESSES), + ), +) diff --git a/lib/OrdinaryDiffEqRosenbrockTableaus/test/qa/Project.toml b/lib/OrdinaryDiffEqRosenbrockTableaus/test/qa/Project.toml index 0dc400d082b..91145d9787a 100644 --- a/lib/OrdinaryDiffEqRosenbrockTableaus/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqRosenbrockTableaus/test/qa/Project.toml @@ -2,6 +2,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqRosenbrockTableaus = "b4bd8bb3-f80f-41d2-9b21-73a655b304b9" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqRosenbrockTableaus] @@ -11,5 +12,6 @@ path = "../.." Aqua = "0.8" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqRosenbrockTableaus = "2" +SciMLTesting = "1.7" Test = "1" julia = "1.10" diff --git a/lib/OrdinaryDiffEqRosenbrockTableaus/test/qa/qa.jl b/lib/OrdinaryDiffEqRosenbrockTableaus/test/qa/qa.jl index b807f6dcb1a..fa05cbabc6c 100644 --- a/lib/OrdinaryDiffEqRosenbrockTableaus/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqRosenbrockTableaus/test/qa/qa.jl @@ -1,12 +1,8 @@ -using OrdinaryDiffEqRosenbrockTableaus -using Aqua +using SciMLTesting, OrdinaryDiffEqRosenbrockTableaus, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(OrdinaryDiffEqRosenbrockTableaus) -end - -@testset "JET" begin - JET.test_package(OrdinaryDiffEqRosenbrockTableaus; target_defined_modules = true) -end +run_qa( + OrdinaryDiffEqRosenbrockTableaus; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, +) diff --git a/lib/OrdinaryDiffEqSDIRK/Project.toml b/lib/OrdinaryDiffEqSDIRK/Project.toml index 07541490269..7c7a82aa6ad 100644 --- a/lib/OrdinaryDiffEqSDIRK/Project.toml +++ b/lib/OrdinaryDiffEqSDIRK/Project.toml @@ -1,10 +1,11 @@ name = "OrdinaryDiffEqSDIRK" uuid = "2d112036-d095-4a1e-ab9a-08536f3ecdbf" authors = ["ParamThakkar123 "] -version = "2.7.1" +version = "2.7.2" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" +CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -52,6 +53,7 @@ PrecompileTools = "1.2.1, 1.3" Preferences = "1.5.0" julia = "1.10" ADTypes = "1.22.0" +CommonSolve = "0.2.4" RecursiveArrayTools = "4.2.0" OrdinaryDiffEqNonlinearSolve = "2" DiffEqBase = "7" diff --git a/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl b/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl index 51fe7334e99..deda6d93501 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl @@ -1,33 +1,47 @@ module OrdinaryDiffEqSDIRK -import OrdinaryDiffEqCore: alg_order, calculate_residuals!, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, alg_extrapolates, - OrdinaryDiffEqAlgorithm, +# These OrdinaryDiffEqCore functions are extended with SDIRK-specific methods, so +# they must be brought in with `import` (not `using`) to allow method definitions. +import OrdinaryDiffEqCore: perform_step!, + alg_extrapolates, + alg_cache, full_cache, + isesdirk, issplit, + ssp_coefficient, get_fsalfirstlast +# OrdinaryDiffEqCore names used (called/referenced) but not extended here. +using OrdinaryDiffEqCore: unwrap_alg, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, OrdinaryDiffEqNewtonAdaptiveAlgorithm, OrdinaryDiffEqNewtonAlgorithm, - OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev, - alg_cache, _vec, _reshape, @cache, isfsal, full_cache, - constvalue, _unwrap_val, _ode_interpolant, - trivial_limiter!, _ode_interpolant!, - isesdirk, issplit, - ssp_coefficient, get_fsalfirstlast, generic_solver_docstring, - _ad_chunksize_int, _ad_fdtype, _fixup_ad, current_extrapolant!, Predictor + CompiledFloats, + constvalue, + trivial_limiter!, + generic_solver_docstring, + _fixup_ad, current_extrapolant!, Predictor, + isnewton, get_W, set_new_W!, COEFFICIENT_MULTISTEP export Predictor using TruncatedStacktraces: @truncate_stacktrace -using MuladdMacro, MacroTools, FastBroadcast, RecursiveArrayTools -using SciMLBase: SplitFunction +using MuladdMacro: MuladdMacro, @muladd +using MacroTools: MacroTools +using FastBroadcast: FastBroadcast, @.. +using RecursiveArrayTools: RecursiveArrayTools, recursivefill! +# `alg_order` is owned by SciMLBase and extended here, so it needs `import`. +import SciMLBase: alg_order +using SciMLBase: SciMLBase, SplitFunction, ODEProblem, _vec, _reshape, _unwrap_val +# `initialize!` is owned by DiffEqBase and extended here, so it needs `import`; +# `calculate_residuals`/`calculate_residuals!` are only called. +import DiffEqBase: initialize! +using DiffEqBase: calculate_residuals, calculate_residuals! using LinearAlgebra: mul!, I import OrdinaryDiffEqCore -using OrdinaryDiffEqDifferentiation: UJacobianWrapper, dolinsolve +using OrdinaryDiffEqDifferentiation: dolinsolve using OrdinaryDiffEqNonlinearSolve: du_alias_or_new, markfirststage!, build_nlsolver, - nlsolve!, nlsolvefail, isnewton, get_W, set_new_W!, - NLNewton, COEFFICIENT_MULTISTEP + nlsolve!, nlsolvefail, + NLNewton import ADTypes: AutoForwardDiff +using CommonSolve: solve -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase include("algorithms.jl") @@ -119,4 +133,14 @@ PrecompileTools.@compile_workload begin solver_list = nothing end +# Cross-sublibrary IMEX cache/tableau API that other OrdinaryDiffEq solver +# sublibraries (e.g. OrdinaryDiffEqBDF) reference to build IMEX methods on top +# of the ESDIRK-IMEX machinery. Marked public so those references are +# recognized as a supported extension API rather than internal access. +@static if VERSION >= v"1.11.0-DEV.469" + eval(Expr(:public, + :ESDIRKIMEXCache, :ESDIRKIMEXConstantCache, + :ImplicitEulerESDIRKIMEXTableau)) +end + end diff --git a/lib/OrdinaryDiffEqSDIRK/src/generic_imex_perform_step.jl b/lib/OrdinaryDiffEqSDIRK/src/generic_imex_perform_step.jl index efea5b9c948..6c044073a6d 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/generic_imex_perform_step.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/generic_imex_perform_step.jl @@ -146,7 +146,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[2], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[2] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -163,7 +163,7 @@ end end @.. broadcast = false zs[2] = (zs[2] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[2] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -180,7 +180,7 @@ end end @.. broadcast = false zs[2] = (zs[2] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[2] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -238,7 +238,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[3], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[3] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -255,7 +255,7 @@ end end @.. broadcast = false zs[3] = (zs[3] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[3] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -272,7 +272,7 @@ end end @.. broadcast = false zs[3] = (zs[3] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[3] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -328,7 +328,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[4], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[4] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -345,7 +345,7 @@ end end @.. broadcast = false zs[4] = (zs[4] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[4] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -362,7 +362,7 @@ end end @.. broadcast = false zs[4] = (zs[4] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[4] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -419,7 +419,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[5], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[5] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -436,7 +436,7 @@ end end @.. broadcast = false zs[5] = (zs[5] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[5] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -453,7 +453,7 @@ end end @.. broadcast = false zs[5] = (zs[5] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[5] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -511,7 +511,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[6], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[6] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -528,7 +528,7 @@ end end @.. broadcast = false zs[6] = (zs[6] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[6] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -545,7 +545,7 @@ end end @.. broadcast = false zs[6] = (zs[6] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[6] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -604,7 +604,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[7], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[7] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -621,7 +621,7 @@ end end @.. broadcast = false zs[7] = (zs[7] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[7] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -638,7 +638,7 @@ end end @.. broadcast = false zs[7] = (zs[7] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[7] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -698,7 +698,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[8], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[8] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -715,7 +715,7 @@ end end @.. broadcast = false zs[8] = (zs[8] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[8] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -732,7 +732,7 @@ end end @.. broadcast = false zs[8] = (zs[8] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[8] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -793,7 +793,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[9], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[9] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -810,7 +810,7 @@ end end @.. broadcast = false zs[9] = (zs[9] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[9] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -827,7 +827,7 @@ end end @.. broadcast = false zs[9] = (zs[9] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[9] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -889,7 +889,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[10], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[10] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -906,7 +906,7 @@ end end @.. broadcast = false zs[10] = (zs[10] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[10] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -923,7 +923,7 @@ end end @.. broadcast = false zs[10] = (zs[10] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[10] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -986,7 +986,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[11], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[11] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -1003,7 +1003,7 @@ end end @.. broadcast = false zs[11] = (zs[11] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[11] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -1020,7 +1020,7 @@ end end @.. broadcast = false zs[11] = (zs[11] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[11] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -1084,7 +1084,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) fill!(zs[12], zero(eltype(u))) elseif predictor == Predictor.MaxOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[12] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -1101,7 +1101,7 @@ end end @.. broadcast = false zs[12] = (zs[12] - tmp) * inv(γ) elseif predictor == Predictor.CutoffOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[12] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -1118,7 +1118,7 @@ end end @.. broadcast = false zs[12] = (zs[12] - tmp) * inv(γ) elseif predictor == Predictor.VariableOrder - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) if _uses_hermite_interp(alg) Θ_pred = (t + c[12] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev @@ -1419,7 +1419,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[2] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -1487,7 +1487,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[3] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -1552,7 +1552,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[4] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -1617,7 +1617,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[5] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -1682,7 +1682,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[6] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -1747,7 +1747,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[7] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -1812,7 +1812,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[8] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -1877,7 +1877,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[9] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -1942,7 +1942,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[10] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -2007,7 +2007,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[11] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : @@ -2072,7 +2072,7 @@ end elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) && (integrator.success_iter == 0 || integrator.reeval_fsal) z_guess = zero(u) elseif predictor in (Predictor.MaxOrder, Predictor.VariableOrder, Predictor.CutoffOrder) - OrdinaryDiffEqCore.SciMLBase.addsteps!(integrator) + SciMLBase.addsteps!(integrator) Θ_pred = (t + c[12] * dt - integrator.tprev) / (integrator.t - integrator.tprev) dtp_pred = integrator.t - integrator.tprev q_pred = predictor == Predictor.MaxOrder ? 3 : diff --git a/lib/OrdinaryDiffEqSDIRK/test/qa/Project.toml b/lib/OrdinaryDiffEqSDIRK/test/qa/Project.toml index 31ef56b1c1b..5d39d039d92 100644 --- a/lib/OrdinaryDiffEqSDIRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqSDIRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqSDIRK = "2d112036-d095-4a1e-ab9a-08536f3ecdbf" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqSDIRK = "2" diff --git a/lib/OrdinaryDiffEqSDIRK/test/qa/qa.jl b/lib/OrdinaryDiffEqSDIRK/test/qa/qa.jl index ab500f0ccc4..c6c8f3dc310 100644 --- a/lib/OrdinaryDiffEqSDIRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqSDIRK/test/qa/qa.jl @@ -1,8 +1,37 @@ -using OrdinaryDiffEqSDIRK -using Aqua +using SciMLTesting, OrdinaryDiffEqSDIRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqSDIRK - ) -end +# The base solver-author API of OrdinaryDiffEqCore / OrdinaryDiffEqDifferentiation / +# OrdinaryDiffEqNonlinearSolve / DiffEqBase is now declared `public`, so those names +# no longer need ignoring here. What remains are genuine non-public internals with no +# public alternative, grouped by owning package: +# * OrdinaryDiffEqCore internals that were intentionally NOT promoted to public +# (the `lorenz`/`lorenz_oop` precompile-workload fixtures and the +# `trivial_limiter!` default limiter). +# * SciMLBase private helpers (`_reshape`/`_unwrap_val`/`_vec`). +# * External packages whose names have no public export (ConstructionBase's +# `constructorof`, TruncatedStacktraces' `@truncate_stacktrace`). +run_qa( + OrdinaryDiffEqSDIRK; + explicit_imports = true, + ei_kwargs = ( + # `constructorof` is owned by ConstructionBase (not a direct dep) and is + # reached through SciMLBase's re-export; it is the only non-owner access. + all_qualified_accesses_via_owners = (; ignore = (:constructorof,)), + all_qualified_accesses_are_public = (; + ignore = ( + # non-public in ConstructionBase (via SciMLBase re-export) + :constructorof, + # non-public OrdinaryDiffEqCore precompile-workload fixtures + :lorenz, :lorenz_oop, + )), + all_explicit_imports_are_public = (; + ignore = ( + # non-public SciMLBase internals + :_reshape, :_unwrap_val, :_vec, + # non-public TruncatedStacktraces macro + Symbol("@truncate_stacktrace"), + # non-public OrdinaryDiffEqCore internal (limiter default) + :trivial_limiter!, + )), + ), +) diff --git a/lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl b/lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl index 29280c47236..b4af6d8f383 100644 --- a/lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl +++ b/lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl @@ -1,24 +1,23 @@ module OrdinaryDiffEqSSPRK -import OrdinaryDiffEqCore: alg_order, calculate_residuals!, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, ssp_coefficient, +import OrdinaryDiffEqCore: perform_step!, ssp_coefficient, OrdinaryDiffEqAlgorithm, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, - OrdinaryDiffEqNewtonAdaptiveAlgorithm, - OrdinaryDiffEqRosenbrockAdaptiveAlgorithm, - OrdinaryDiffEqAdaptiveAlgorithm, uses_uprev, - alg_cache, _vec, _reshape, @cache, isfsal, full_cache, - constvalue, _unwrap_val, + OrdinaryDiffEqAdaptiveAlgorithm, + alg_cache, @cache, isfsal, full_cache, + constvalue, explicit_rk_docstring, trivial_limiter!, _ode_interpolant, _ode_interpolant!, - _ode_addsteps!, get_fsalfirstlast, copyat_or_push! -using FastBroadcast, MuladdMacro, RecursiveArrayTools -using DiffEqBase: @def -using FastBroadcast: Serial + _ode_addsteps!, get_fsalfirstlast import OrdinaryDiffEqCore - -using Reexport +import SciMLBase: alg_order +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals! +using RecursiveArrayTools: RecursiveArrayTools, copyat_or_push!, recursivefill! +using FastBroadcast: FastBroadcast, @.., Serial +using MuladdMacro: MuladdMacro, @muladd +using SciMLBase: SciMLBase, @def, ODEProblem, solve + +using Reexport: Reexport, @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqSSPRK/test/qa/Project.toml b/lib/OrdinaryDiffEqSSPRK/test/qa/Project.toml index 2889633c0ad..2d4ad7d1e6a 100644 --- a/lib/OrdinaryDiffEqSSPRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqSSPRK/test/qa/Project.toml @@ -1,23 +1,26 @@ [deps] AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqSSPRK = "669c94d9-1f4b-4b64-b377-1aa079aa2388" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[sources.OrdinaryDiffEqCore] -path = "../../../OrdinaryDiffEqCore" - -[sources.OrdinaryDiffEqSSPRK] -path = "../../" +[sources] +DiffEqBase = {path = "../../../DiffEqBase"} +OrdinaryDiffEqCore = {path = "../../../OrdinaryDiffEqCore"} +OrdinaryDiffEqSSPRK = {path = "../.."} [compat] AllocCheck = "0.2" Aqua = "0.8.11" +DiffEqBase = "7" JET = "0.9, 0.11" -julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqSSPRK = "2" SciMLBase = "3" +SciMLTesting = "1.7" +julia = "1.10" diff --git a/lib/OrdinaryDiffEqSSPRK/test/qa/qa.jl b/lib/OrdinaryDiffEqSSPRK/test/qa/qa.jl index 96363e95add..2051be79206 100644 --- a/lib/OrdinaryDiffEqSSPRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqSSPRK/test/qa/qa.jl @@ -1,8 +1,27 @@ -using OrdinaryDiffEqSSPRK -using Aqua +using SciMLTesting, OrdinaryDiffEqSSPRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqSSPRK - ) -end +run_qa( + OrdinaryDiffEqSSPRK; + explicit_imports = true, + ei_kwargs = ( + # Residual non-public names after the solver-author API was made public + # in OrdinaryDiffEqCore / DiffEqBase. Everything still listed here is a + # deliberate owner-internal that is NOT part of the supported public + # surface. + all_explicit_imports_are_public = (; + ignore = ( + # SciMLBase private codegen macro (no public counterpart). + Symbol("@def"), + # OrdinaryDiffEqCore codegen/perf internals kept non-public on + # purpose (see OrdinaryDiffEqCore's public block comment): + # the interpolation write-hook, the SSP coefficient accessor, + # and the no-op limiter. + :_ode_interpolant!, :ssp_coefficient, :trivial_limiter!, + ), + ), + # OrdinaryDiffEqCore precompile-workload test problems (not public API). + all_qualified_accesses_are_public = (; + ignore = (:lorenz, :lorenz_oop), + ), + ), +) diff --git a/lib/OrdinaryDiffEqStabilizedIRK/Project.toml b/lib/OrdinaryDiffEqStabilizedIRK/Project.toml index c8da6da231f..9c605a48298 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedIRK/Project.toml @@ -5,7 +5,6 @@ version = "2.0.1" [deps] FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" @@ -34,7 +33,6 @@ Test = "<0.0.1, 1" FastBroadcast = "1.3" Random = "<0.0.1, 1" DiffEqDevTools = "3" -MuladdMacro = "0.2.1" LinearAlgebra = "1.10" OrdinaryDiffEqDifferentiation = "3" SciMLBase = "3.10.0" diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl index c88cdd7b10d..b9f8a148431 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl @@ -1,29 +1,30 @@ module OrdinaryDiffEqStabilizedIRK -import OrdinaryDiffEqCore: alg_order, alg_maximum_order, - calculate_residuals!, default_controller, IController, - beta2_default, beta1_default, gamma_default, issplit, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, fac_default_gamma, - OrdinaryDiffEqAlgorithm, OrdinaryDiffEqNewtonAdaptiveAlgorithm, +import OrdinaryDiffEqCore: default_controller, IController, + gamma_default, issplit, + perform_step!, unwrap_alg, fac_default_gamma, + OrdinaryDiffEqNewtonAdaptiveAlgorithm, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, - OrdinaryDiffEqAdaptiveAlgorithm, - OrdinaryDiffEqAdaptiveImplicitAlgorithm, - alg_cache, _unwrap_val, @cache, - _reshape, _vec, full_cache, get_fsalfirstlast, - generic_solver_docstring, _ad_chunksize_int, _ad_fdtype, _fixup_ad + alg_cache, @cache, + get_fsalfirstlast, increment_nf!, set_EEst!, + generic_solver_docstring, _fixup_ad, + get_W, isnewton -using OrdinaryDiffEqDifferentiation: dolinsolve, update_W! -using OrdinaryDiffEqNonlinearSolve: NLNewton, nlsolve!, isnewton, build_nlsolver, - markfirststage!, du_alias_or_new, get_W +import SciMLBase: alg_order, _unwrap_val, _reshape, _vec +import DiffEqBase: calculate_residuals, calculate_residuals!, initialize! -using OrdinaryDiffEqStabilizedRK: ESERK4, ESERK5, RKC, SERK2 +import OrdinaryDiffEqDifferentiation: dolinsolve, update_W! +import OrdinaryDiffEqNonlinearSolve: NLNewton, nlsolve!, build_nlsolver, + markfirststage!, du_alias_or_new -using FastBroadcast, MuladdMacro, RecursiveArrayTools -import OrdinaryDiffEqCore -import ADTypes: AutoForwardDiff, AbstractADType +using OrdinaryDiffEqStabilizedRK: ESERK4, ESERK5, SERK2 -using Reexport +import FastBroadcast: @.. +import RecursiveArrayTools: recursivefill! +import ADTypes: AutoForwardDiff + +using Reexport: Reexport, @reexport +using SciMLBase: SciMLBase @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl index 1a41409f24e..5ae18e9b7b9 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl @@ -5,7 +5,7 @@ function initialize!(integrator, cache::IRKCConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) cache.du₁ = f1(uprev, p, t) cache.du₂ = f2(uprev, p, t) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.fsalfirst = cache.du₁ + cache.du₂ @@ -82,7 +82,7 @@ function perform_step!(integrator, cache::IRKCConstantCache, repeat_step = false f1ⱼ₋₁ = f1(gprev, p, t + Cⱼ₋₁ * dt) f2ⱼ₋₁ = f2(gprev, p, t + Cⱼ₋₁ * dt) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 nlsolver.tmp = (1 - μ - ν) * uprev + μ * gprev + ν * gprev2 + dt * μs * f2ⱼ₋₁ + dt * νs * du₂ + (νs - (1 - μ - ν) * μs₁) * dt * du₁ - ν * μs₁ * dt * f1ⱼ₋₂ nlsolver.z = dt * f1ⱼ₋₁ @@ -110,7 +110,7 @@ function perform_step!(integrator, cache::IRKCConstantCache, repeat_step = false cache.du₁ = f1(u, p, t + dt) cache.du₂ = f2(u, p, t + dt) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 # error estimate if isnewton(nlsolver) && integrator.opts.adaptive @@ -121,7 +121,7 @@ function perform_step!(integrator, cache::IRKCConstantCache, repeat_step = false tmp, uprev, u, integrator.opts.abstol, integrator.opts.reltol, integrator.opts.internalnorm, t ) - OrdinaryDiffEqCore.set_EEst!(integrator, integrator.opts.internalnorm(atmp, t)) + set_EEst!(integrator, integrator.opts.internalnorm(atmp, t)) end integrator.fsallast = cache.du₁ + cache.du₂ @@ -139,7 +139,7 @@ function initialize!(integrator, cache::IRKCCache) integrator.k[2] = integrator.fsallast f1(cache.du₁, uprev, p, t) f2(cache.du₂, uprev, p, t) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 return @.. broadcast = false integrator.fsalfirst = cache.du₁ + cache.du₂ end @@ -214,7 +214,7 @@ function perform_step!(integrator, cache::IRKCCache, repeat_step = false) f1(f1ⱼ₋₁, gprev, p, t + Cⱼ₋₁ * dt) f2(f2ⱼ₋₁, gprev, p, t + Cⱼ₋₁ * dt) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 @.. broadcast = false nlsolver.tmp = (1 - μ - ν) * uprev + μ * gprev + ν * gprev2 + dt * μs * f2ⱼ₋₁ + dt * νs * du₂ + (νs - (1 - μ - ν) * μs₁) * dt * du₁ - ν * μs₁ * dt * f1ⱼ₋₂ @.. broadcast = false nlsolver.z = dt * f1ⱼ₋₁ @@ -244,7 +244,7 @@ function perform_step!(integrator, cache::IRKCCache, repeat_step = false) @.. broadcast = false f2ⱼ₋₁ = du₂ f1(du₁, u, p, t + dt) f2(du₂, u, p, t + dt) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 # error estimate if isnewton(nlsolver) && integrator.opts.adaptive @@ -258,7 +258,7 @@ function perform_step!(integrator, cache::IRKCCache, repeat_step = false) atmp, tmp, uprev, u, integrator.opts.abstol, integrator.opts.reltol, integrator.opts.internalnorm, t ) - OrdinaryDiffEqCore.set_EEst!(integrator, integrator.opts.internalnorm(atmp, t)) + set_EEst!(integrator, integrator.opts.internalnorm(atmp, t)) end @.. broadcast = false integrator.fsallast = du₁ + du₂ diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_utils.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_utils.jl index 602a2ddb206..bdc7cc39e3e 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_utils.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_utils.jl @@ -19,7 +19,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqConstantCache) else fz = fsalfirst z = f(fz, p, t) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) end else z = cache.zprev @@ -56,7 +56,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqConstantCache) tmp = fz - cache.du₂ else fz = f(z, p, t) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) tmp = fz - fsalfirst end Δ = integrator.opts.internalnorm(tmp, t) @@ -122,7 +122,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqMutableCache) else @.. broadcast = false fz = fsalfirst f(z, fz, p, t) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) end else @.. broadcast = false z = ccache.zprev @@ -159,7 +159,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqMutableCache) @.. broadcast = false atmp = fz - cache.du₂ else f(fz, z, p, t) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + increment_nf!(integrator.stats, 1) @.. broadcast = false atmp = fz - fsalfirst end Δ = integrator.opts.internalnorm(atmp, t) diff --git a/lib/OrdinaryDiffEqStabilizedIRK/test/qa/Project.toml b/lib/OrdinaryDiffEqStabilizedIRK/test/qa/Project.toml index fa35525e5e8..17cd0ecd12a 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedIRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqStabilizedIRK = "e3e12d00-db14-5390-b879-ac3dd2ef6296" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqStabilizedIRK = "2" diff --git a/lib/OrdinaryDiffEqStabilizedIRK/test/qa/qa.jl b/lib/OrdinaryDiffEqStabilizedIRK/test/qa/qa.jl index 7f59882a009..6a8cfc6f7af 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/test/qa/qa.jl @@ -1,8 +1,14 @@ -using OrdinaryDiffEqStabilizedIRK -using Aqua +using SciMLTesting, OrdinaryDiffEqStabilizedIRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqStabilizedIRK - ) -end +run_qa( + OrdinaryDiffEqStabilizedIRK; + explicit_imports = true, + ei_kwargs = (; + all_explicit_imports_are_public = (; + ignore = ( + # SciMLBase internals, not public on registered releases. + :_unwrap_val, :_reshape, :_vec, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl b/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl index 334bae67c01..d7217279db5 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl @@ -1,21 +1,28 @@ module OrdinaryDiffEqStabilizedRK -import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, calculate_residuals!, - beta2_default, beta1_default, gamma_default, qmax_default, alg_extrapolates, +import OrdinaryDiffEqCore: alg_adaptive_order, + gamma_default, qmax_default, alg_extrapolates, fac_default_gamma, has_dtnew_modification, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, - OrdinaryDiffEqAlgorithm, default_controller, PredictiveController, + perform_step!, unwrap_alg, + default_controller, PredictiveController, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, - OrdinaryDiffEqAdaptiveAlgorithm, calc_dt_propose!, - alg_cache, _vec, _reshape, @cache, - constvalue, _unwrap_val, full_cache, get_fsalfirstlast, + OrdinaryDiffEqAdaptiveAlgorithm, + alg_cache, @cache, + constvalue, full_cache, get_fsalfirstlast, generic_solver_docstring -using FastBroadcast, MuladdMacro, RecursiveArrayTools import OrdinaryDiffEqCore -using DiffEqBase: DiffEqBase, value +using FastBroadcast: FastBroadcast, @.. +using MuladdMacro: MuladdMacro, @muladd +using RecursiveArrayTools: RecursiveArrayTools, recursivefill! +# `calculate_residuals`/`calculate_residuals!`/`initialize!` are owned by DiffEqBase; +# `alg_order`/`_vec`/`value` are owned by SciMLBase. Import from the owner. +# `initialize!`/`alg_order` are extended here, so they must be `import`ed. +import DiffEqBase: initialize! +using DiffEqBase: calculate_residuals, calculate_residuals! -using Reexport +using SciMLBase: SciMLBase +import SciMLBase: alg_order, _vec, value +using Reexport: Reexport, @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl index 506cf576bcb..c1eb62461cc 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl @@ -139,7 +139,7 @@ end else @.. broadcast = false u = -δt₂ * k end - c = DiffEqBase.value(sign(δt₁)) * integrator.opts.internalnorm(δt₁, t) + c = value(sign(δt₁)) * integrator.opts.internalnorm(δt₁, t) tᵢ₋₁ += c f(k, uᵢ₋₁, p, tᵢ₋₁) OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @@ -249,7 +249,7 @@ end # Stage-2 c₂ = a₂₁ - _c₂ = DiffEqBase.value(sign(c₂)) * integrator.opts.internalnorm(c₂, t) + _c₂ = value(sign(c₂)) * integrator.opts.internalnorm(c₂, t) tᵢ₋₂ = tᵢ₋₁ + _c₂ uᵢ₋₁ = f(uᵢ₋₁, p, tᵢ₋₂) OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @@ -262,7 +262,7 @@ end # Stage-3 c₃ = a₃₁ + a₃₂ - _c₃ = DiffEqBase.value(sign(c₃)) * integrator.opts.internalnorm(c₃, t) + _c₃ = value(sign(c₃)) * integrator.opts.internalnorm(c₃, t) tᵢ₋₂ = tᵢ₋₁ + _c₃ uᵢ₋₂ = f(uᵢ₋₂, p, tᵢ₋₂) OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @@ -274,7 +274,7 @@ end #Stage-4 c₄ = a₄₁ + a₄₂ + a₄₃ - _c₄ = DiffEqBase.value(sign(c₄)) * integrator.opts.internalnorm(c₄, t) + _c₄ = value(sign(c₄)) * integrator.opts.internalnorm(c₄, t) tᵢ₋₂ = tᵢ₋₁ + _c₄ uᵢ₋₃ = f(uᵢ₋₃, p, tᵢ₋₂) OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @@ -400,7 +400,7 @@ end # Stage-3 c₃ = a₃₁ + a₃₂ - _c₃ = DiffEqBase.value(sign(c₃)) * integrator.opts.internalnorm(c₃, t) + _c₃ = value(sign(c₃)) * integrator.opts.internalnorm(c₃, t) tᵢ₋₂ = tᵢ₋₁ + _c₃ f(k, uᵢ₋₂, p, tᵢ₋₂) OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @@ -412,7 +412,7 @@ end #Stage-4 c₄ = a₄₁ + a₄₂ + a₄₃ - _c₄ = DiffEqBase.value(sign(c₄)) * integrator.opts.internalnorm(c₄, t) + _c₄ = value(sign(c₄)) * integrator.opts.internalnorm(c₄, t) tᵢ₋₂ = tᵢ₋₁ + _c₄ f(k, uᵢ₋₃, p, tᵢ₋₂) OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) diff --git a/lib/OrdinaryDiffEqStabilizedRK/test/qa/Project.toml b/lib/OrdinaryDiffEqStabilizedRK/test/qa/Project.toml index ff71ba764a5..6b2b50712f9 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqStabilizedRK = "358294b1-0aab-51c3-aafe-ad5ab194a2ad" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources] @@ -18,4 +19,5 @@ JET = "0.9, 0.11" OrdinaryDiffEqCore = "4" OrdinaryDiffEqStabilizedRK = "2" SciMLBase = "3" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/OrdinaryDiffEqStabilizedRK/test/qa/qa.jl b/lib/OrdinaryDiffEqStabilizedRK/test/qa/qa.jl index 2dd5f2ac23a..0990c5e0138 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/test/qa/qa.jl @@ -1,8 +1,14 @@ -using OrdinaryDiffEqStabilizedRK -using Aqua +using SciMLTesting, OrdinaryDiffEqStabilizedRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqStabilizedRK - ) -end +run_qa( + OrdinaryDiffEqStabilizedRK; + explicit_imports = true, + ei_kwargs = ( + all_explicit_imports_are_public = ( + ignore = ( + # SciMLBase-owned helpers not yet declared public (pending release). + :_vec, :value, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl b/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl index 48c44115e82..70d1df66f03 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl @@ -1,22 +1,22 @@ module OrdinaryDiffEqSymplecticRK -import OrdinaryDiffEqCore: alg_order, calculate_residuals!, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, - OrdinaryDiffEqAlgorithm, +import OrdinaryDiffEqCore: perform_step!, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, - OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqPartitionedAlgorithm, - CompiledFloats, uses_uprev, - alg_cache, _vec, _reshape, @cache, isfsal, full_cache, - constvalue, _unwrap_val, - explicit_rk_docstring, trivial_limiter!, - _ode_interpolant!, _ode_addsteps!, get_fsalfirstlast, + CompiledFloats, + alg_cache, @cache, + constvalue, + get_fsalfirstlast, generic_solver_docstring, default_linear_interpolation -using FastBroadcast, MuladdMacro, RecursiveArrayTools +import SciMLBase: alg_order, full_cache +import DiffEqBase: initialize! +using FastBroadcast: @.. +using MuladdMacro: @muladd +using RecursiveArrayTools: ArrayPartition import OrdinaryDiffEqCore -using Reexport +using Reexport: Reexport, @reexport +using SciMLBase: SciMLBase @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqSymplecticRK/test/qa/Project.toml b/lib/OrdinaryDiffEqSymplecticRK/test/qa/Project.toml index 0b88d6a81ef..97b5055ae44 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqSymplecticRK/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqSymplecticRK = "fa646aed-7ef9-47eb-84c4-9443fc8cbfa8" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqSymplecticRK = "2" diff --git a/lib/OrdinaryDiffEqSymplecticRK/test/qa/qa.jl b/lib/OrdinaryDiffEqSymplecticRK/test/qa/qa.jl index eba4d7280d9..0ec74dcfcbc 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/test/qa/qa.jl @@ -1,8 +1,6 @@ -using OrdinaryDiffEqSymplecticRK -using Aqua +using SciMLTesting, OrdinaryDiffEqSymplecticRK, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqSymplecticRK - ) -end +run_qa( + OrdinaryDiffEqSymplecticRK; + explicit_imports = true, +) diff --git a/lib/OrdinaryDiffEqTaylorSeries/src/OrdinaryDiffEqTaylorSeries.jl b/lib/OrdinaryDiffEqTaylorSeries/src/OrdinaryDiffEqTaylorSeries.jl index 3ca089f50e6..2efa6268db3 100644 --- a/lib/OrdinaryDiffEqTaylorSeries/src/OrdinaryDiffEqTaylorSeries.jl +++ b/lib/OrdinaryDiffEqTaylorSeries/src/OrdinaryDiffEqTaylorSeries.jl @@ -1,31 +1,30 @@ module OrdinaryDiffEqTaylorSeries -import OrdinaryDiffEqCore: alg_order, alg_stability_size, explicit_rk_docstring, +import OrdinaryDiffEqCore: alg_stability_size, explicit_rk_docstring, OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqMutableCache, alg_cache, - OrdinaryDiffEqConstantCache, @fold, trivial_limiter!, - constvalue, perform_step!, calculate_residuals, @cache, - calculate_residuals!, _ode_interpolant, _ode_interpolant!, - CompiledFloats, @OnDemandTableauExtract, initialize!, - perform_step!, OrdinaryDiffEqAlgorithm, - CompositeAlgorithm, _ode_addsteps!, copyat_or_push!, - AutoAlgSwitch, get_fsalfirstlast, - full_cache, DerivativeOrderNotPossibleError, unwrap_alg, step_accept_controller!, + OrdinaryDiffEqConstantCache, trivial_limiter!, + perform_step!, @cache, + _ode_interpolant, _ode_interpolant!, + OrdinaryDiffEqAlgorithm, + _ode_addsteps!, + get_fsalfirstlast, + DerivativeOrderNotPossibleError, unwrap_alg, step_accept_controller!, stepsize_controller!, get_current_adaptive_order, get_current_alg_order using FastBroadcast: Serial import MuladdMacro: @muladd import FastBroadcast: @.. -import RecursiveArrayTools: recursivefill!, recursive_unitless_bottom_eltype -import LinearAlgebra: norm +import RecursiveArrayTools: recursivefill! using TruncatedStacktraces: @truncate_stacktrace -using TaylorDiff, Symbolics -using TaylorDiff: make_seed, get_coefficient, append_coefficient, flatten -import SciMLBase: @def, unwrapped_f +using TaylorDiff: TaylorDiff, TaylorArray, TaylorScalar +using Symbolics: Symbolics, @variables, build_function +using SymbolicUtils: SymbolicUtils +import SciMLBase: SciMLBase, unwrapped_f, alg_order, ODEFunction, ODEProblem, solve +import DiffEqBase: initialize!, calculate_residuals, calculate_residuals! import OrdinaryDiffEqCore -using FunctionWrappers import FunctionWrappers: FunctionWrapper -using Reexport +using Reexport: @reexport @reexport using SciMLBase include("algorithms.jl") diff --git a/lib/OrdinaryDiffEqTaylorSeries/src/TaylorSeries_perform_step.jl b/lib/OrdinaryDiffEqTaylorSeries/src/TaylorSeries_perform_step.jl index 06535e63e36..c5de4050031 100644 --- a/lib/OrdinaryDiffEqTaylorSeries/src/TaylorSeries_perform_step.jl +++ b/lib/OrdinaryDiffEqTaylorSeries/src/TaylorSeries_perform_step.jl @@ -1,5 +1,3 @@ -using TaylorDiff: TaylorDiff, extract_derivative, extract_derivative! - # Extract the first-order derivative from TaylorScalar results. # For scalars, access .partials[1]; for arrays, map over elements. @inline _extract_taylor2_deriv(x::TaylorScalar) = x.partials[1] @@ -7,9 +5,9 @@ using TaylorDiff: TaylorDiff, extract_derivative, extract_derivative! # Extract the i-th coefficient from a TaylorScalar or array of TaylorScalars. # For scalar problems, returns a scalar. For array problems, returns a vector. -@inline _taylor_get_coefficient(ts::TaylorScalar, i::Int) = get_coefficient(ts, i) +@inline _taylor_get_coefficient(ts::TaylorScalar, i::Int) = TaylorDiff.get_coefficient(ts, i) @inline function _taylor_get_coefficient(arr::AbstractArray{<:TaylorScalar}, i::Int) - return map(ts -> get_coefficient(ts, i), arr) + return map(ts -> TaylorDiff.get_coefficient(ts, i), arr) end @inline make_taylor(all::Vararg{X, P}) where {P, X <: AbstractArray} = TaylorArray( @@ -101,7 +99,7 @@ function initialize!(integrator, cache::ExplicitTaylorCache{P}) where {P} resize!(integrator.k, P) # Setup k pointers for i in 1:P - integrator.k[i] = get_coefficient(cache.utaylor, i) + integrator.k[i] = TaylorDiff.get_coefficient(cache.utaylor, i) end return nothing end @@ -129,7 +127,7 @@ end # Copy Taylor coefficients into k for dense output interpolation. # Use map! to avoid the intermediate allocation from get_coefficient. for i in 1:P - map!(ts -> get_coefficient(ts, i), integrator.k[i], utaylor) + map!(ts -> TaylorDiff.get_coefficient(ts, i), integrator.k[i], utaylor) end return nothing end diff --git a/lib/OrdinaryDiffEqTaylorSeries/src/alg_utils.jl b/lib/OrdinaryDiffEqTaylorSeries/src/alg_utils.jl index 3e278d80a56..9750f7e41a1 100644 --- a/lib/OrdinaryDiffEqTaylorSeries/src/alg_utils.jl +++ b/lib/OrdinaryDiffEqTaylorSeries/src/alg_utils.jl @@ -74,8 +74,8 @@ function build_jet(f, ::Val{iip}, p, order::Val{P}, length = nothing) where {P, else fu = f(u, p, t) end - d = get_coefficient(fu, index - 1) / index - u = append_coefficient(u, d) + d = TaylorDiff.get_coefficient(fu, index - 1) / index + u = TaylorDiff.append_coefficient(u, d) end # Flatten TaylorScalar coefficients for build_function (it doesn't handle custom structs) @@ -126,7 +126,7 @@ end for i in P:-1:1 ex = :(v[$i] + z * $ex) end - return :($(Expr(:meta, :inline)); v = flatten(t); $ex) + return :($(Expr(:meta, :inline)); v = TaylorDiff.flatten(t); $ex) end # Evaluate polynomial for scalar TaylorScalar (returns scalar) diff --git a/lib/OrdinaryDiffEqTaylorSeries/test/qa/Project.toml b/lib/OrdinaryDiffEqTaylorSeries/test/qa/Project.toml index 23394d2b02a..a25359aba85 100644 --- a/lib/OrdinaryDiffEqTaylorSeries/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqTaylorSeries/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqTaylorSeries = "9c7f1690-dd92-42a3-8318-297ee24d8d39" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources.OrdinaryDiffEqCore] @@ -17,6 +18,7 @@ path = "../../" AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" +SciMLTesting = "1.7" julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqTaylorSeries = "2" diff --git a/lib/OrdinaryDiffEqTaylorSeries/test/qa/qa.jl b/lib/OrdinaryDiffEqTaylorSeries/test/qa/qa.jl index 7e82446cd60..bdf30b5f910 100644 --- a/lib/OrdinaryDiffEqTaylorSeries/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqTaylorSeries/test/qa/qa.jl @@ -1,12 +1,40 @@ -using OrdinaryDiffEqTaylorSeries -using Aqua +using SciMLTesting, OrdinaryDiffEqTaylorSeries, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqTaylorSeries; - unbound_args = false, - undefined_exports = false, - stale_deps = false, - ambiguities = false - ) -end +# Every name in the ignore lists below is genuinely internal (not exported and +# not declared `public`) in its OWNER package, so there is no public name to +# migrate to. The base solver-author API (perform_step!/alg_cache/controllers/ +# etc.) is now declared `public` in OrdinaryDiffEqCore, so those entries have +# been dropped; only the genuine residual remains (see SciML/OrdinaryDiffEq.jl#3776). +run_qa( + OrdinaryDiffEqTaylorSeries; + aqua_kwargs = (; + unbound_args = false, undefined_exports = false, stale_deps = false, + ambiguities = false, + ), + explicit_imports = true, + ei_kwargs = (; + # Explicit imports of names that are not `public` in their owner. + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore limiter default, deliberately kept + # non-public (codegen/perf helper, not extension API). + :trivial_limiter!, + # other-package internals with no public alias + Symbol("@truncate_stacktrace"), :FunctionWrapper, + ), + ), + # Qualified accesses (Module.name) of non-public names. + all_qualified_accesses_are_public = (; + ignore = ( + # lorenz/lorenz_oop precompile-workload helpers (OrdinaryDiffEqCore, + # deliberately non-public per its public-API comment). + :lorenz, :lorenz_oop, + # TaylorDiff internals (no public API for these primitives) + :append_coefficient, :flatten, :get_coefficient, :make_seed, + :partials, + # Base / Symbolics internals + :RefValue, :variables, + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqTsit5/Project.toml b/lib/OrdinaryDiffEqTsit5/Project.toml index e7edc6c5e05..798ff5bdfb7 100644 --- a/lib/OrdinaryDiffEqTsit5/Project.toml +++ b/lib/OrdinaryDiffEqTsit5/Project.toml @@ -1,9 +1,10 @@ name = "OrdinaryDiffEqTsit5" uuid = "b1df2697-797e-41e3-8120-5422d3b24e4a" -version = "2.0.2" +version = "2.0.3" authors = ["ParamThakkar123 "] [deps] +CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -22,6 +23,7 @@ DiffEqDevTools = {path = "../DiffEqDevTools"} OrdinaryDiffEqCore = {path = "../OrdinaryDiffEqCore"} [compat] +CommonSolve = "0.2.4" DiffEqBase = "7" DiffEqDevTools = "3" FastBroadcast = "1.3" diff --git a/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl b/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl index 0e013dc8e44..5f025dbb3e3 100644 --- a/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl +++ b/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl @@ -1,27 +1,31 @@ module OrdinaryDiffEqTsit5 -import OrdinaryDiffEqCore: alg_order, alg_stability_size, explicit_rk_docstring, +import OrdinaryDiffEqCore: alg_stability_size, explicit_rk_docstring, OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqMutableCache, alg_cache, OrdinaryDiffEqConstantCache, @fold, trivial_limiter!, - constvalue, perform_step!, calculate_residuals, @cache, - calculate_residuals!, _ode_interpolant, _ode_interpolant!, - CompiledFloats, @OnDemandTableauExtract, initialize!, - perform_step!, - CompositeAlgorithm, _ode_addsteps!, copyat_or_push!, + constvalue, perform_step!, @cache, + _ode_interpolant, _ode_interpolant!, + CompiledFloats, @OnDemandTableauExtract, + CompositeAlgorithm, _ode_addsteps!, AutoAlgSwitch, get_fsalfirstlast, full_cache, DerivativeOrderNotPossibleError using FastBroadcast: Serial import MuladdMacro: @muladd import FastBroadcast: @.. -import RecursiveArrayTools: recursivefill!, recursive_unitless_bottom_eltype +import RecursiveArrayTools: recursivefill!, recursive_unitless_bottom_eltype, + copyat_or_push! import LinearAlgebra: norm using TruncatedStacktraces: @truncate_stacktrace -import SciMLBase: @def +import SciMLBase: alg_order, @def +using DiffEqBase: calculate_residuals, calculate_residuals! +import DiffEqBase: initialize! import OrdinaryDiffEqCore +using CommonSolve: solve -using Reexport +using Reexport: Reexport, @reexport @reexport using SciMLBase +using SciMLBase: SciMLBase, ODEProblem include("algorithms.jl") include("alg_utils.jl") @@ -103,4 +107,12 @@ end export Tsit5, AutoTsit5 +# Cross-sublibrary cache types that other OrdinaryDiffEq solver sublibraries +# (e.g. OrdinaryDiffEqNordsieck) reference to reuse the Tsit5 step. Marked +# public so those references are recognized as a supported extension API rather +# than internal access. +@static if VERSION >= v"1.11.0-DEV.469" + eval(Expr(:public, :Tsit5Cache, :Tsit5ConstantCache)) +end + end diff --git a/lib/OrdinaryDiffEqTsit5/test/qa/Project.toml b/lib/OrdinaryDiffEqTsit5/test/qa/Project.toml index bfe4497ebd3..5f403b412ca 100644 --- a/lib/OrdinaryDiffEqTsit5/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqTsit5/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources] @@ -18,4 +19,5 @@ JET = "0.9, 0.11" OrdinaryDiffEqCore = "4" OrdinaryDiffEqTsit5 = "2" SciMLBase = "3" +SciMLTesting = "1.7" julia = "1.10" diff --git a/lib/OrdinaryDiffEqTsit5/test/qa/qa.jl b/lib/OrdinaryDiffEqTsit5/test/qa/qa.jl index eaf4ebf9fd0..0f96839c0c0 100644 --- a/lib/OrdinaryDiffEqTsit5/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqTsit5/test/qa/qa.jl @@ -1,8 +1,31 @@ -using OrdinaryDiffEqTsit5 -using Aqua +using SciMLTesting, OrdinaryDiffEqTsit5, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqTsit5 - ) -end +run_qa( + OrdinaryDiffEqTsit5; + explicit_imports = true, + ei_kwargs = (; + # Residual after the PHASE-A make-public sweep: the solver-author API + # (alg_cache/perform_step!/_ode_interpolant!/CompiledFloats/... in + # OrdinaryDiffEqCore, calculate_residuals in DiffEqBase, etc.) is now + # declared `public` on this branch and no longer needs an ignore. What + # remains are owner-internal names with no public alternative. + all_qualified_accesses_are_public = (; + ignore = ( + # OrdinaryDiffEqCore — precompile-workload test functions (internal) + :lorenz, :lorenz_oop, + ), + ), + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore — private codegen macros / limiter kept + # non-public in PHASE A (owner-internal, no public alternative) + Symbol("@fold"), Symbol("@OnDemandTableauExtract"), + :trivial_limiter!, + # SciMLBase + Symbol("@def"), + # TruncatedStacktraces + Symbol("@truncate_stacktrace"), + ), + ), + ), +) diff --git a/lib/OrdinaryDiffEqVerner/src/OrdinaryDiffEqVerner.jl b/lib/OrdinaryDiffEqVerner/src/OrdinaryDiffEqVerner.jl index 5ea1da71613..b218636c927 100644 --- a/lib/OrdinaryDiffEqVerner/src/OrdinaryDiffEqVerner.jl +++ b/lib/OrdinaryDiffEqVerner/src/OrdinaryDiffEqVerner.jl @@ -1,27 +1,29 @@ module OrdinaryDiffEqVerner -import OrdinaryDiffEqCore: alg_order, calculate_residuals!, - initialize!, perform_step!, unwrap_alg, - calculate_residuals, alg_stability_size, - OrdinaryDiffEqAlgorithm, +import OrdinaryDiffEqCore: perform_step!, unwrap_alg, + alg_stability_size, CompositeAlgorithm, accept_step_controller, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, - OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev, - alg_cache, _vec, _reshape, @cache, isfsal, full_cache, - constvalue, _unwrap_val, + OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, + alg_cache, @cache, isfsal, full_cache, + constvalue, explicit_rk_docstring, trivial_limiter!, _ode_interpolant, _ode_interpolant!, _ode_addsteps!, @fold, @OnDemandTableauExtract, AutoAlgSwitch, DerivativeOrderNotPossibleError, - get_fsalfirstlast, copyat_or_push! -using FastBroadcast, MuladdMacro, RecursiveArrayTools -using DiffEqBase: @def, @tight_loop_macros -using FastBroadcast: Serial + get_fsalfirstlast +import DiffEqBase: calculate_residuals!, calculate_residuals, initialize! +import SciMLBase: alg_order, _unwrap_val, @def +using FastBroadcast: @.., Serial +using MuladdMacro: @muladd +using RecursiveArrayTools: recursive_unitless_bottom_eltype, recursivecopy, + recursivefill!, copyat_or_push! using TruncatedStacktraces: @truncate_stacktrace using LinearAlgebra: norm import OrdinaryDiffEqCore -using Reexport +using Reexport: @reexport @reexport using SciMLBase +using SciMLBase: ODEProblem include("algorithms.jl") include("alg_utils.jl") @@ -94,7 +96,7 @@ PrecompileTools.@compile_workload begin end for prob in prob_list, solver in solver_list - solve(prob, solver)(5.0) + SciMLBase.solve(prob, solver)(5.0) end prob_list = nothing diff --git a/lib/OrdinaryDiffEqVerner/test/qa/Project.toml b/lib/OrdinaryDiffEqVerner/test/qa/Project.toml index 8b57d67b960..84315c36b3e 100644 --- a/lib/OrdinaryDiffEqVerner/test/qa/Project.toml +++ b/lib/OrdinaryDiffEqVerner/test/qa/Project.toml @@ -5,19 +5,19 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[sources.OrdinaryDiffEqCore] -path = "../../../OrdinaryDiffEqCore" - -[sources.OrdinaryDiffEqVerner] -path = "../../" +[sources] +OrdinaryDiffEqCore = {path = "../../../OrdinaryDiffEqCore"} +OrdinaryDiffEqVerner = {path = "../.."} [compat] AllocCheck = "0.2" Aqua = "0.8.11" JET = "0.9, 0.11" -julia = "1.10" OrdinaryDiffEqCore = "4" OrdinaryDiffEqVerner = "2" SciMLBase = "3" +SciMLTesting = "1.7" +julia = "1.10" diff --git a/lib/OrdinaryDiffEqVerner/test/qa/qa.jl b/lib/OrdinaryDiffEqVerner/test/qa/qa.jl index 6a2b8d6f6e1..094ca453ed9 100644 --- a/lib/OrdinaryDiffEqVerner/test/qa/qa.jl +++ b/lib/OrdinaryDiffEqVerner/test/qa/qa.jl @@ -1,8 +1,34 @@ -using OrdinaryDiffEqVerner -using Aqua +using SciMLTesting, OrdinaryDiffEqVerner, Test -@testset "Aqua" begin - Aqua.test_all( - OrdinaryDiffEqVerner - ) -end +run_qa( + OrdinaryDiffEqVerner; + explicit_imports = true, + ei_kwargs = ( + # `SciMLBase` module name is brought into scope by `@reexport using SciMLBase` + # (intentional: this package re-exports the SciMLBase public API and also uses + # it as a qualified accessor, e.g. `SciMLBase.solve`, `SciMLBase.AutoSpecialize`). + no_implicit_imports = (; ignore = (:SciMLBase,)), + # Qualified accesses to names that are not (yet) declared public by their owners. + all_qualified_accesses_are_public = (; + ignore = ( + # SciMLBase internals (not public on registered SciMLBase 3.30.x) + :has_lazy_interpolation, + # OrdinaryDiffEqCore test-only helpers (deliberately kept non-public) + :lorenz, :lorenz_oop, + )), + # Explicit imports of names not (yet) declared public by their owners. + all_explicit_imports_are_public = (; + ignore = ( + # OrdinaryDiffEqCore owner-internal names (private codegen macros + + # cache/interpolation internals deliberately not part of the public + # solver-author API declared in PHASE A) + Symbol("@fold"), Symbol("@OnDemandTableauExtract"), + :CompiledFloats, :DerivativeOrderNotPossibleError, + :_ode_interpolant!, :trivial_limiter!, + # SciMLBase internals (not public on registered SciMLBase 3.30.x) + Symbol("@def"), :_unwrap_val, + # TruncatedStacktraces internal macro + Symbol("@truncate_stacktrace"), + )), + ), +) diff --git a/lib/StochasticDiffEq/src/default_sde_alg.jl b/lib/StochasticDiffEq/src/default_sde_alg.jl index 38ff75c777d..d6e8ec06089 100644 --- a/lib/StochasticDiffEq/src/default_sde_alg.jl +++ b/lib/StochasticDiffEq/src/default_sde_alg.jl @@ -10,7 +10,7 @@ function get_alg_hints(o) end function default_algorithm( - prob::DiffEqBase.AbstractSDEProblem{uType, tType, isinplace, ND}; + prob::SciMLBase.AbstractSDEProblem{uType, tType, isinplace, ND}; kwargs... ) where {uType, tType, isinplace, ND} o = Dict{Symbol, Any}(kwargs) @@ -70,7 +70,7 @@ SciMLBase.supports_solve_rng(::SciMLBase.AbstractSDEProblem, ::Nothing) = true # Dispatch for __init with Nothing algorithm - use default function DiffEqBase.__init( - prob::DiffEqBase.AbstractSDEProblem, ::Nothing, args...; kwargs... + prob::SciMLBase.AbstractSDEProblem, ::Nothing, args...; kwargs... ) alg = default_algorithm(prob; kwargs...) return DiffEqBase.__init(prob, alg, args...; kwargs...) @@ -78,7 +78,7 @@ end # Dispatch for __solve with Nothing algorithm - use default function DiffEqBase.__solve( - prob::DiffEqBase.AbstractSDEProblem, ::Nothing, args...; kwargs... + prob::SciMLBase.AbstractSDEProblem, ::Nothing, args...; kwargs... ) alg = default_algorithm(prob; kwargs...) return DiffEqBase.__solve(prob, alg, args...; kwargs...) diff --git a/lib/StochasticDiffEqCore/Project.toml b/lib/StochasticDiffEqCore/Project.toml index 007a4d16898..c08cc41a781 100644 --- a/lib/StochasticDiffEqCore/Project.toml +++ b/lib/StochasticDiffEqCore/Project.toml @@ -1,12 +1,13 @@ name = "StochasticDiffEqCore" uuid = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" -version = "2.0.2" +version = "2.0.3" authors = ["Chris Rackauckas "] [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" +CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503" FastPower = "a4df4552-cc26-4903-aec0-212e50a0e84b" @@ -37,6 +38,7 @@ StochasticDiffEqLevyArea = {path = "../StochasticDiffEqLevyArea"} ADTypes = "1.22.0" Adapt = "4.3.0" ArrayInterface = "7.19.0" +CommonSolve = "0.2.4" DiffEqBase = "7" DiffEqNoiseProcess = "5.30.0" FastPower = "1.1.2" diff --git a/lib/StochasticDiffEqCore/src/StochasticDiffEqCore.jl b/lib/StochasticDiffEqCore/src/StochasticDiffEqCore.jl index 0e62eb9c17d..f470c59fd4c 100644 --- a/lib/StochasticDiffEqCore/src/StochasticDiffEqCore.jl +++ b/lib/StochasticDiffEqCore/src/StochasticDiffEqCore.jl @@ -1,11 +1,15 @@ module StochasticDiffEqCore -using Reexport +using Reexport: Reexport, @reexport @reexport using DiffEqBase import ADTypes import OrdinaryDiffEqCore +# SDE/RODE/Jump algorithm and cache supertypes plus the shared solver-loop +# helpers live in OrdinaryDiffEqCore and are not part of its public API; they +# are dispatched on and extended here (see the EI ignore lists in +# test/qa/qa.jl). import OrdinaryDiffEqCore: ODEIntegrator, StochasticDiffEqAlgorithm, StochasticDiffEqAdaptiveAlgorithm, StochasticDiffEqCompositeAlgorithm, @@ -17,101 +21,69 @@ import OrdinaryDiffEqCore: ODEIntegrator, StochasticDiffEqJumpDiffusionAlgorithm, StochasticDiffEqJumpDiffusionAdaptiveAlgorithm, StochasticDiffEqJumpNewtonDiffusionAdaptiveAlgorithm, StochasticDiffEqCache, StochasticDiffEqConstantCache, StochasticDiffEqMutableCache, - default_controller, PredictiveController, - beta2_default, beta1_default, gamma_default, + beta2_default, beta1_default, qmin_default, qmax_default, qsteady_min_default, - qsteady_max_default, - stepsize_controller!, accept_step_controller, - step_accept_controller!, - step_reject_controller!, PIController, DummyController, issplit - -# Import shared loop functions from OrdinaryDiffEqCore. -import OrdinaryDiffEqCore: handle_callbacks!, handle_tstop!, - solution_endpoint_match_cur_integrator!, - _savevalues!, _postamble!, - is_composite_cache, is_composite_algorithm, final_progress, - loopheader!, loopfooter!, _loopfooter!, _step!, perform_step!, - isaposteriori, - increment_accept!, increment_reject!, - calc_dt_propose!, fix_dt_at_bounds!, modify_dt_for_tstops!, - log_step!, choose_algorithm!, update_uprev!, - alg_extrapolates, isfsal, - accept_noise!, reject_noise!, save_noise!, noise_curt, is_noise_saveable, - reinit_noise!, _determine_initdt, is_constant_cache, - handle_callback_modifiers!, - initialize_callbacks!, - current_extrapolant, current_extrapolant! - -using RecursiveArrayTools -using DiffEqNoiseProcess, Random, ArrayInterface -using SimpleNonlinearSolve, ForwardDiff, StaticArrays, MuladdMacro, FiniteDiff, Base.Threads -using Adapt + qsteady_max_default, issplit, + is_composite_algorithm, perform_step!, handle_callback_modifiers! + +using RecursiveArrayTools: RecursiveArrayTools, ArrayPartition, + recursive_bottom_eltype, recursive_unitless_bottom_eltype, + recursive_unitless_eltype, recursivecopy +using DiffEqNoiseProcess: DiffEqNoiseProcess, CompoundPoissonProcess, + CompoundPoissonProcess!, NoiseProcess, NoiseTransport, RSWM, + WienerProcess, WienerProcess! +using ArrayInterface: ArrayInterface +using SimpleNonlinearSolve: SimpleNonlinearSolve, SimpleTrustRegion +using ForwardDiff: ForwardDiff +using StaticArrays: StaticArrays, SArray +using MuladdMacro: MuladdMacro, @muladd +using FiniteDiff: FiniteDiff +using Adapt: Adapt, adapt import DiffEqBase: ODE_DEFAULT_NORM, ODE_DEFAULT_ISOUTOFDOMAIN, ODE_DEFAULT_PROG_MESSAGE, ODE_DEFAULT_UNSTABLE_CHECK using SciMLOperators: MatrixOperator, WOperator -using DiffEqBase: TimeGradientWrapper, UJacobianWrapper, TimeDerivativeWrapper, - UDerivativeWrapper +using Logging: Logging +using SparseArrays: SparseArrays, issparse -import RecursiveArrayTools: chain +# DEVerbosity is owned (and made public) by DiffEqBase but also re-exported +# through OrdinaryDiffEqCore; import it from the owner. +using DiffEqBase: DEVerbosity -using Logging, SparseArrays - -using SciMLLogging: AbstractVerbositySpecifier, AbstractVerbosityPreset, - None, Minimal, Standard, Detailed, All, - Silent, DebugLevel, InfoLevel, WarnLevel, ErrorLevel, @SciMLMessage - -using OrdinaryDiffEqCore: DEVerbosity - -using LinearAlgebra, Random +using LinearAlgebra: LinearAlgebra, I, mul! +using Random: Random import ForwardDiff.Dual import FastPower -import DiffEqBase: step!, initialize!, AbstractDEAlgorithm, - AbstractSDEAlgorithm, AbstractRODEAlgorithm, DEIntegrator, - DECache, AbstractSDEIntegrator, AbstractRODEIntegrator, - AbstractContinuousCallback, - Tableau, AbstractSDDEIntegrator +import DiffEqBase: step!, initialize! # Integrator Interface -import DiffEqBase: resize!, deleteat!, addat!, full_cache, user_cache, u_cache, du_cache, +import DiffEqBase: addat!, full_cache, user_cache, u_cache, du_cache, rand_cache, ratenoise_cache, resize_non_user_cache!, deleteat_non_user_cache!, addat_non_user_cache!, terminate!, get_du, get_dt, get_proposed_dt, set_proposed_dt!, savevalues!, add_tstop!, add_saveat!, set_reltol!, - set_abstol!, postamble!, last_step_failed, has_Wfact, has_jac, - get_tstops, get_tstops_array, get_tstops_max - -using DiffEqBase: check_error!, is_diagonal_noise, @.. - -using OrdinaryDiffEqCore: set_new_W!, get_W, _vec, _reshape - -if isdefined(OrdinaryDiffEqCore, :FastConvergence) - using OrdinaryDiffEqCore: - FastConvergence, Convergence, SlowConvergence, - VerySlowConvergence, Divergence + set_abstol! - import OrdinaryDiffEqCore: - calculate_residuals, calculate_residuals!, nlsolve_f, - unwrap_cache, islinear -else - using DiffEqBase: - FastConvergence, Convergence, SlowConvergence, VerySlowConvergence, - Divergence - - import DiffEqBase: - calculate_residuals, calculate_residuals!, nlsolve_f, unwrap_cache, - islinear -end +using DiffEqBase: @.. import SciMLBase -import SciMLBase: isadaptive, alg_order - -using StochasticDiffEqLevyArea +# AbstractDEAlgorithm/AbstractSDDEIntegrator supertypes are owned and exported +# by SciMLBase; is_diagonal_noise is public SciMLBase API. +import SciMLBase: isadaptive, alg_order, AbstractDEAlgorithm, + AbstractSDDEIntegrator, is_diagonal_noise +using SciMLBase: CallbackSet, DiscreteProblem, DynamicalSDEFunction, + NonlinearFunction, NonlinearProblem, ODEAliasSpecifier, SDEProblem, + get_tmp_cache, isinplace, reinit! +using CommonSolve: init, solve, solve! +using SciMLOperators: SciMLOperators +using DiffEqBase: DiffEqBase + +using StochasticDiffEqLevyArea: StochasticDiffEqLevyArea, MaxL2, terms_needed const CompiledFloats = Union{Float32, Float64} @@ -193,4 +165,13 @@ export TauLeapingDrift # General functions export solve, init, solve!, step! +# `@cache` is the cache-definition extension macro that downstream StochasticDiffEq +# solver subpackages import to define their `alg_cache` structs plus the associated +# `full_cache`/`rand_cache`/`ratenoise_cache` accessors (mirrors the public `@cache` +# in OrdinaryDiffEqCore). It is made public (not exported) so ExplicitImports' +# public-API checks recognize it as the supported solver-author surface. +@static if VERSION >= v"1.11.0-DEV.469" + eval(Expr(:public, Symbol("@cache"))) +end + end # module diff --git a/lib/StochasticDiffEqCore/src/alg_utils.jl b/lib/StochasticDiffEqCore/src/alg_utils.jl index bc81f9defbb..e0d9b9164a2 100644 --- a/lib/StochasticDiffEqCore/src/alg_utils.jl +++ b/lib/StochasticDiffEqCore/src/alg_utils.jl @@ -198,7 +198,7 @@ end alg_compatible(prob, alg::StochasticDiffEqAlgorithm) = false function alg_compatible( - prob::DiffEqBase.AbstractSDEProblem, + prob::SciMLBase.AbstractSDEProblem, alg::Union{ StochasticDiffEqCompositeAlgorithm, StochasticDiffEqRODECompositeAlgorithm, } @@ -214,7 +214,7 @@ supports_regular_jumps(alg) = false function alg_compatible(prob::JumpProblem, alg::StochasticDiffEqAlgorithm) return alg_compatible(prob.prob, alg) && (supports_regular_jumps(alg) || prob.regular_jump === nothing) && - prob.prob isa DiffEqBase.AbstractSDEProblem + prob.prob isa SciMLBase.AbstractSDEProblem end function alg_compatible( diff --git a/lib/StochasticDiffEqCore/src/initialize_dae.jl b/lib/StochasticDiffEqCore/src/initialize_dae.jl index a0c443d7be7..eaf749f64ec 100644 --- a/lib/StochasticDiffEqCore/src/initialize_dae.jl +++ b/lib/StochasticDiffEqCore/src/initialize_dae.jl @@ -3,7 +3,7 @@ function OrdinaryDiffEqCore._initialize_dae!( integrator::Union{SDEIntegrator, AbstractSDDEIntegrator}, prob::Union{SciMLBase.AbstractRODEProblem, SciMLBase.AbstractSDDEProblem}, - ::OrdinaryDiffEqCore.DefaultInit, isinplace + ::DiffEqBase.DefaultInit, isinplace ) return if SciMLBase.has_initializeprob(prob.f) OrdinaryDiffEqCore._initialize_dae!(integrator, prob, SciMLBase.OverrideInit(), isinplace) diff --git a/lib/StochasticDiffEqCore/src/integrators/integrator_utils.jl b/lib/StochasticDiffEqCore/src/integrators/integrator_utils.jl index c88ab987e1c..a8ab18409e0 100644 --- a/lib/StochasticDiffEqCore/src/integrators/integrator_utils.jl +++ b/lib/StochasticDiffEqCore/src/integrators/integrator_utils.jl @@ -64,22 +64,22 @@ OrdinaryDiffEqCore.is_composite_cache(cache::StochasticCompositeCache) = true # is_noise_saveable interface that ODE's unified loop functions call. # ============================================================================ -function OrdinaryDiffEqCore.accept_noise!(W::DiffEqNoiseProcess.AbstractNoiseProcess, dt, u, p, setup) +function OrdinaryDiffEqCore.accept_noise!(W::SciMLBase.AbstractNoiseProcess, dt, u, p, setup) return DiffEqNoiseProcess.accept_step!(W, dt, u, p, setup) end -function OrdinaryDiffEqCore.reject_noise!(W::DiffEqNoiseProcess.AbstractNoiseProcess, dt, u, p) +function OrdinaryDiffEqCore.reject_noise!(W::SciMLBase.AbstractNoiseProcess, dt, u, p) return DiffEqNoiseProcess.reject_step!(W, dt, u, p) end -function OrdinaryDiffEqCore.save_noise!(W::DiffEqNoiseProcess.AbstractNoiseProcess) +function OrdinaryDiffEqCore.save_noise!(W::SciMLBase.AbstractNoiseProcess) return DiffEqNoiseProcess.save_noise!(W) end -OrdinaryDiffEqCore.noise_curt(W::DiffEqNoiseProcess.AbstractNoiseProcess) = W.curt +OrdinaryDiffEqCore.noise_curt(W::SciMLBase.AbstractNoiseProcess) = W.curt OrdinaryDiffEqCore.is_noise_saveable(W::NoiseProcess) = true -OrdinaryDiffEqCore.is_noise_saveable(W::DiffEqNoiseProcess.AbstractNoiseProcess) = false +OrdinaryDiffEqCore.is_noise_saveable(W::SciMLBase.AbstractNoiseProcess) = false # ============================================================================ # is_constant_cache for SDE cache types (needed by ODE's change_t_via_interpolation!) @@ -106,8 +106,8 @@ OrdinaryDiffEqCore.get_fsalfirstlast(::StochasticDiffEqMutableCache, u) = # reinit_noise!: reinitialize noise process (called from ODE's reinit!) # ============================================================================ -function OrdinaryDiffEqCore.reinit_noise!(W::DiffEqNoiseProcess.AbstractNoiseProcess, dt) - return DiffEqNoiseProcess.reinit!(W, dt) +function OrdinaryDiffEqCore.reinit_noise!(W::SciMLBase.AbstractNoiseProcess, dt) + return SciMLBase.reinit!(W, dt) end # _determine_initdt: SDE extension (called from ODE's auto_dt_reset!) diff --git a/lib/StochasticDiffEqCore/src/solve.jl b/lib/StochasticDiffEqCore/src/solve.jl index 1505e44ef52..018a3f66084 100644 --- a/lib/StochasticDiffEqCore/src/solve.jl +++ b/lib/StochasticDiffEqCore/src/solve.jl @@ -8,14 +8,14 @@ function _get_alias_noise_from_kwargs(; alias_noise = nothing, alias = nothing, end end -function DiffEqBase.__solve( - prob::DiffEqBase.AbstractRODEProblem, +function SciMLBase.__solve( + prob::SciMLBase.AbstractRODEProblem, alg::Union{StochasticDiffEqAlgorithm, StochasticDiffEqRODEAlgorithm}; kwargs... ) - integrator = DiffEqBase.__init(prob, alg; kwargs...) + integrator = SciMLBase.__init(prob, alg; kwargs...) solve!(integrator) - if prob isa DiffEqBase.AbstractRODEProblem && + if prob isa SciMLBase.AbstractRODEProblem && typeof(prob.noise) == typeof(integrator.sol.W) && _get_alias_noise_from_kwargs(; kwargs...) copy!(prob.noise, integrator.sol.W) @@ -24,15 +24,15 @@ function DiffEqBase.__solve( end # More specific method for JumpProblem to win over JumpProcesses.jl's ambiguity fix dispatch -function DiffEqBase.__solve( +function SciMLBase.__solve( prob::JumpProblem, alg::Union{StochasticDiffEqAlgorithm, StochasticDiffEqRODEAlgorithm}; merge_callbacks = true, kwargs... ) kwargs = DiffEqBase.merge_problem_kwargs(prob; merge_callbacks, kwargs...) - integrator = DiffEqBase.__init(prob, alg; kwargs...) + integrator = SciMLBase.__init(prob, alg; kwargs...) solve!(integrator) - if concrete_prob(prob) isa DiffEqBase.AbstractRODEProblem && + if concrete_prob(prob) isa SciMLBase.AbstractRODEProblem && typeof(concrete_prob(prob).noise) == typeof(integrator.sol.W) && _get_alias_noise_from_kwargs(; kwargs...) copy!(concrete_prob(prob).noise, integrator.sol.W) @@ -67,7 +67,7 @@ function _resolve_rng(rng, seed, prob) # `remake(prob, seed=s)` inside an ensemble is actually reproducible. if !iszero(seed) return Random.Xoshiro(seed), seed, false - elseif prob isa DiffEqBase.AbstractRODEProblem && !iszero(prob.seed) + elseif prob isa SciMLBase.AbstractRODEProblem && !iszero(prob.seed) return Random.Xoshiro(prob.seed), prob.seed, false end _seed = rand(rng, UInt64) @@ -76,7 +76,7 @@ function _resolve_rng(rng, seed, prob) return rng, UInt64(0), true end _seed = if iszero(seed) - if (!(prob isa DiffEqBase.AbstractRODEProblem) || iszero(prob.seed)) + if (!(prob isa SciMLBase.AbstractRODEProblem) || iszero(prob.seed)) seed_multiplier() * rand(UInt64) else prob.seed @@ -99,8 +99,8 @@ function _z_prototype(alg, rand_prototype, iip::Bool) return rand_prototype end -function DiffEqBase.__init( - _prob::Union{DiffEqBase.AbstractRODEProblem, JumpProblem}, +function SciMLBase.__init( + _prob::Union{SciMLBase.AbstractRODEProblem, JumpProblem}, alg::Union{StochasticDiffEqAlgorithm, StochasticDiffEqRODEAlgorithm}; kwargs... ) @@ -108,7 +108,7 @@ function DiffEqBase.__init( end function _sde_init( - _prob::Union{DiffEqBase.AbstractRODEProblem, JumpProblem}, + _prob::Union{SciMLBase.AbstractRODEProblem, JumpProblem}, alg::Union{StochasticDiffEqAlgorithm, StochasticDiffEqRODEAlgorithm}; saveat = (), tstops = (), @@ -117,8 +117,8 @@ function _sde_init( save_everystep = isempty(saveat), save_noise = save_everystep && ( typeof(concrete_prob(_prob).f) <: Tuple ? - DiffEqBase.has_analytic(concrete_prob(_prob).f[1]) : - DiffEqBase.has_analytic(concrete_prob(_prob).f) + SciMLBase.has_analytic(concrete_prob(_prob).f[1]) : + SciMLBase.has_analytic(concrete_prob(_prob).f) ), save_on = true, save_start = save_everystep || isempty(saveat) || saveat isa Number ? true : @@ -162,7 +162,7 @@ function _sde_init( seed = UInt64(0), rng = nothing, alias = nothing, - initializealg = OrdinaryDiffEqCore.DefaultInit(), + initializealg = DiffEqBase.DefaultInit(), kwargs... ) # NOTE: JumpProblem kwargs merge is already done by init_call / __solve @@ -206,12 +206,12 @@ function _sde_init( if any(mm != I for mm in prob.f.mass_matrix) error("This solver is not able to use mass matrices.") end - elseif prob isa DiffEqBase.AbstractRODEProblem && prob.f.mass_matrix != I && + elseif prob isa SciMLBase.AbstractRODEProblem && prob.f.mass_matrix != I && !alg_mass_matrix_compatible(alg) error("This solver is not able to use mass matrices.") end - if prob isa DiffEqBase.AbstractRODEProblem && typeof(prob.noise) <: NoiseProcess && + if prob isa SciMLBase.AbstractRODEProblem && typeof(prob.noise) <: NoiseProcess && prob.noise.bridge === nothing && adaptive error("Bridge function must be given for adaptivity. Either declare this function in noise process or set adaptive=false") end @@ -275,7 +275,7 @@ function _sde_init( uBottomEltypeNoUnits = recursive_unitless_bottom_eltype(u) uEltypeNoUnits = recursive_unitless_eltype(u) tTypeNoUnits = typeof(one(tType)) - noise = prob isa DiffEqBase.AbstractRODEProblem ? prob.noise : nothing + noise = prob isa SciMLBase.AbstractRODEProblem ? prob.noise : nothing tspan = prob.tspan t = tspan[1] @@ -326,8 +326,8 @@ function _sde_init( noise_rate_prototype = rate_prototype.x[1] elseif is_diagonal_noise(prob) noise_rate_prototype = rate_prototype - elseif prob isa DiffEqBase.AbstractRODEProblem - if prob isa DiffEqBase.AbstractSDEProblem + elseif prob isa SciMLBase.AbstractRODEProblem + if prob isa SciMLBase.AbstractSDEProblem noise_rate_prototype = copy(prob.noise_rate_prototype) else noise_rate_prototype = copy(prob.rand_prototype) @@ -352,15 +352,15 @@ function _sde_init( else rand_prototype = (u .- u) ./ sqrt(oneunit(t)) end - elseif prob isa DiffEqBase.AbstractSDEProblem + elseif prob isa SciMLBase.AbstractSDEProblem if issparse(u) rand_prototype = adapt( - DiffEqBase.parameterless_type(u), zeros(randElType, size(noise_rate_prototype, 2)) + SciMLBase.parameterless_type(u), zeros(randElType, size(noise_rate_prototype, 2)) ) else rand_prototype = false .* noise_rate_prototype[1, :] end - elseif prob isa DiffEqBase.AbstractRODEProblem + elseif prob isa SciMLBase.AbstractRODEProblem rand_prototype = copy(prob.rand_prototype) else rand_prototype = nothing @@ -372,7 +372,7 @@ function _sde_init( CallbackSet(callback, _prob.jump_callback) : callback # ── Noise creation (WienerProcess / user noise handling) ───────────── - if prob isa DiffEqBase.AbstractRODEProblem && prob.noise === nothing + if prob isa SciMLBase.AbstractRODEProblem && prob.noise === nothing rswm = isadaptive(alg) ? RSWM(adaptivealg = :RSwM3) : RSWM(adaptivealg = :RSwM1) if isinplace(prob) if alg_needs_extra_process(alg) @@ -405,7 +405,7 @@ function _sde_init( ) end end - elseif prob isa DiffEqBase.AbstractRODEProblem + elseif prob isa SciMLBase.AbstractRODEProblem _alias_noise = if hasproperty(aliases, :alias_noise) && aliases.alias_noise !== nothing aliases.alias_noise else diff --git a/lib/StochasticDiffEqCore/test/qa/Project.toml b/lib/StochasticDiffEqCore/test/qa/Project.toml index 8952219ac2d..042d1a96741 100644 --- a/lib/StochasticDiffEqCore/test/qa/Project.toml +++ b/lib/StochasticDiffEqCore/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqLevyArea = "90dbc90e-856a-4131-af2c-e8c5aa0f35b5" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -24,6 +25,7 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqLevyArea = "2" Test = "1" diff --git a/lib/StochasticDiffEqCore/test/qa/qa.jl b/lib/StochasticDiffEqCore/test/qa/qa.jl index 27a4e9c7d28..f4e6e2f60c4 100644 --- a/lib/StochasticDiffEqCore/test/qa/qa.jl +++ b/lib/StochasticDiffEqCore/test/qa/qa.jl @@ -1,12 +1,57 @@ -using StochasticDiffEqCore -using Aqua +using SciMLTesting, StochasticDiffEqCore, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqCore) -end +# StochasticDiffEqCore extends OrdinaryDiffEqCore's solver loop and dispatches on +# a handful of still-internal SciMLBase/DiffEqBase interface names. The base +# packages (OrdinaryDiffEqCore/DiffEqBase) now declare their solver-author API +# public, so every name that became public was dropped from the ignore lists +# below. Each remaining ignore is a genuinely non-public (or non-owner) name +# from an upstream package, documented with its source. See +# SciML/OrdinaryDiffEq.jl#3776. -@testset "JET" begin - JET.test_package(StochasticDiffEqCore; target_defined_modules = true) -end +# OrdinaryDiffEqCore names this package dispatches on/extends that were kept +# owner-internal (loop/trait/autodiff/noise helpers not in the public +# solver-author surface). These need make-public upstream before they can drop. +const ODEC_INTERNAL = ( + :_determine_initdt, :_get_fdtype, :_get_fwd_chunksize, :_get_fwd_chunksize_int, + :_initialize_dae!, :_ode_init, :accept_noise!, :concrete_jac, :get_chunksize, + :handle_callback_modifiers!, :has_autodiff, :is_noise_saveable, :noise_curt, + :ode_determine_initdt, :qsteady_max_default, :qsteady_min_default, + :reinit_noise!, :reject_noise!, :save_noise!, :standardtag, +) + +# Still-internal SciMLBase interface names (pending SciMLBase#1412 round-5 +# make-public; not yet public on the registered SciMLBase this branch resolves). +const SCIMLBASE_INTERNAL = ( + :__has_mass_matrix, :_unwrap_val, :has_initializeprob, :parameterless_type, +) + +# `@..` is owned by FastBroadcast and reaches StochasticDiffEqCore through +# DiffEqBase's re-export (the standard SciML access path); it is non-public in +# DiffEqBase, so it is ignored for the are-public check as well as via-owners. +const DIFFEQBASE_INTERNAL = (Symbol("@.."),) + +# Non-public names from other upstream packages. +const JUMPPROCESSES_INTERNAL = (:reset_jump_problem!, :resetted_jump_problem) +const DIFFEQNOISEPROCESS_INTERNAL = (:resize_stack!,) +const FORWARDDIFF_INTERNAL = (:Tag, :pickchunksize) +const BASE_INTERNAL = (Symbol("@pure"),) + +const NONPUBLIC_IGNORE = ( + ODEC_INTERNAL..., SCIMLBASE_INTERNAL..., DIFFEQBASE_INTERNAL..., + JUMPPROCESSES_INTERNAL..., DIFFEQNOISEPROCESS_INTERNAL..., + FORWARDDIFF_INTERNAL..., BASE_INTERNAL..., +) + +run_qa( + StochasticDiffEqCore; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_kwargs = (; + # `@..` reaches StochasticDiffEqCore via DiffEqBase's re-export of + # FastBroadcast; FastBroadcast is not a direct dependency. + all_explicit_imports_via_owners = (; ignore = (Symbol("@.."),)), + all_qualified_accesses_are_public = (; ignore = NONPUBLIC_IGNORE), + all_explicit_imports_are_public = (; ignore = NONPUBLIC_IGNORE), + ), +) diff --git a/lib/StochasticDiffEqHighOrder/src/StochasticDiffEqHighOrder.jl b/lib/StochasticDiffEqHighOrder/src/StochasticDiffEqHighOrder.jl index 9629d0c37a0..196bb90950e 100644 --- a/lib/StochasticDiffEqHighOrder/src/StochasticDiffEqHighOrder.jl +++ b/lib/StochasticDiffEqHighOrder/src/StochasticDiffEqHighOrder.jl @@ -1,10 +1,13 @@ module StochasticDiffEqHighOrder -using Reexport +using Reexport: Reexport, @reexport +import StochasticDiffEqCore @reexport using StochasticDiffEqCore import OrdinaryDiffEqCore -import OrdinaryDiffEqCore: perform_step!, initialize! +import OrdinaryDiffEqCore: perform_step! + +import DiffEqBase import StochasticDiffEqCore: alg_cache, alg_order, alg_compatible, alg_needs_extra_process, alg_stability_size, delta_default, @@ -16,7 +19,7 @@ import StochasticDiffEqCore: alg_cache, alg_order, alg_compatible, calc_twopoint_random!, calc_twopoint_random, @cache -import DiffEqBase: is_diagonal_noise, @.. +import DiffEqBase: @.. import DiffEqBase: calculate_residuals, calculate_residuals! import DiffEqBase: full_cache, rand_cache, ratenoise_cache import DiffEqBase: Tableau @@ -24,10 +27,11 @@ import DiffEqBase: Tableau import MuladdMacro: @muladd import SciMLBase +import SciMLBase: is_diagonal_noise -using LinearAlgebra -using StaticArrays -using RecursiveArrayTools +using LinearAlgebra: LinearAlgebra, dot, mul! +using StaticArrays: StaticArrays, SArray +import RecursiveArrayTools include("tableaus.jl") include("algorithms.jl") diff --git a/lib/StochasticDiffEqHighOrder/src/alg_utils.jl b/lib/StochasticDiffEqHighOrder/src/alg_utils.jl index 5ea9d071883..c5e3ada1790 100644 --- a/lib/StochasticDiffEqHighOrder/src/alg_utils.jl +++ b/lib/StochasticDiffEqHighOrder/src/alg_utils.jl @@ -15,17 +15,17 @@ alg_order(alg::SOSRA2) = 2 // 1 delta_default(alg::SRIW1) = 1 // 6 ## alg_compatible -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SRI) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SRIW1) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SRIW2) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SOSRI) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SOSRI2) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SRA) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SRA1) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SRA2) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SRA3) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SOSRA) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SOSRA2) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SRI) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SRIW1) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SRIW2) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SOSRI) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SOSRI2) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SRA) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SRA1) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SRA2) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SRA3) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SOSRA) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SOSRA2) = true ## alg_needs_extra_process alg_needs_extra_process(alg::SRI) = true diff --git a/lib/StochasticDiffEqHighOrder/test/qa/Project.toml b/lib/StochasticDiffEqHighOrder/test/qa/Project.toml index 35dae9c83a3..2e83c8192b9 100644 --- a/lib/StochasticDiffEqHighOrder/test/qa/Project.toml +++ b/lib/StochasticDiffEqHighOrder/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqHighOrder = "0520c28c-50fd-4d16-9c96-902fc80b3bab" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -24,6 +25,7 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqHighOrder = "2" Test = "1" diff --git a/lib/StochasticDiffEqHighOrder/test/qa/qa.jl b/lib/StochasticDiffEqHighOrder/test/qa/qa.jl index 27332e2dd44..aa0ebe1af81 100644 --- a/lib/StochasticDiffEqHighOrder/test/qa/qa.jl +++ b/lib/StochasticDiffEqHighOrder/test/qa/qa.jl @@ -1,12 +1,17 @@ -using StochasticDiffEqHighOrder -using Aqua +using SciMLTesting, StochasticDiffEqHighOrder, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqHighOrder) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqHighOrder; target_defined_modules = true) -end +run_qa( + StochasticDiffEqHighOrder; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_kwargs = ( + # `@..` is owned by FastBroadcast but reexported through DiffEqBase, and + # FastBroadcast is not a direct dependency of this sublibrary, so the + # broadcast macro can only be reached via the DiffEqBase reexport. + all_explicit_imports_via_owners = (; ignore = (Symbol("@.."),)), + # `@..`: external FastBroadcast macro reexported through DiffEqBase, where + # it is not public. + all_explicit_imports_are_public = (; ignore = (Symbol("@.."),)), + ), +) diff --git a/lib/StochasticDiffEqIIF/Project.toml b/lib/StochasticDiffEqIIF/Project.toml index 006818fe25b..8f6a8aeb0c5 100644 --- a/lib/StochasticDiffEqIIF/Project.toml +++ b/lib/StochasticDiffEqIIF/Project.toml @@ -1,14 +1,14 @@ name = "StochasticDiffEqIIF" uuid = "ebf54054-c36b-4494-9aba-657e36df524f" authors = ["Chris Rackauckas "] -version = "2.0.1" +version = "2.0.2" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" @@ -23,13 +23,13 @@ DiffEqBase = {path = "../DiffEqBase"} [compat] DiffEqBase = "7" +FastBroadcast = "1.3" LinearAlgebra = "1.10" MuladdMacro = "0.2.4" OrdinaryDiffEqCore = "4" Pkg = "1" -RecursiveArrayTools = "4.2.0" Reexport = "1.2.2" -SciMLBase = "3.10.0" +SciMLBase = "3.30" StochasticDiffEqCore = "2" Test = "<0.0.1, 1" SafeTestsets = "0.1.0" diff --git a/lib/StochasticDiffEqIIF/src/StochasticDiffEqIIF.jl b/lib/StochasticDiffEqIIF/src/StochasticDiffEqIIF.jl index 96ed3d6684f..1aa7a833eaf 100644 --- a/lib/StochasticDiffEqIIF/src/StochasticDiffEqIIF.jl +++ b/lib/StochasticDiffEqIIF/src/StochasticDiffEqIIF.jl @@ -1,10 +1,15 @@ module StochasticDiffEqIIF -using Reexport +using Reexport: Reexport, @reexport @reexport using StochasticDiffEqCore +using StochasticDiffEqCore: StochasticDiffEqCore import OrdinaryDiffEqCore -import OrdinaryDiffEqCore: perform_step!, initialize!, issplit, +# `perform_step!`, `issplit`, `current_extrapolant`, `current_extrapolant!` are part +# of OrdinaryDiffEqCore's solver-author interface but are not (yet) declared `public`, +# so they are tightly ignored in the QA explicit-imports checks. (`initialize!` is +# owned by DiffEqBase and imported from its public owner there.) +import OrdinaryDiffEqCore: perform_step!, issplit, current_extrapolant, current_extrapolant! import StochasticDiffEqCore: alg_cache, alg_order, alg_compatible, @@ -15,14 +20,15 @@ import StochasticDiffEqCore: alg_cache, alg_order, alg_compatible, determine_chunksize, unwrap_alg, @cache -import DiffEqBase: is_diagonal_noise, @.. -import DiffEqBase: full_cache, rand_cache, ratenoise_cache +import DiffEqBase +import DiffEqBase: initialize!, full_cache, rand_cache, ratenoise_cache +import SciMLBase: is_diagonal_noise +import FastBroadcast: @.. import MuladdMacro: @muladd import SciMLBase -using LinearAlgebra -using RecursiveArrayTools +using LinearAlgebra: mul!, rmul! include("algorithms.jl") include("alg_utils.jl") diff --git a/lib/StochasticDiffEqIIF/src/alg_utils.jl b/lib/StochasticDiffEqIIF/src/alg_utils.jl index b8f5c99f368..031ba6a70c7 100644 --- a/lib/StochasticDiffEqIIF/src/alg_utils.jl +++ b/lib/StochasticDiffEqIIF/src/alg_utils.jl @@ -2,6 +2,6 @@ alg_order(alg::IIF1M) = 1 // 2 alg_order(alg::IIF2M) = 1 // 2 alg_order(alg::IIF1Mil) = 1 // 1 -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::IIF1M) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::IIF2M) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::IIF1Mil) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::IIF1M) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::IIF2M) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::IIF1Mil) = true diff --git a/lib/StochasticDiffEqIIF/test/qa/Project.toml b/lib/StochasticDiffEqIIF/test/qa/Project.toml index 2e9395c433a..5e10734a81b 100644 --- a/lib/StochasticDiffEqIIF/test/qa/Project.toml +++ b/lib/StochasticDiffEqIIF/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqIIF = "ebf54054-c36b-4494-9aba-657e36df524f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -24,6 +25,7 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqIIF = "2" Test = "1" diff --git a/lib/StochasticDiffEqIIF/test/qa/qa.jl b/lib/StochasticDiffEqIIF/test/qa/qa.jl index aea967cf763..c8c13853ba2 100644 --- a/lib/StochasticDiffEqIIF/test/qa/qa.jl +++ b/lib/StochasticDiffEqIIF/test/qa/qa.jl @@ -1,12 +1,8 @@ -using StochasticDiffEqIIF -using Aqua +using SciMLTesting, StochasticDiffEqIIF, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqIIF) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqIIF; target_defined_modules = true) -end +run_qa( + StochasticDiffEqIIF; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, +) diff --git a/lib/StochasticDiffEqImplicit/src/StochasticDiffEqImplicit.jl b/lib/StochasticDiffEqImplicit/src/StochasticDiffEqImplicit.jl index 6ffe128638f..c24b5a9638a 100644 --- a/lib/StochasticDiffEqImplicit/src/StochasticDiffEqImplicit.jl +++ b/lib/StochasticDiffEqImplicit/src/StochasticDiffEqImplicit.jl @@ -1,10 +1,12 @@ module StochasticDiffEqImplicit -using Reexport +using Reexport: Reexport, @reexport @reexport using StochasticDiffEqCore +import StochasticDiffEqCore +import DiffEqBase import OrdinaryDiffEqCore -import OrdinaryDiffEqCore: perform_step!, initialize!, issplit, default_controller, PIController +import OrdinaryDiffEqCore: perform_step!, issplit, default_controller, PIController import StochasticDiffEqCore: alg_cache, alg_order, alg_compatible, alg_needs_extra_process, is_split_step, supports_regular_jumps, isadaptive, @@ -15,25 +17,27 @@ import StochasticDiffEqCore: alg_cache, alg_order, alg_compatible, unwrap_alg, @cache -import DiffEqBase: is_diagonal_noise, @.., SplitSDEFunction +import DiffEqBase: @.., SplitSDEFunction, initialize! import DiffEqBase: calculate_residuals, calculate_residuals! -import DiffEqBase: full_cache, rand_cache, ratenoise_cache, has_Wfact +import DiffEqBase: full_cache, rand_cache, ratenoise_cache import MuladdMacro: @muladd import SciMLBase +import SciMLBase: is_diagonal_noise, has_Wfact, _vec, _reshape, _unwrap_val -using OrdinaryDiffEqCore: _vec, _reshape, current_extrapolant, current_extrapolant!, +using OrdinaryDiffEqCore: current_extrapolant!, isnewton, set_new_W!, get_W -using OrdinaryDiffEqNonlinearSolve: NLSolver, nlsolvefail, nlsolve!, build_nlsolver, +using OrdinaryDiffEqNonlinearSolve: nlsolvefail, nlsolve!, build_nlsolver, markfirststage!, NLNewton import OrdinaryDiffEqDifferentiation -using OrdinaryDiffEqDifferentiation: calc_J, calc_J!, dolinsolve, get_W +using OrdinaryDiffEqDifferentiation: calc_J, calc_J!, dolinsolve using JumpProcesses: JumpProblem -using LinearAlgebra -using StaticArrays -using RecursiveArrayTools -using ForwardDiff, FiniteDiff +using LinearAlgebra: LinearAlgebra, mul!, norm +using StaticArrays: StaticArrays, SArray +using RecursiveArrayTools: RecursiveArrayTools +using ForwardDiff: ForwardDiff +using FiniteDiff: FiniteDiff import ADTypes include("tableaus.jl") diff --git a/lib/StochasticDiffEqImplicit/src/alg_utils.jl b/lib/StochasticDiffEqImplicit/src/alg_utils.jl index 7e5f37d42db..13e4f668b20 100644 --- a/lib/StochasticDiffEqImplicit/src/alg_utils.jl +++ b/lib/StochasticDiffEqImplicit/src/alg_utils.jl @@ -14,12 +14,12 @@ default_controller(QT, alg::SKenCarp) = PIController(QT, alg) supports_regular_jumps(::ImplicitEM) = true isadaptive(prob::JumpProblem, alg::ImplicitEM) = false -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::ImplicitEM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::ImplicitEulerHeun) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::ISSEM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::ISSEulerHeun) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SKenCarp) = true -function alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::ImplicitRKMil) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::ImplicitEM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::ImplicitEulerHeun) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::ISSEM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::ISSEulerHeun) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SKenCarp) = true +function alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::ImplicitRKMil) return is_diagonal_noise(prob) end diff --git a/lib/StochasticDiffEqImplicit/src/algorithms.jl b/lib/StochasticDiffEqImplicit/src/algorithms.jl index 0b98d2b8af3..3851565367c 100644 --- a/lib/StochasticDiffEqImplicit/src/algorithms.jl +++ b/lib/StochasticDiffEqImplicit/src/algorithms.jl @@ -1,5 +1,5 @@ using ADTypes: AutoForwardDiff -using OrdinaryDiffEqCore: _fixup_ad, _unwrap_val +using OrdinaryDiffEqCore: _fixup_ad struct ImplicitEM{AD, F, F2, T2, T3, CJ} <: StochasticDiffEqNewtonAdaptiveAlgorithm diff --git a/lib/StochasticDiffEqImplicit/src/perform_step/kencarp.jl b/lib/StochasticDiffEqImplicit/src/perform_step/kencarp.jl index ce7e38f4bc3..9c092c6d3cf 100644 --- a/lib/StochasticDiffEqImplicit/src/perform_step/kencarp.jl +++ b/lib/StochasticDiffEqImplicit/src/perform_step/kencarp.jl @@ -124,8 +124,8 @@ tmp = btilde1 * z₁ + btilde2 * z₂ + btilde3 * z₃ + btilde4 * z₄ + chi2 * (g1 - g4) end if alg.smooth_est # From Shampine - E₁ = DiffEqBase._reshape( - get_W(nlsolver) \ DiffEqBase._vec(tmp), + E₁ = _reshape( + get_W(nlsolver) \ _vec(tmp), axes(tmp) ) else @@ -316,8 +316,8 @@ end if alg.smooth_est # From Shampine linres = dolinsolve( integrator, nlsolver.cache.linsolve; - b = DiffEqBase._vec(g1), - linu = DiffEqBase._vec(E₁) + b = _vec(g1), + linu = _vec(E₁) ) else E₁ .= dz diff --git a/lib/StochasticDiffEqImplicit/test/qa/Project.toml b/lib/StochasticDiffEqImplicit/test/qa/Project.toml index f23d469984a..af8623bca60 100644 --- a/lib/StochasticDiffEqImplicit/test/qa/Project.toml +++ b/lib/StochasticDiffEqImplicit/test/qa/Project.toml @@ -5,6 +5,7 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqImplicit = "5080b986-4c76-4669-b5dc-373a41579d5b" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -34,6 +35,7 @@ JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" OrdinaryDiffEqDifferentiation = "3" OrdinaryDiffEqNonlinearSolve = "2" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqImplicit = "2" Test = "1" diff --git a/lib/StochasticDiffEqImplicit/test/qa/qa.jl b/lib/StochasticDiffEqImplicit/test/qa/qa.jl index cc44170166e..6c3fb0c3cea 100644 --- a/lib/StochasticDiffEqImplicit/test/qa/qa.jl +++ b/lib/StochasticDiffEqImplicit/test/qa/qa.jl @@ -1,12 +1,24 @@ -using StochasticDiffEqImplicit -using Aqua +using SciMLTesting, StochasticDiffEqImplicit, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqImplicit) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqImplicit; target_defined_modules = true) -end +run_qa( + StochasticDiffEqImplicit; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_kwargs = (; + # `@..` is owned by FastBroadcast and re-exported through DiffEqBase; FastBroadcast + # is not a direct dependency, so it is imported from DiffEqBase by design. + all_explicit_imports_via_owners = (; ignore = (Symbol("@.."),)), + all_explicit_imports_are_public = (; + ignore = ( + # `@..` (FastBroadcast macro re-exported via DiffEqBase) is not `public` there. + Symbol("@.."), + # StochasticDiffEqCore internal codegen macro (owner-internal). + Symbol("@cache"), + # OrdinaryDiffEqCore internals with no public replacement yet. + :current_extrapolant!, :isnewton, :_fixup_ad, + # SciMLBase internals (not yet `public` on registered SciMLBase). + :has_Wfact, :_vec, :_reshape, :_unwrap_val, + )), + ), +) diff --git a/lib/StochasticDiffEqLeaping/src/StochasticDiffEqLeaping.jl b/lib/StochasticDiffEqLeaping/src/StochasticDiffEqLeaping.jl index fc766f9de94..cc5b9617cef 100644 --- a/lib/StochasticDiffEqLeaping/src/StochasticDiffEqLeaping.jl +++ b/lib/StochasticDiffEqLeaping/src/StochasticDiffEqLeaping.jl @@ -1,11 +1,12 @@ module StochasticDiffEqLeaping -using Reexport +using Reexport: Reexport, @reexport @reexport using StochasticDiffEqCore +using StochasticDiffEqCore: StochasticDiffEqCore import OrdinaryDiffEqCore -import OrdinaryDiffEqCore: perform_step!, initialize!, issplit, - stepsize_controller!, accept_step_controller, step_accept_controller!, +import OrdinaryDiffEqCore: perform_step!, issplit, + stepsize_controller!, step_accept_controller!, step_reject_controller!, DummyController import StochasticDiffEqCore: alg_cache, alg_order, alg_compatible, @@ -17,19 +18,16 @@ import StochasticDiffEqCore: alg_cache, alg_order, alg_compatible, TauLeapingDrift, @cache -import DiffEqBase: is_diagonal_noise, @.. +import DiffEqBase +# `@..` is the SciML fused-broadcast macro; its owner is FastBroadcast (not a +# direct dependency here), so it is re-exported through DiffEqBase. +import DiffEqBase: @.. import DiffEqBase: full_cache, rand_cache, ratenoise_cache import MuladdMacro: @muladd import SciMLBase -using OrdinaryDiffEqCore: _vec, _reshape -using OrdinaryDiffEqNonlinearSolve: NLSolver, NLFunctional, NLAnderson, NLNewton, - nlsolvefail, isnewton - -using LinearAlgebra -using StaticArrays -using RecursiveArrayTools +using OrdinaryDiffEqNonlinearSolve: NLFunctional import JumpProcesses diff --git a/lib/StochasticDiffEqLeaping/src/alg_utils.jl b/lib/StochasticDiffEqLeaping/src/alg_utils.jl index f48d74122fd..d0b47c89fdb 100644 --- a/lib/StochasticDiffEqLeaping/src/alg_utils.jl +++ b/lib/StochasticDiffEqLeaping/src/alg_utils.jl @@ -4,7 +4,7 @@ alg_order(alg::ImplicitTauLeaping) = 1 // 1 # Weak first order (backward Euler) alg_order(alg::ThetaTrapezoidalTauLeaping) = 2 // 1 # Weak second order # special cases in stepsize_controllers.jl -function StochasticDiffEqCore.default_controller( +function OrdinaryDiffEqCore.default_controller( alg::Union{TauLeaping, CaoTauLeaping, ThetaTrapezoidalTauLeaping}, args... ) return DummyController() diff --git a/lib/StochasticDiffEqLeaping/src/integrator_utils.jl b/lib/StochasticDiffEqLeaping/src/integrator_utils.jl index fd3bc773c22..5698c5b9533 100644 --- a/lib/StochasticDiffEqLeaping/src/integrator_utils.jl +++ b/lib/StochasticDiffEqLeaping/src/integrator_utils.jl @@ -1,5 +1,3 @@ -import OrdinaryDiffEqCore: nlsolve_f - # nlsolve_f override for ImplicitTauLeaping: return TauLeapingDrift wrapper # Uses ODEIntegrator{A} directly since parameterized type aliases don't work. function OrdinaryDiffEqCore.nlsolve_f(integrator::OrdinaryDiffEqCore.ODEIntegrator{A}) where {A <: ImplicitTauLeaping} diff --git a/lib/StochasticDiffEqLeaping/test/qa/Project.toml b/lib/StochasticDiffEqLeaping/test/qa/Project.toml index 45dc8154793..4faf7d074b6 100644 --- a/lib/StochasticDiffEqLeaping/test/qa/Project.toml +++ b/lib/StochasticDiffEqLeaping/test/qa/Project.toml @@ -4,6 +4,7 @@ DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqLeaping = "aefaaa88-39f2-4e89-b162-d61b7e8cc81b" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -29,6 +30,7 @@ DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" OrdinaryDiffEqNonlinearSolve = "2" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqLeaping = "2" Test = "1" diff --git a/lib/StochasticDiffEqLeaping/test/qa/qa.jl b/lib/StochasticDiffEqLeaping/test/qa/qa.jl index c3d11e2b00a..0982a9ab16f 100644 --- a/lib/StochasticDiffEqLeaping/test/qa/qa.jl +++ b/lib/StochasticDiffEqLeaping/test/qa/qa.jl @@ -1,12 +1,33 @@ -using StochasticDiffEqLeaping -using Aqua +using SciMLTesting, StochasticDiffEqLeaping, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqLeaping) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqLeaping; target_defined_modules = true) -end +run_qa( + StochasticDiffEqLeaping; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_kwargs = (; + # `@..` is the SciML fused-broadcast macro, owned by FastBroadcast and + # re-exported through DiffEqBase (FastBroadcast is not a direct dep here). + all_explicit_imports_via_owners = (; ignore = (Symbol("@.."),)), + # `pois_rand` is owned by PoissonRandom and re-exported by JumpProcesses, + # the natural dependency that owns the jump-process interface here. + all_qualified_accesses_via_owners = (; ignore = (:pois_rand,)), + all_explicit_imports_are_public = (; + ignore = ( + # FastBroadcast fused-broadcast macro, re-exported via DiffEqBase. + Symbol("@.."), + # StochasticDiffEqCore internal cache-alloc macro (non-public). + Symbol("@cache"), + ) + ), + all_qualified_accesses_are_public = (; + ignore = ( + # OrdinaryDiffEqCore internal a-posteriori error-estimate predicate + # (non-public). + :isaposteriori, + # PoissonRandom sampler, re-exported via JumpProcesses (non-public). + :pois_rand, + ) + ), + ), +) diff --git a/lib/StochasticDiffEqLevyArea/src/StochasticDiffEqLevyArea.jl b/lib/StochasticDiffEqLevyArea/src/StochasticDiffEqLevyArea.jl index 5be2102e012..69cdaa372f4 100644 --- a/lib/StochasticDiffEqLevyArea/src/StochasticDiffEqLevyArea.jl +++ b/lib/StochasticDiffEqLevyArea/src/StochasticDiffEqLevyArea.jl @@ -2,7 +2,6 @@ module StochasticDiffEqLevyArea import LinearAlgebra: mul! import Random: randn!, default_rng, AbstractRNG -using Random: Xoshiro import SpecialFunctions: trigamma """ diff --git a/lib/StochasticDiffEqLevyArea/test/qa/Project.toml b/lib/StochasticDiffEqLevyArea/test/qa/Project.toml index 8d1584cef6d..1e471bafa4e 100644 --- a/lib/StochasticDiffEqLevyArea/test/qa/Project.toml +++ b/lib/StochasticDiffEqLevyArea/test/qa/Project.toml @@ -1,6 +1,7 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqLevyArea = "90dbc90e-856a-4131-af2c-e8c5aa0f35b5" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -10,6 +11,7 @@ path = "../.." [compat] Aqua = "0.8" JET = "0.9, 0.10, 0.11" +SciMLTesting = "1.7" StochasticDiffEqLevyArea = "2" Test = "1" julia = "1.10" diff --git a/lib/StochasticDiffEqLevyArea/test/qa/qa.jl b/lib/StochasticDiffEqLevyArea/test/qa/qa.jl index 4e1ab152e02..8c317d38d29 100644 --- a/lib/StochasticDiffEqLevyArea/test/qa/qa.jl +++ b/lib/StochasticDiffEqLevyArea/test/qa/qa.jl @@ -1,12 +1,8 @@ -using StochasticDiffEqLevyArea -using Aqua +using SciMLTesting, StochasticDiffEqLevyArea, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqLevyArea) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqLevyArea; target_defined_modules = true) -end +run_qa( + StochasticDiffEqLevyArea; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, +) diff --git a/lib/StochasticDiffEqLowOrder/src/alg_utils.jl b/lib/StochasticDiffEqLowOrder/src/alg_utils.jl index 9e5f851e66c..2a3d4b45b70 100644 --- a/lib/StochasticDiffEqLowOrder/src/alg_utils.jl +++ b/lib/StochasticDiffEqLowOrder/src/alg_utils.jl @@ -20,15 +20,15 @@ end SciMLBase.alg_interpretation(alg::RKMilCommute) = alg.interpretation supports_regular_jumps(::EM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::EM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::LambaEM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::EulerHeun) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::LambaEulerHeun) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SplitEM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::PCEuler) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SimplifiedEM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RKMil) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RKMilCommute) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::EM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::LambaEM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::EulerHeun) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::LambaEulerHeun) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SplitEM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::PCEuler) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SimplifiedEM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RKMil) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RKMilCommute) = true is_split_step(::EM{split}) where {split} = split is_split_step(::LambaEM{split}) where {split} = split diff --git a/lib/StochasticDiffEqLowOrder/test/qa/Project.toml b/lib/StochasticDiffEqLowOrder/test/qa/Project.toml index be4b1cf67c8..1ad73f0b371 100644 --- a/lib/StochasticDiffEqLowOrder/test/qa/Project.toml +++ b/lib/StochasticDiffEqLowOrder/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqLowOrder = "d15fe365-ce7f-450a-828a-7985bd5b681b" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -24,6 +25,7 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqLowOrder = "2" Test = "1" diff --git a/lib/StochasticDiffEqLowOrder/test/qa/qa.jl b/lib/StochasticDiffEqLowOrder/test/qa/qa.jl index 5db61f34a74..10dea34594e 100644 --- a/lib/StochasticDiffEqLowOrder/test/qa/qa.jl +++ b/lib/StochasticDiffEqLowOrder/test/qa/qa.jl @@ -1,12 +1,9 @@ -using StochasticDiffEqLowOrder -using Aqua +using SciMLTesting, StochasticDiffEqLowOrder, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqLowOrder) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqLowOrder; target_defined_modules = true) -end +run_qa( + StochasticDiffEqLowOrder; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_broken = (:no_implicit_imports, :all_explicit_imports_via_owners, :all_qualified_accesses_are_public, :all_explicit_imports_are_public), # known-broken; see SciML/OrdinaryDiffEq.jl#3776 +) diff --git a/lib/StochasticDiffEqMilstein/src/alg_utils.jl b/lib/StochasticDiffEqMilstein/src/alg_utils.jl index e2ebd1c854f..15073916fe0 100644 --- a/lib/StochasticDiffEqMilstein/src/alg_utils.jl +++ b/lib/StochasticDiffEqMilstein/src/alg_utils.jl @@ -8,13 +8,13 @@ alg_order(alg::WangLi3SMil_F) = 1 // 1 SciMLBase.alg_interpretation(alg::RKMilGeneral) = alg.interpretation -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RKMilGeneral) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::WangLi3SMil_A) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::WangLi3SMil_B) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::WangLi3SMil_C) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::WangLi3SMil_D) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::WangLi3SMil_E) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::WangLi3SMil_F) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RKMilGeneral) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::WangLi3SMil_A) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::WangLi3SMil_B) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::WangLi3SMil_C) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::WangLi3SMil_D) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::WangLi3SMil_E) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::WangLi3SMil_F) = true alg_needs_extra_process(alg::RKMilGeneral) = true diff --git a/lib/StochasticDiffEqMilstein/test/qa/Project.toml b/lib/StochasticDiffEqMilstein/test/qa/Project.toml index f242dc2dc15..a7741685600 100644 --- a/lib/StochasticDiffEqMilstein/test/qa/Project.toml +++ b/lib/StochasticDiffEqMilstein/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqLevyArea = "90dbc90e-856a-4131-af2c-e8c5aa0f35b5" StochasticDiffEqMilstein = "8c95a807-c8e7-4581-8419-890d001af53e" @@ -28,6 +29,7 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqLevyArea = "2" StochasticDiffEqMilstein = "2" diff --git a/lib/StochasticDiffEqMilstein/test/qa/qa.jl b/lib/StochasticDiffEqMilstein/test/qa/qa.jl index 15bcaf8ebbd..61cd986fb30 100644 --- a/lib/StochasticDiffEqMilstein/test/qa/qa.jl +++ b/lib/StochasticDiffEqMilstein/test/qa/qa.jl @@ -1,12 +1,9 @@ -using StochasticDiffEqMilstein -using Aqua +using SciMLTesting, StochasticDiffEqMilstein, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqMilstein) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqMilstein; target_defined_modules = true) -end +run_qa( + StochasticDiffEqMilstein; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_broken = (:no_implicit_imports, :all_explicit_imports_via_owners, :all_qualified_accesses_are_public, :all_explicit_imports_are_public), # known-broken; see SciML/OrdinaryDiffEq.jl#3776 +) diff --git a/lib/StochasticDiffEqROCK/src/alg_utils.jl b/lib/StochasticDiffEqROCK/src/alg_utils.jl index f3f6086917e..bcff33686ff 100644 --- a/lib/StochasticDiffEqROCK/src/alg_utils.jl +++ b/lib/StochasticDiffEqROCK/src/alg_utils.jl @@ -22,10 +22,10 @@ function SciMLBase.alg_interpretation( return interpretation end -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SROCK1) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SROCK2) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::KomBurSROCK2) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SROCKC2) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SROCKEM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SKSROCK) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::TangXiaoSROCK2) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SROCK1) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SROCK2) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::KomBurSROCK2) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SROCKC2) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SROCKEM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SKSROCK) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::TangXiaoSROCK2) = true diff --git a/lib/StochasticDiffEqROCK/test/qa/Project.toml b/lib/StochasticDiffEqROCK/test/qa/Project.toml index 719e43299d9..41914fc495e 100644 --- a/lib/StochasticDiffEqROCK/test/qa/Project.toml +++ b/lib/StochasticDiffEqROCK/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqROCK = "db241ea8-0e6b-4abc-8f2d-1adff2294fd9" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -24,6 +25,7 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqROCK = "2" Test = "1" diff --git a/lib/StochasticDiffEqROCK/test/qa/qa.jl b/lib/StochasticDiffEqROCK/test/qa/qa.jl index ba5ac3109cf..7eb3eb3f4e6 100644 --- a/lib/StochasticDiffEqROCK/test/qa/qa.jl +++ b/lib/StochasticDiffEqROCK/test/qa/qa.jl @@ -1,12 +1,9 @@ -using StochasticDiffEqROCK -using Aqua +using SciMLTesting, StochasticDiffEqROCK, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqROCK) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqROCK; target_defined_modules = true) -end +run_qa( + StochasticDiffEqROCK; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_broken = (:no_implicit_imports, :no_stale_explicit_imports, :all_explicit_imports_via_owners, :all_qualified_accesses_are_public, :all_explicit_imports_are_public), # known-broken; see SciML/OrdinaryDiffEq.jl#3776 +) diff --git a/lib/StochasticDiffEqRODE/src/alg_utils.jl b/lib/StochasticDiffEqRODE/src/alg_utils.jl index 41538c350d2..e2a09bd9644 100644 --- a/lib/StochasticDiffEqRODE/src/alg_utils.jl +++ b/lib/StochasticDiffEqRODE/src/alg_utils.jl @@ -3,4 +3,4 @@ alg_order(alg::RandomHeun) = 1 // 2 alg_order(alg::RandomTamedEM) = 1 // 2 alg_order(alg::BAOAB) = 1 // 1 -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::BAOAB) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::BAOAB) = is_diagonal_noise(prob) diff --git a/lib/StochasticDiffEqRODE/test/qa/Project.toml b/lib/StochasticDiffEqRODE/test/qa/Project.toml index 233f49c63df..ea38056d069 100644 --- a/lib/StochasticDiffEqRODE/test/qa/Project.toml +++ b/lib/StochasticDiffEqRODE/test/qa/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqRODE = "49714585-0aa1-4f53-b1e6-a9b8c0d5e03f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -24,6 +25,7 @@ Aqua = "0.8" DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqRODE = "2" Test = "1" diff --git a/lib/StochasticDiffEqRODE/test/qa/qa.jl b/lib/StochasticDiffEqRODE/test/qa/qa.jl index 2dd9a18f6fa..f79f70c3484 100644 --- a/lib/StochasticDiffEqRODE/test/qa/qa.jl +++ b/lib/StochasticDiffEqRODE/test/qa/qa.jl @@ -1,12 +1,9 @@ -using StochasticDiffEqRODE -using Aqua +using SciMLTesting, StochasticDiffEqRODE, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqRODE) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqRODE; target_defined_modules = true) -end +run_qa( + StochasticDiffEqRODE; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_broken = (:no_implicit_imports, :all_explicit_imports_via_owners, :all_qualified_accesses_via_owners, :all_explicit_imports_are_public), # known-broken; see SciML/OrdinaryDiffEq.jl#3776 +) diff --git a/lib/StochasticDiffEqWeak/src/alg_utils.jl b/lib/StochasticDiffEqWeak/src/alg_utils.jl index 8c80d07db16..1ea296b4f72 100644 --- a/lib/StochasticDiffEqWeak/src/alg_utils.jl +++ b/lib/StochasticDiffEqWeak/src/alg_utils.jl @@ -42,29 +42,29 @@ SciMLBase.alg_interpretation(alg::NON2) = SciMLBase.AlgorithmInterpretation.Stra ## alg_compatible -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::DRI1) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::DRI1NM) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RI1) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RI3) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RI5) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RI6) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RDI1WM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RDI2WM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RDI3WM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RDI4WM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::W2Ito1) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RS1) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::RS2) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::PL1WM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::PL1WMA) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::NON) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::COM) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::NON2) = true -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SIEA) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SMEA) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SIEB) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::SMEB) = is_diagonal_noise(prob) -alg_compatible(prob::DiffEqBase.AbstractSDEProblem, alg::IRI1) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::DRI1) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::DRI1NM) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RI1) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RI3) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RI5) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RI6) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RDI1WM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RDI2WM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RDI3WM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RDI4WM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::W2Ito1) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RS1) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::RS2) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::PL1WM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::PL1WMA) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::NON) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::COM) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::NON2) = true +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SIEA) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SMEA) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SIEB) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::SMEB) = is_diagonal_noise(prob) +alg_compatible(prob::SciMLBase.AbstractSDEProblem, alg::IRI1) = true ## alg_needs_extra_process diff --git a/lib/StochasticDiffEqWeak/test/qa/Project.toml b/lib/StochasticDiffEqWeak/test/qa/Project.toml index e3a0dbe09e5..f6314d2281b 100644 --- a/lib/StochasticDiffEqWeak/test/qa/Project.toml +++ b/lib/StochasticDiffEqWeak/test/qa/Project.toml @@ -4,6 +4,7 @@ DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f" StochasticDiffEqWeak = "af2a2fcd-1c36-4cbe-a6d0-5afda784a085" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -29,6 +30,7 @@ DiffEqBase = "7" JET = "0.9, 0.10, 0.11" OrdinaryDiffEqCore = "4" OrdinaryDiffEqNonlinearSolve = "2" +SciMLTesting = "1.7" StochasticDiffEqCore = "2" StochasticDiffEqWeak = "2" Test = "1" diff --git a/lib/StochasticDiffEqWeak/test/qa/qa.jl b/lib/StochasticDiffEqWeak/test/qa/qa.jl index a13d55997dd..8769784e8bb 100644 --- a/lib/StochasticDiffEqWeak/test/qa/qa.jl +++ b/lib/StochasticDiffEqWeak/test/qa/qa.jl @@ -1,12 +1,9 @@ -using StochasticDiffEqWeak -using Aqua +using SciMLTesting, StochasticDiffEqWeak, Test using JET -using Test -@testset "Aqua" begin - Aqua.test_all(StochasticDiffEqWeak) -end - -@testset "JET" begin - JET.test_package(StochasticDiffEqWeak; target_defined_modules = true) -end +run_qa( + StochasticDiffEqWeak; + jet_kwargs = (; target_defined_modules = true), + explicit_imports = true, + ei_broken = (:no_implicit_imports, :no_stale_explicit_imports, :all_explicit_imports_via_owners, :all_qualified_accesses_are_public, :all_explicit_imports_are_public), # known-broken; see SciML/OrdinaryDiffEq.jl#3776 +) diff --git a/test/qa/qa_tests.jl b/test/qa/qa_tests.jl index 055a8e6a1a9..f0b726a854f 100644 --- a/test/qa/qa_tests.jl +++ b/test/qa/qa_tests.jl @@ -1,12 +1,13 @@ -using ExplicitImports, OrdinaryDiffEq, SciMLBase +using SciMLTesting, OrdinaryDiffEq, SciMLBase using Test -@testset "ExplicitImports" begin - @test check_no_implicit_imports( - OrdinaryDiffEq; skip = (Base, Core, SciMLBase) - ) === nothing - - @test check_no_stale_explicit_imports(OrdinaryDiffEq) === nothing - - @test check_all_qualified_accesses_via_owners(OrdinaryDiffEq) === nothing -end +# The umbrella package's QA lane historically ran only the ExplicitImports checks +# (no Aqua/JET), so keep `aqua = false` to preserve that scope. +run_qa( + OrdinaryDiffEq; + aqua = false, + explicit_imports = true, + ei_kwargs = (; + no_implicit_imports = (; skip = (Base, Core, SciMLBase)), + ), +)