Skip to content

Commit

Permalink
log progress with configurable ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Pepijn de Vos committed Sep 29, 2023
1 parent d84c28d commit 5a66c02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/integrators/integrator_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function _postamble!(integrator)
if integrator.opts.progress
@logmsg(LogLevel(-1),
integrator.opts.progress_name,
_id=:OrdinaryDiffEq,
_id=integrator.opts.progress_id,
message=integrator.opts.progress_message(integrator.dt, integrator.u,
integrator.p, integrator.t),
progress="done")
Expand Down Expand Up @@ -269,7 +269,7 @@ function _loopfooter!(integrator)
t1, t2 = integrator.sol.prob.tspan
@logmsg(LogLevel(-1),
integrator.opts.progress_name,
_id=:OrdinaryDiffEq,
_id=integrator.opts.progress_id,
message=integrator.opts.progress_message(integrator.dt, integrator.u,
integrator.p, integrator.t),
progress=(integrator.t - t1) / (t2 - t1))
Expand Down
1 change: 1 addition & 0 deletions src/integrators/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mutable struct DEOptions{absType, relType, QT, tType, Controller, F1, F2, F3, F4
progress_steps::Int
progress_name::String
progress_message::F6
progress_id::Symbol
timeseries_errors::Bool
dense_errors::Bool
dense::Bool
Expand Down
4 changes: 3 additions & 1 deletion src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem,
progress_steps = 1000,
progress_name = "ODE",
progress_message = ODE_DEFAULT_PROG_MESSAGE,
progress_id = gensym("OrdinaryDiffEq"),
userdata = nothing,
allow_extrapolation = alg_extrapolates(alg),
initialize_integrator = true,
Expand Down Expand Up @@ -99,7 +100,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem,
@warn("Dense output is incompatible with saveat. Please use the SavingCallback from the Callback Library to mix the two behaviors.")
end

progress && @logmsg(LogLevel(-1), progress_name, _id=_id = :OrdinaryDiffEq, progress=0)
progress && @logmsg(LogLevel(-1), progress_name, _id=progress_id, progress=0)

tType = eltype(prob.tspan)
tspan = prob.tspan
Expand Down Expand Up @@ -380,6 +381,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem,
progress_steps,
progress_name,
progress_message,
progress_id,
timeseries_errors,
dense_errors, dense,
save_on, save_start,
Expand Down

3 comments on commit 5a66c02

@mrs504aa
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change broke Bloqade.jl.

@ChrisRackauckas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how so? I don't see how adding a kwarg is breaking. Is it that it was looking for a specific ID for some reason?

@mrs504aa
Copy link

@mrs504aa mrs504aa commented on 5a66c02 Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's about the change of DEOptions in type.jl.
QuEraComputing/Bloqade.jl#605 (comment)

I checked source code of BloqadeODE and OrdinaryDiffEq.jl and found that in BloqadeODE/src/integrator_init.jl when constructing DEOptions, something called progress_id::Symbol is missing, which is required in OrdinaryDiffEq/src/integrators/type.jl.

Please sign in to comment.