The new stanc3 ocaml compiler can run the 8 schools model!

Hey all,

Exciting news - just got the new compiler to emit C++ that correctly links up with CmdStan and runs the 8 schools model with numerical results that exactly match the existing Stan 2 compiler program’s output. There’s still some work left to do for generating code for more complex models as 8 schools does not really stress the Stan language much, but this is a major milestone that @bgoodri mentioned would be a good time to start integration work with RStan. @ariddell is this when you’d want to integrate it with PyStan as well? I’d expect it to be much easier to plug into PyStan than RStan due to CRAN packaging limitations so you might not need as much of a head start.

@bgoodri, what’s the plan for this? How can we set you up with what you need? Our plan was basically to provide one binary per OS and just have RStan download the correct one automatically on install, but you mentioned you might be able to get CRAN to actually include it.

Thanks to tons of hard work from @Matthijs especially across parsing, semantic checking, and even Linux and Windows static binary builds! And lots of help from others like @Bob_Carpenter, @enetsee (all around functional guru!) and Ryan Bernstein (who switched his quals last minute to compilers & static analysis and used that to help build out our analysis framework with Matthijs).


Great news.

To get a proof-of-concept version working I think all we’d need for PyStan would be the platform-specific static binaries at a predictable https location.

1 Like

Sweet. Got Jenkins publishing stanc3 static binary releases for all 3 OSes here: There’s also a nightly tag that is updated every time master is updated.

I think this might be enough to start playing with but keep in mind it probably only supports 8 schools right now, haha. I’m working on expanding that as we speak; I’d estimate at least another couple of weeks before we can compile and run everything correctly but I wanted to get something working end to end to unblock anyone downstream that wanted to start the integration work.

Thanks! This doesn’t yet have @Matthijs and Ryan Bernstein’s optimization work but that will probably be the new compiler’s first killer feature over the old one. You can check out their progress in this giant PR: