MPI in pystan

pystan

#1

I’m a little confused how to run MPI inside pystan. I understand that there are flags described here that turn on threading: https://github.com/stan-dev/pystan/blob/f4833a3759983dc47c49b4fa37436b6caa1ac34e/doc/threading_support.rst but is there an equivalent for turning on MPI?
Thanks for the help!


#2

It is not currently implemented.

I have tried to set it up for PyStan 2.18 with updated Stan source, but I still have not found a way to share MPI to C++ from Python, considering that script should also compile the Stan program.

Lately my dev-time has gone for ArviZ, so this MPI thing has been in the background.

https://arviz-devs.github.io/arviz/

But if you are able to run CmdStan with MPI then you could try to import CmdStan output csvs with arviz.from_cmdstan and use the inference_data class to access your samples.

https://arviz-devs.github.io/arviz/generated/arviz.from_cmdstan.html#arviz.from_cmdstan

I think that implementing MPI for httpstan will be easier so it might land for PyStan 3.


#3

Great, thanks for clarifying! I hadn’t seen ArviZ before, looks like a very useful package in general for python users