I have a Metropolis-Hastings algorithm in Python and I parallelized it with the multiprocessing library. However, at this moment I can only do Gelman-Rubin diagnosis when all generated parallel chains have ended (at a certain number of iterations set from the beginning).
I want to do the Gelman-Rubin diagnosis every 1000 iterations of the Metropolis-Hastings algorithm and stop all processes (chains) in case a certain criteria is met in Gelman-Rubin.
Are there any considerations I should take?
On the other hand, could you recommend me a convenient pythonic way to do it?
Thank you.