LikelihoodProfiler.jl icon indicating copy to clipboard operation
LikelihoodProfiler.jl copied to clipboard

Problem when using `dtmin` option in `IntegrationProfiler`

Open TorkelE opened this issue 11 months ago • 1 comments

I have a case where this works:

method = IntegrationProfiler(integrator = Tsit5(), integrator_opts = (dtmax = 0.1,), matrix_type = :hessian)
pl_sol = profile(plprob, method; idxs = [p_idx])

but this fails:

method = IntegrationProfiler(integrator = Tsit5(), integrator_opts = (dtmax = 0.1, dtmin = 0.001), matrix_type = :hessian
pl_sol = profile(plprob, method; idxs = [p_idx])

with a

┌ Warning: dt(0.001) <= dtmin(0.001) at t=0.5172726656986002, and step error estimate = 0.27677973712186665. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase ~/.julia/packages/SciMLBase/Ub9ub/src/integrator_interface.jl:612
┌ Warning: Solver returned DtLessThanMin retcode at profile point x = 0.5172726656986002. Profiling is interrupted.
└ @ LikelihoodProfiler ~/.julia/dev/LikelihoodProfiler/src/profiler_state.jl:202
ERROR: UndefVarError: `sol` not defined in `LikelihoodProfiler`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
  [1] profiler_step!(profiler::LikelihoodProfiler.ProfilerState{…}, method::IntegrationProfiler{…})
    @ LikelihoodProfiler ~/.julia/dev/LikelihoodProfiler/src/profiler_state.jl:203
  [2] __profile_dir!(profiler_state::LikelihoodProfiler.ProfilerState{…})
    @ LikelihoodProfiler ~/.julia/dev/LikelihoodProfiler/src/profile.jl:78
  [3] __profile_dir(plprob::PLProblem{…}, method::IntegrationProfiler{…}, idx::Int64, dir::Int64; kwargs::@Kwargs{})
    @ LikelihoodProfiler ~/.julia/dev/LikelihoodProfiler/src/profile.jl:62
  [4] __profile_dir
    @ ~/.julia/dev/LikelihoodProfiler/src/profile.jl:59 [inlined]
  [5] (::LikelihoodProfiler.var"#13#14"{@Kwargs{}, PLProblem{…}, IntegrationProfiler{…}})(idx::Int64)
    @ LikelihoodProfiler ~/.julia/dev/LikelihoodProfiler/src/profile.jl:50
  [6] iterate
    @ ./generator.jl:48 [inlined]
  [7] _collect(c::Vector{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
    @ Base ./array.jl:811
  [8] collect_similar
    @ ./array.jl:720 [inlined]
  [9] map
    @ ./abstractarray.jl:3371 [inlined]
 [10] macro expansion
    @ ./timing.jl:421 [inlined]
 [11] __profile(plprob::PLProblem{…}, method::IntegrationProfiler{…}, ::Val{…}, idxs::Vector{…}; kwargs::@Kwargs{})
    @ LikelihoodProfiler ~/.julia/dev/LikelihoodProfiler/src/profile.jl:48
 [12] __profile
    @ ~/.julia/dev/LikelihoodProfiler/src/profile.jl:46 [inlined]
 [13] profile(plprob::PLProblem{…}, method::IntegrationProfiler{…}; idxs::Vector{…}, parallel_type::Symbol, kwargs::@Kwargs{})
    @ LikelihoodProfiler ~/.julia/dev/LikelihoodProfiler/src/profile.jl:42

Reducing the dtmin solves it, so that bit is fine. However, the error might be something (minor or not) to have a look at.

TorkelE avatar Mar 19 '25 15:03 TorkelE

As internally we solve an ODE system, the solver can produce such warnings if dt doesn't suite the tolerance settings. We are looking for a default (recommended) diffeq settings to use in IntegrationProfiler but it implies performing many benchmarks, so we haven't come up with the defaults here yet.

ivborissov avatar Mar 20 '25 09:03 ivborissov