SciML / SciMLBase.jl

The Base interface of the SciML ecosystem
https://docs.sciml.ai/SciMLBase/stable
MIT License
127 stars 92 forks source link

Add input preparation to ensemble problems #525

Closed LilithHafner closed 10 months ago

LilithHafner commented 10 months ago

Fixup for #519 (I didn't see these entry points) Does not fix https://github.com/SciML/diffeqpy/pull/122#issuecomment-1768836371.

codecov[bot] commented 10 months ago

Codecov Report

Merging #525 (681dad8) into master (578352c) will decrease coverage by 6.53%. The diff coverage is 83.33%.

@@            Coverage Diff             @@
##           master     #525      +/-   ##
==========================================
- Coverage   49.55%   43.03%   -6.53%     
==========================================
  Files          53       53              
  Lines        3925     3925              
==========================================
- Hits         1945     1689     -256     
- Misses       1980     2236     +256     
Files Coverage Δ
src/ensemble/ensemble_problems.jl 34.61% <83.33%> (+7.34%) :arrow_up:

... and 15 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

ChrisRackauckas commented 10 months ago

I see, does not fix 😅

For some reason I get init of nothing:

>>> sol = de.solve(ensembleprob,de.Tsit5(),de.EnsembleSerial(),trajectories=10000,saveat=0.01)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\accou\.julia\packages\PythonCall\qTEA1\src\jlwrap\any.jl", line 208, in __call__
    return self._jl_callmethod($(pyjl_methodnum(pyjlany_call)), args, kwargs)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
juliacall.JuliaError: MethodError: no method matching init(::Nothing, ::OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}; saveat::Float64)

Closest candidates are:
  init(!Matched::SciMLBase.OptimizationProblem, ::Any, !Matched::Any...; kwargs...)
   @ SciMLBase C:\Users\accou\.julia\packages\SciMLBase\tXu8A\src\solve.jl:146
  init(!Matched::SciMLBase.PDEProblem, ::SciMLBase.AbstractDEAlgorithm, !Matched::Any...; kwargs...)
   @ DiffEqBase C:\Users\accou\.julia\packages\DiffEqBase\xSmHR\src\solve.jl:1116
  init(!Matched::SciMLBase.AbstractJumpProblem, ::Any...; kwargs...)
   @ DiffEqBase C:\Users\accou\.julia\packages\DiffEqBase\xSmHR\src\solve.jl:499
  ...

Stacktrace:
  [1] solve(::Nothing, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:saveat,), Tuple{Float64}}})
    @ CommonSolve C:\Users\accou\.julia\packages\CommonSolve\JfpfI\src\CommonSolve.jl:23
  [2] batch_func(i::Int64, prob::SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#545"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x946926fe, 0xab7b8dc2, 0x707dbba2, 0x8b060826, 0xe63fdf5b), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xaf9b47a5, 0x8d86fb18, 0x65c64d40, 0xf8480c5a, 0x8614cffa), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#637#generated_observed#555"{Bool, ModelingToolkit.ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ModelingToolkit.ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ComposedFunction{typeof(SciMLBasePythonCallExt._pyconvert), Py}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, alg::OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}; kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:saveat,), Tuple{Float64}}})
    @ SciMLBase C:\Users\accou\.julia\packages\SciMLBase\tXu8A\src\ensemble\basic_ensemble_solve.jl:100
  [3] batch_func
    @ C:\Users\accou\.julia\packages\SciMLBase\tXu8A\src\ensemble\basic_ensemble_solve.jl:95 [inlined]
  [4] (::SciMLBase.var"#606#607"{Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:saveat,), Tuple{Float64}}}, SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#545"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x946926fe, 0xab7b8dc2, 0x707dbba2, 0x8b060826, 0xe63fdf5b), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xaf9b47a5, 0x8d86fb18, 0x65c64d40, 0xf8480c5a, 0x8614cffa), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#637#generated_observed#555"{Bool, ModelingToolkit.ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ModelingToolkit.ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ComposedFunction{typeof(SciMLBasePythonCallExt._pyconvert), Py}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}})(i::Int64)
    @ SciMLBase C:\Users\accou\.julia\packages\SciMLBase\tXu8A\src\ensemble\basic_ensemble_solve.jl:154
  [5] responsible_map(f::Function, II::UnitRange{Int64})
    @ SciMLBase C:\Users\accou\.julia\packages\SciMLBase\tXu8A\src\ensemble\basic_ensemble_solve.jl:147
  [6] solve_batch(prob::SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#545"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x946926fe, 0xab7b8dc2, 0x707dbba2, 0x8b060826, 0xe63fdf5b), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xaf9b47a5, 0x8d86fb18, 0x65c64d40, 0xf8480c5a, 0x8614cffa), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#637#generated_observed#555"{Bool, ModelingToolkit.ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ModelingToolkit.ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ComposedFunction{typeof(SciMLBasePythonCallExt._pyconvert), Py}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, alg::OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::SciMLBase.EnsembleSerial, II::UnitRange{Int64}, pmap_batch_size::Int64; kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:saveat,), Tuple{Float64}}})
    @ SciMLBase C:\Users\accou\.julia\packages\SciMLBase\tXu8A\src\ensemble\basic_ensemble_solve.jl:153
  [7] solve_batch
    @ C:\Users\accou\.julia\packages\SciMLBase\tXu8A\src\ensemble\basic_ensemble_solve.jl:152 [inlined]
  [8] macro expansion
    @ .\timing.jl:393 [inlined]
  [9] __solve(prob::SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#k#545"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x946926fe, 0xab7b8dc2, 0x707dbba2, 0x8b060826, 0xe63fdf5b), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xaf9b47a5, 0x8d86fb18, 0x65c64d40, 0xf8480c5a, 0x8614cffa), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#637#generated_observed#555"{Bool, ModelingToolkit.ODESystem, Dict{Any, Any}, Vector{SymbolicUtils.BasicSymbolic{Real}}}, Nothing, ModelingToolkit.ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ComposedFunction{typeof(SciMLBasePythonCallExt._pyconvert), Py}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, alg::OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ensemblealg::SciMLBase.EnsembleSerial; trajectories::Int64, batch_size::Int64, pmap_batch_size::Int64, kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:saveat,), Tuple{Float64}}})
    @ SciMLBase C:\Users\accou\.julia\packages\SciMLBase\tXu8A\src\ensemble\basic_ensemble_solve.jl:64
 [10] #solve#44
    @ C:\Users\accou\.julia\packages\DiffEqBase\xSmHR\src\solve.jl:1053 [inlined]
 [11] pyjlany_call(self::typeof(CommonSolve.solve), args_::Py, kwargs_::Py)
    @ PythonCall C:\Users\accou\.julia\packages\PythonCall\qTEA1\src\jlwrap\any.jl:34
 [12] _pyjl_callmethod(f::Any, self_::Ptr{PythonCall.C.PyObject}, args_::Ptr{PythonCall.C.PyObject}, nargs::Int64)
    @ PythonCall C:\Users\accou\.julia\packages\PythonCall\qTEA1\src\jlwrap\base.jl:69
 [13] _pyjl_callmethod(o::Ptr{PythonCall.C.PyObject}, args::Ptr{PythonCall.C.PyObject})
    @ PythonCall.C C:\Users\accou\.julia\packages\PythonCall\qTEA1\src\cpython\jlwrap.jl:47