Running MPI

Quick question about running MPI -

I’m running the command mpirun -np 8 ./model sample data file=foo.data.R, but this is just running the same model model.stan on different cores (i.e. different chains).

Is there something I’ve missed? I want to parallelize one model, not have the same thing run on different cores.

If this isn’t enough info, let me know and I’ll go ahead and copy my make/local etc and compiler options, but I’ve followed this document pretty closely: MPI Parallelism.

Is this clear?

1 Like

… yeah, we have in 2.18.0 a bug in the makefiles. Can you please download from cmdstan develop the make/models file and replace the one in the released version. Then just re-compile your model.

1 Like

I’ll give this a shot right now, thanks!

Also just to be clear - MPI only does anything useful if you’re using map_rect in your Stan model.

1 Like

Ok, I’m looking at the source code now, but any examples of Stan code or C++ code running a model that show how to use it?

Just this section of the 2.18 function reference:

That part explains how to use map_rect, and the wiki explains how to set up MPI such that map_rect calls are parallelized. I think that’s all we have right now, though Sebastian will know more. Want to make a case study? :D

1 Like

yeah, give me some time to play with it and then I can throw together a tutorial

can you link me to the git hub page or download for the cmdstan 2.18 function reference? having trouble finding it

That’s the entire section! Check the releases page for Stan (or CmdStan). https://github.com/stan-dev/stan/releases

1 Like

There is a StanCon contribution forthcoming which should be up soon.

In the meantime you should dive into this thread: Linear, parallell regression

Tn this thread @Ole_Petter_Hansen has coded up some nice examples which do take a number of efficiency considerations into account. So if you want to get this up and running, have a read of that thread (programs are in there).

2 Likes