Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with new version of Sundials v4.20.1 #169

Closed
johhell opened this issue Oct 28, 2023 · 8 comments
Closed

issue with new version of Sundials v4.20.1 #169

johhell opened this issue Oct 28, 2023 · 8 comments

Comments

@johhell
Copy link
Contributor

johhell commented Oct 28, 2023

description

Modia precompilation error after system update.
New version of Sundials was installed - with some changes: SciML/Sundials.jl@ffbfee4

workaround

switch back to v4.20.0

@ChrisRackauckas
Copy link

Do you have a standard install of Julia from Julialang.org?

@johhell
Copy link
Contributor Author

johhell commented Oct 28, 2023

Yes.
julia: v1.9.2
Modia: 0.12.0
Error occurrence when called simulate! in SnoopPrecompile.@precompile_all_call and using [email protected]
This works:
] status

(Modia) pkg> st
Project Modia v0.12.0
Status `~/Projekte/Modia/Modia.jl/Project.toml`
  [a93c6f00] DataFrames v1.6.1
  [2b5f629d] DiffEqBase v6.135.0
  [0c46a032] DifferentialEquations v7.11.0
  [6a86dc24] FiniteDiff v2.21.1
  [f6369f11] ForwardDiff v0.10.36
  [682c06a0] JSON v0.21.4
  [eff96d63] Measurements v2.10.0
  [ec7bf1ca] ModiaBase v0.11.1
  [0987c9cc] MonteCarloMeasurements v1.1.6
  [bac558e1] OrderedCollections v1.6.2
  [f2c3362d] RecursiveFactorization v0.2.20
  [189a3867] Reexport v1.2.2
  [3201582d] SignalTables v0.4.2
  [66db9d55] SnoopPrecompile v1.0.3
  [90137ffa] StaticArrays v1.6.5
⌃ [c3572dad] Sundials v4.20.0              <<<<<=======
  [a759f4b9] TimerOutputs v0.5.23
  [1986cc42] Unitful v1.17.0
  [b77e0a4c] InteractiveUtils
  [37e2e46d] LinearAlgebra
  [de0858da] Printf
  [8dfed614] Test
Info Packages marked with ⌃ have new versions available and may be upgradable.

@ChrisRackauckas
Copy link

What was the error?

@johhell
Copy link
Contributor Author

johhell commented Oct 28, 2023

reproducing the error

=> [email protected]

(Modia) pkg> add [email protected]
   Resolving package versions...
    Updating `~/Projekte/Modia/Modia.jl/Project.toml`
  [c3572dad] ↑ Sundials v4.20.0 ⇒ v4.20.1
    Updating `~/Projekte/Modia/Modia.jl/Manifest.toml`
  [c3572dad] ↑ Sundials v4.20.0 ⇒ v4.20.1
Precompiling project...
  ✗ Modia
  2 dependencies successfully precompiled in 36 seconds. 196 already precompiled.
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

status

Status `~/Projekte/Modia/Modia.jl/Project.toml`
  [a93c6f00] DataFrames v1.6.1
  [2b5f629d] DiffEqBase v6.135.0
  [0c46a032] DifferentialEquations v7.11.0
  [6a86dc24] FiniteDiff v2.21.1
  [f6369f11] ForwardDiff v0.10.36
  [682c06a0] JSON v0.21.4
  [eff96d63] Measurements v2.10.0
  [ec7bf1ca] ModiaBase v0.11.1
  [0987c9cc] MonteCarloMeasurements v1.1.6
  [bac558e1] OrderedCollections v1.6.2
  [f2c3362d] RecursiveFactorization v0.2.20
  [189a3867] Reexport v1.2.2
  [3201582d] SignalTables v0.4.2
  [66db9d55] SnoopPrecompile v1.0.3
  [90137ffa] StaticArrays v1.6.5
  [c3572dad] Sundials v4.20.1        <<<<<---------------------------------
  [a759f4b9] TimerOutputs v0.5.23
  [1986cc42] Unitful v1.17.0
  [b77e0a4c] InteractiveUtils
  [37e2e46d] LinearAlgebra
  [de0858da] Printf
  [8dfed614] Test

compile Modia

