Hello Nimble users,
I've created a custom distribution including a nimbleFunction for each d, r, p, and q functions. Those functions all compile successfully using compileNimble, and I'm able to register the distribution using registerDistributions. However, when used in a model the MCMC is much slower than when using one of Nimble's provided distributions. I'd like to speed it up, if possible, so I'm trying to identify why it's so slow. I see two likely culprits.
1) The model is using the un-compiled distribution functions. This seems possible, because the calls in the model code use the un-compiled versions. I did this because when I try to register the compiled distribution or use it in a model, I get the an error that the function is not available and "must be a nimbleFunction (with no setup code)." But since I'm using a compiled model and mcmc, I'm guessing that the Nimble functions for my distribution get compiled at the same time, but I'm not sure about that. So, could someone tell me whether that is the case, and if it is not, then how do I use compiled versions of my functions in the model?
2) If the model is using compiled versions of my distribution functions, then the slowness is caused by how I've implemented the function. If that's the case, I'll need to think about how that might be improved. I have a good guess where the problem would be, but whether that can be eliminated might be a topic for a separate post here.
Thanks in advance,
Gregory