Smooth progress bar for multithreads sampling in turing.jl

Hello everyone,

Im working with turing.jl and what I have noticed that when sampling multiple chains with mulithreads option. Progress bar show progress based on number of chains used for example if I use 3 chains then progress will be shown after 1/3 sampling is done for all chains. So, 0 → 30% → 60% → 90% like that. Now issue is for large sample numbers and complex model it can take hours to get 30% of smaples and till then you have no clue if things are even running or just stuck.

I suggest that it will be super nice if progress bar can be customised to give small progress too like in case of single thread run we see progress go 0 → 1% → 2% …

Has anyone implemented something in this direction ?

Thank you

I noticed the multichain progress bar is currently being updated to show all chains. Progress bars when sampling multiple chains by penelopeysm · Pull Request #168 · TuringLang/AbstractMCMC.jl · GitHub

1 Like

Perfect, it will be very helpful :grin:

1 Like

That PR is merged now so if you update to AbstractMCMC 5.7.0 you should be able to use this: specifically

sample(model, sampler, MCMCThreads(), 1000, 3)

will have a single progress bar that shows overall % of samples done, and

sample(model, sampler, MCMCThreads(), 1000, 3; progress=:perchain)

will additionally create one extra progress bar per chain.

3 Likes

This is super news. Thanks :smiley:

This is great, thanks! Will the same happen in the case of MCMCDistributed()?

Yes to a certain extent; if you use MCMCDistributed() you will get a single progress bar that has more fine-grained progress, but :perchain won’t work (it was way too fiddly to code up and I was hoping that the improved overall progress bar should be sufficient).