julia> using Modia
[ Info: Precompiling Modia [cb905087-75eb-5f27-8515-1ce0ec8e839e]
 

Welcome to Modia - Dynamic Modeling and Simulation with Julia
Version 0.12.0 (2023-06-04)
ERROR: LoadError: MethodError: no method matching append!(::Tuple{Float64}, ::Vector{Float64})

Closest candidates are:
  append!(::DataStructures.MutableLinkedList, ::Any...)
   @ DataStructures ~/.julia192/packages/DataStructures/MKv4P/src/mutable_list.jl:160
  append!(::OffsetArrays.OffsetVector{T} where T, ::Any)
   @ OffsetArrays ~/.julia192/packages/OffsetArrays/0MOrf/src/OffsetArrays.jl:604
  append!(::StatsBase.AbstractHistogram{T, 1}, ::AbstractVector) where T
   @ StatsBase ~/.julia192/packages/StatsBase/WLz8A/src/hist.jl:295
  ...

Stacktrace:
  [1] __init(prob::SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Modia.InstantiatedModel{Float64, Float64}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Modia.derivatives!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Sundials.CVODE_BDF{:Newton, :Dense, Nothing, Nothing}, timeseries::Vector{Any}, ts::Vector{Any}, ks::Vector{Any}; verbose::Bool, callback::SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#27#28", DiffEqCallbacks.FunctionCallingAffect{typeof(Modia.outputs!), DataStructures.BinaryMinHeap{Float64}, Vector{Float64}}, typeof(DiffEqCallbacks.functioncalling_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}, SciMLBase.DiscreteCallback{typeof(Modia.timeEventCondition!), typeof(Modia.affectTimeEvent!), typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, abstol::Float64, reltol::Float64, saveat::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, d_discontinuities::Vector{Float64}, tstops::Tuple{Float64}, maxiters::Int64, dt::Nothing, dtmin::Float64, dtmax::Float64, timeseries_errors::Bool, dense_errors::Bool, save_everystep::Bool, save_idxs::Nothing, save_on::Bool, save_start::Bool, save_end::Bool, dense::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), progress_id::Symbol, save_timeseries::Nothing, advance_to_tstop::Bool, stop_at_next_tstop::Bool, userdata::Nothing, alias_u0::Bool, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:adaptive, :initializealg), Tuple{Bool, SciMLBase.NoInit}}})
    @ Sundials ~/.julia192/packages/Sundials/vGumE/src/common_interface/solve.jl:138
  [2] __solve(prob::SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Modia.InstantiatedModel{Float64, Float64}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Modia.derivatives!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Sundials.CVODE_BDF{:Newton, :Dense, Nothing, Nothing}, timeseries::Vector{Any}, ts::Vector{Any}, ks::Vector{Any}, recompile::Type{Val{true}}; calculate_error::Bool, kwargs::Base.Pairs{Symbol, Any, NTuple{10, Symbol}, NamedTuple{(:reltol, :abstol, :save_everystep, :callback, :adaptive, :saveat, :dtmax, :maxiters, :tstops, :initializealg), Tuple{Float64, Float64, Bool, SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#27#28", DiffEqCallbacks.FunctionCallingAffect{typeof(Modia.outputs!), DataStructures.BinaryMinHeap{Float64}, Vector{Float64}}, typeof(DiffEqCallbacks.functioncalling_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}, SciMLBase.DiscreteCallback{typeof(Modia.timeEventCondition!), typeof(Modia.affectTimeEvent!), typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, Bool, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Int64, Tuple{Float64}, SciMLBase.NoInit}}})
    @ Sundials ~/.julia192/packages/Sundials/vGumE/src/common_interface/solve.jl:15
  [3] solve_call(_prob::SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Modia.InstantiatedModel{Float64, Float64}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Modia.derivatives!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::Sundials.CVODE_BDF{:Newton, :Dense, Nothing, Nothing}; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::Base.Pairs{Symbol, Any, NTuple{10, Symbol}, NamedTuple{(:reltol, :abstol, :save_everystep, :callback, :adaptive, :saveat, :dtmax, :maxiters, :tstops, :initializealg), Tuple{Float64, Float64, Bool, SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#27#28", DiffEqCallbacks.FunctionCallingAffect{typeof(Modia.outputs!), DataStructures.BinaryMinHeap{Float64}, Vector{Float64}}, typeof(DiffEqCallbacks.functioncalling_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}, SciMLBase.DiscreteCallback{typeof(Modia.timeEventCondition!), typeof(Modia.affectTimeEvent!), typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, Bool, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Int64, Tuple{Float64}, SciMLBase.NoInit}}})
    @ DiffEqBase ~/.julia192/packages/DiffEqBase/rf4hJ/src/solve.jl:557
  [4] solve_up(prob::SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Modia.InstantiatedModel{Float64, Float64}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Modia.derivatives!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, sensealg::Nothing, u0::Vector{Float64}, p::Modia.InstantiatedModel{Float64, Float64}, args::Sundials.CVODE_BDF{:Newton, :Dense, Nothing, Nothing}; kwargs::Base.Pairs{Symbol, Any, NTuple{10, Symbol}, NamedTuple{(:reltol, :abstol, :save_everystep, :callback, :adaptive, :saveat, :dtmax, :maxiters, :tstops, :initializealg), Tuple{Float64, Float64, Bool, SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#27#28", DiffEqCallbacks.FunctionCallingAffect{typeof(Modia.outputs!), DataStructures.BinaryMinHeap{Float64}, Vector{Float64}}, typeof(DiffEqCallbacks.functioncalling_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}, SciMLBase.DiscreteCallback{typeof(Modia.timeEventCondition!), typeof(Modia.affectTimeEvent!), typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, Bool, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Int64, Tuple{Float64}, SciMLBase.NoInit}}})
    @ DiffEqBase ~/.julia192/packages/DiffEqBase/rf4hJ/src/solve.jl:1006
  [5] solve(prob::SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Modia.InstantiatedModel{Float64, Float64}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Modia.derivatives!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::Sundials.CVODE_BDF{:Newton, :Dense, Nothing, Nothing}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{true}, kwargs::Base.Pairs{Symbol, Any, NTuple{10, Symbol}, NamedTuple{(:reltol, :abstol, :save_everystep, :callback, :adaptive, :saveat, :dtmax, :maxiters, :tstops, :initializealg), Tuple{Float64, Float64, Bool, SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#27#28", DiffEqCallbacks.FunctionCallingAffect{typeof(Modia.outputs!), DataStructures.BinaryMinHeap{Float64}, Vector{Float64}}, typeof(DiffEqCallbacks.functioncalling_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}, SciMLBase.DiscreteCallback{typeof(Modia.timeEventCondition!), typeof(Modia.affectTimeEvent!), typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, Bool, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Int64, Tuple{Float64}, SciMLBase.NoInit}}})
    @ DiffEqBase ~/.julia192/packages/DiffEqBase/rf4hJ/src/solve.jl:929
  [6] macro expansion
    @ ~/.julia192/packages/TimerOutputs/RsWnF/src/TimerOutput.jl:237 [inlined]
  [7] simulateSegment!(m::Modia.InstantiatedModel{Float64, Float64}, algorithm::Sundials.CVODE_BDF{:Newton, :Dense, Nothing, Nothing}; kwargs::Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol}, NamedTuple{(:stopTime, :useRecursiveFactorizationUptoSize), Tuple{Float64, Int64}}})
    @ Modia ~/Projekte/Modia/Modia.jl/src/SimulateAndPlot.jl:548
  [8] simulateSegment!
    @ ~/Projekte/Modia/Modia.jl/src/SimulateAndPlot.jl:388 [inlined]
  [9] macro expansion
    @ ~/Projekte/Modia/Modia.jl/src/SimulateAndPlot.jl:234 [inlined]
 [10] macro expansion
    @ ~/.julia192/packages/TimerOutputs/RsWnF/src/TimerOutput.jl:237 [inlined]
 [11] simulate!(m::Modia.InstantiatedModel{Float64, Float64}, algorithm::Missing; merge::Nothing, kwargs::Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol}, NamedTuple{(:stopTime, :useRecursiveFactorizationUptoSize), Tuple{Float64, Int64}}})
    @ Modia ~/Projekte/Modia/Modia.jl/src/SimulateAndPlot.jl:233
 [12] simulate!
    @ ~/Projekte/Modia/Modia.jl/src/SimulateAndPlot.jl:187 [inlined]
 [13] macro expansion
    @ ~/Projekte/Modia/Modia.jl/src/Modia.jl:272 [inlined]
 [14] top-level scope
    @ ~/.julia192/packages/SnoopPrecompile/1XXT1/src/SnoopPrecompile.jl:62
 [15] include
    @ ./Base.jl:457 [inlined]
 [16] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2049
 [17] top-level scope
    @ stdin:3
in expression starting at /home/hans/Projekte/Modia/Modia.jl/src/Modia.jl:1
in expression starting at stdin:3
ERROR: Failed to precompile Modia [cb905087-75eb-5f27-8515-1ce0ec8e839e] to "/home/hans/.julia192/compiled/v1.9/Modia/jl_wcEWye".
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:2300
 [3] compilecache
   @ ./loading.jl:2167 [inlined]
 [4] _require(pkg::Base.PkgId, env::String)
   @ Base ./loading.jl:1805
 [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
   @ Base ./loading.jl:1660
 [6] macro expansion
   @ ./loading.jl:1648 [inlined]
 [7] macro expansion
   @ ./lock.jl:267 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1611

@ChrisRackauckas
Copy link

Is Modia declaring tstops as a tuple? That's odd but could probably be supported.

@johhell
Copy link
Contributor Author

johhell commented Oct 30, 2023

Thx for support
tstop was defined as Tuple . Now modified to Vector and simulation works with [email protected] and [email protected]
PR follows.

@johhell johhell closed this as completed Oct 30, 2023
@johhell
Copy link
Contributor Author

johhell commented Oct 30, 2023

PR : #170

@johhell johhell reopened this Oct 30, 2023
@MartinOtter
Copy link
Member

Is Modia declaring tstops as a tuple? That's odd but could probably be supported.

I don't know why tstops was declared as tuple. Note, this definition is present in Modia since many years and it is odd that it worked until now (tstops as vector is of course the right approach). It might be that in some cases the definition with a vector did not work in the past, but with tuple it did, and that therefore I used the implementation with a tuple - or I just made a mistake at that time and by accident this just worked until now.
Anyway, I have accepted the pull request to change this in Modia to a vector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants