For the next 2.21 Stan release we are going to feature freeze tomorrow on October 11th midnight our codebase in order to have one week to sort out any issues. The next release will include the Intel Threading Building Blocks (TBB) which brings a few exciting features. It will enable much more threading capabilities in the future and as of now the threading based map_rect uses the TBB as its backend.
Now, the TBB requires that we link against it dynamically on all systems which turned to be relatively hard on Windows in particular. I would therefore appreciate if people interested in helping could run their favorite model using the current develop snapshot of cmdstan - ideally models which use map_rect with threading. So what I am looking for are any problems with the installation/documentation/running the models. There are some extra things to watch out for on Windows and I intentionally point anyone willing to try to refer to the documentation which I attach below.
To get the cmdstan develop version up and running you can follow these commands:
on MacOS and Linux you now do a make -j4 build while on Windows you do mingw32-make -j4 build. There is an additional step on Windows, but the command will tell you. Once there just try out your favorite model.
The benefits of the new TBB backend for map_rect are
automatic scheduling of jobs => the sharding choice becomes less relevant since the work is chunked according to CPU load automatically
nested map_rect calls will respect the STAN_NUM_THREADS and not use more threads than promised
~50% speedup on Linux and MacOS when using map_rect threading
~20% speedup on Windows when using map_rect threading
~25% speedup on MacOS for single-core performance (because on MacOS a better memory allocation is used)
The details of the performance evaluation can be found on the merged PR and the wiki page on threading. These speedups will, of course, vary depending on your model/OS/…
I would appreciate feedback on the documentation / installation ease / problems running it… and if you just like it, then that’s great to know as well. Should you run into trouble it would be good to know your OS, compiler used, stan model, stan data & anything else you find relevant. Thanks!
I would also like to thank @rok_cesnovar for reviewing all of the PRs which were plentiful and we had a few extra rounds of fun once we hit the odd Windows Jenkins machine.
Sebastian
cmdstan userguide with instructions for installation: cmdstan-guide.pdf (544.5 KB)
It seems that there is an issue with stanc3. What does run ok for me is a .hpp generated with the stan2 compiler from 2.20 and then I build that with develop cmdstan…this gives me a working binary. Could you check that?
as is required by map_rect in order for MPI to work (this is unrelated to this problem, but this has to be created at the end of the file just as in the old compiler). Thanks.
Thank you all! I’d like to just add on that 2.21 will also have a completely new compiler and it could definitely use a lot of testing. I’m working overtime this week to try to iron out all of these bugs as they come up, so keep 'em coming! Thanks everyone :)
Sorry for being so late with testing stanc3…you did ask for it earlier… I do recall… to my defense I did do some testing, but should have done more like always.