I just read the new Stan 2.29.0 release note Release of CmdStan 2.29 – The Stan Blog and found these auto-formatter, canonicalizer and optimization are very interesting. And I was not aware of these features previously. May I ask if one can apply this in cmdstanr? like some flags when compiling the model? Except this nice demo Stan-to-C++ optimizations from @rok_cesnovar, is there a way for R or Python users to automatically apply these features? Thank you very much.
This is amazing. Thank you very much for developing this. I also liked so much the online demo which is a nice tool for me to check what I could improve/canonicalize on my dirty Stan code. It’s also like a home tutor to learn some advanced features of Stan based on my own model. :)
May I ask if I could blindly apply this -O1 to all models or it is better to always compare?
I would recommend comparison if you are able, especially while the optimizations are still being developed. If you run into any incorrect behavior or compilation problems when using it that don’t occur without O1, we would really love to hear about it
Hi @rok_cesnovar, just to feedback on what I played with this optimization flag. I could reproduce your example, no_opt took 14.9s, whereas opt took 20.3s on my machine. However, the option exe_file seems not working and giving me error like
Error in self$compile(...) : unused argument (exe_file = "no_opt_lr")
So I have to delete the .exe file and recompile every time I switch between opt and no_opt. Do you have any idea where I am wrong? I think this exe_file is very convenient and would like to use it. Thanks a lot.
Btw, I also tried on my hierarchical variate-covariate model with AR(1) residual, it took 262.8s with opt and 285.3 without opt. All tests are using the same seed.