@@ -452,13 +452,12 @@ function mcmcsample(
452
452
progress_channel = Channel {Bool} (nchains)
453
453
overall_progress_bar = CreateNewProgressBar (progressname)
454
454
# If we have many chains and many samples, we don't want to force
455
- # each chain to report back to the main thread for each sample, as
456
- # this would cause serious performance issues due to lock conflicts.
457
- # In the overall progress bar we only expect 200 updates (i.e., one
458
- # update per 0.5%). To avoid possible throttling issues we ask for
459
- # twice the amount needed per chain, which doesn't cause a real
460
- # performance hit.
461
- updates_per_chain = max (1 , 400 ÷ nchains)
455
+ # each chain to report back to the main thread for each sample, as this would
456
+ # cause serious performance issues due to lock conflicts. In the overall
457
+ # progress bar we only expect N updates (by default N = 200, i.e., one update
458
+ # per 0.5%). To avoid possible throttling issues we ask for twice
459
+ # the amount needed per chain, which doesn't cause a real performance hit.
460
+ updates_per_chain = max (1 , (2 * get_n_updates (overall_progress_bar)) ÷ nchains)
462
461
init_progress! (overall_progress_bar)
463
462
end
464
463
if progress == :perchain
@@ -483,7 +482,7 @@ function mcmcsample(
483
482
Ntotal = nchains * updates_per_chain
484
483
# Determine threshold values for progress logging
485
484
# (one update per 0.5% of progress)
486
- threshold = Ntotal / 200
485
+ threshold = Ntotal / get_n_updates (overall_progress_bar)
487
486
next_update = threshold
488
487
489
488
itotal = 0
@@ -633,7 +632,7 @@ function mcmcsample(
633
632
overall_progress_bar = CreateNewProgressBar (progressname)
634
633
init_progress! (overall_progress_bar)
635
634
# See MCMCThreads method for the rationale behind updates_per_chain.
636
- updates_per_chain = max (1 , 400 ÷ nchains)
635
+ updates_per_chain = max (1 , ( 2 * get_n_updates (overall_progress_bar)) ÷ nchains)
637
636
child_progresses = [
638
637
ChannelProgress (progress_channel, updates_per_chain) for _ in 1 : nchains
639
638
]
@@ -646,9 +645,8 @@ function mcmcsample(
646
645
# This task updates the progress bar
647
646
Distributed. @async begin
648
647
# Determine threshold values for progress logging
649
- # (one update per 0.5% of progress)
650
648
Ntotal = nchains * updates_per_chain
651
- threshold = Ntotal / 200
649
+ threshold = Ntotal / get_n_updates (overall_progress_bar)
652
650
next_update = threshold
653
651
654
652
itotal = 0
0 commit comments