Faster configure mcmc#910
Conversation
|
This passed testing with the |
|
@paciorek @danielturek I note that this change in 0.8 provides a switch for faster configureMCMC behavior, which was left off (FALSE) by default. The idea was that we could all be turning it on to turn up any problems, but I'm not sure we've been doing that. Should we run a round of testing and switch it on for 0.9? Or should we make a more diligent effort to test it for a future release? |
|
@paciorek @danielturek On the topic of configureMCMC efficiency, note the following: Checking conjugacy is a slow step. We effectively check conjugacy for all nodes twice because we check it once to assign a conjugate sampler and then we check it again in addSampler if type == "conjugate". The latter check makes sense in a case that a user is adding a conjugate sampler manually and we want to verify its validity, but in a typical processing flow it doubles time spent on conjugacy checking. Could we add an argument to bypass it and use that argument when called from a typical internal processing flow? |
|
@perrydv Brief comments on your two points:
(To be clear: this double-checking would only happen if a user tries to add a conjugate sampler directly themselves, using |
|
Yes, I've been forgetting to turn that on. I think for future reference if we want to be testing something like that, we should turn it on in devel. I think you were pretty confident about it, so I think I am ok with including it in release after turning on and testing. |
|
Ok with me, to enable it if it passes testing, too. Also need to see if @perrydv agrees with me or not about the "double" checking of conjugacy, which we should fix if he's right. |
|
I will launch a PR to test turning this on. @danielturek It looked to me like |
|
Ok, I think there are instances here of both of us looking too quickly. This is my current understanding - which now, is again concluding, that everything is ok - that is, conjugacy check only happens once:
@perrydv Please let me know what you think. |
|
@danielturek Thanks for digging in and explaining that. Makes sense. |
This PR provides a toggled processing flow in configureMCMC that calculates traits of nodes by the declaration (resulting in many fewer lookups) and in a more direct manner.
The option
useNewConfigureMCMCtoggles the new system.For testing, it is set to TRUE. We could set it to FALSE and include in 0.8.0 or hold off due to congestion going into 0.8.0.
On the "allModels" set of classic BUGS examples in
test-models, I see about 10-60% improvements, whenuseConjugacy = FALSE.There are more steps that could speed up configureMCMC.
Some of the code in this PR is less readable/maintainable because it uses internal objects more directly. We may want to re-write some of those parts.