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

Variable Step ODE Solver ProgressMeter #15

Closed
delta-pi-1701 opened this issue Mar 3, 2015 · 4 comments
Closed

Variable Step ODE Solver ProgressMeter #15

delta-pi-1701 opened this issue Mar 3, 2015 · 4 comments

Comments

@delta-pi-1701
Copy link

Can variable step ode solvers be linked with ProgressMeter.jl to get a somewhat equivalent of Matlab's odeprint
Sundials progress monitoring, any such stuffs?

@timholy
Copy link
Owner

timholy commented Mar 3, 2015

ProgressMeter only works when you know how many iterations it's going to take; if that's not true, then you'll have to have some other way of displaying progress.

Optim.jl optionally lets you set show_trace to monitor convergence; that might be a good example to follow.

I'm going to close this, since there really isn't anything that needs to change in ProgressMeter.

@timholy timholy closed this as completed Mar 3, 2015
@tomasaschan
Copy link
Collaborator

Actually, for a lot of cases, ODE progress reporting would be quite trivial if ProgressMeter supported floating-point steps (and not just unit steps from 1 to n iterations, as today), since one often knows the start and end time of the iterval one integrates over.

It would have to be coupled with some effort in ODE.jl (specifically, something like SciML/ODE.jl#27 would be needed, so we could do things between integration steps) but one could envision something like

tspan = [0,10]
p = Progress(;from=tspan[1], to=tspan[10])
for t, y in ode(f, y0, [0, 10])
    setprogress!(p, t)
end

where ProgressMeter re-scales itself to e.g. 0-100%, and a call to setprogress! rescales t accordingly and updates the progress display to whatever it needs to be. We could also use increment!(p, dt) (and, trivially, increment!(p) = increment!(p, 1) for unit steps).

Doing this probably means quite a re-write of ProgressMeter, so I don't expect it will be done anytime soon unless @timholy finds a use case for it himself, but I'm sure a PR with this functionality would be well received 😄

@timholy
Copy link
Owner

timholy commented Mar 4, 2015

Good point. Yes, I'd be happy to consider a pull request.

@delta-pi-1701
Copy link
Author

Was able to get things going with Sundials and ProgressMeter. Needed the sleep, as my test function was a very simple one for ProgressMeter to show any response.
Sundials Issue #40.
For the time being things are quite ok.

function testfunc(len)
    p = ProgressMeter.Progress(len,0.01)
    for k = 2:len
        flag = Sundials.CVode(cvode_mem, tout[k], y, t, Sundials.CV_NORMAL)
        yres[k,:] = y
        sleep(0.0001)
        ProgressMeter.next!(p)
    end
end

println("Testing original interface...")
testfunc(length(tout))

Thanks @timholy for the progressmeter

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