I understand that with stan 2.20 the model compilation times should have improved a lot, but that this improvement isn’t available with Rstan yet. Therefore I’m trying to switch to cmdstan in order to get faster compilation. The problem is it doesn’t seem to actually improve compilation time much. Compilation still takes ~50 seconds for a very simple model (~60 with RStan).
I read stuff about that might impliy that current version of RTools is needed for fast compilation, or that it doesn’t work with all compilers, etc. I’m comfused. Is there a list of the conditions that need to be met to get the speedup? Can anyone tell if i’m missing something, and if so what? Here’s some info about my setup:
I’m running on Windows
Rstan version 2.19.3
cmdstanr version 0.0.0.9001 (current)
stan version used by cmdstanr 2.23.0 (current)
RTools version 40 (current)
output of Sys.which(“make”): “C:\rtools40\usr\bin\make.exe”
r version 3.6.2
rstudio version 1.3.959 (current)
As you can see my R-Version is not quite current. I didn’t update that yet, as doing so usually breaks something and requires manual intervention. Maybe that’s the next step, if theres is no other likely cause.
R version should not have an effect here, at least not for cmdstanr/cmdstan. Compile time on windows is a bit slower than on Linux/Mac but ~50 seconds sounds a bit extreme especially if your system is not ancient.
Though I have to note that the first model you will compile with cmdstanr will take a bit longer (it needs to compile the main.o file and the precompiled headers). But after that is built the compile times should be much faster. For me the first compile after a fresh install on Windows takes ~45seconds and then the compile times are ~20 seconds with 2.23. With the next version that will drop to ~13 seconds if you are using RTools4.0. But that does not help you right now.
Did you compile more than one model?
Yes! But I’m not sure whether it was during the same R-session, and I might have compiled something with Rstan in between.
Cmdstan does not really care about R sessions, so that should not be a problem here. Will go double check if we had a regression in recent cmdstanr that would cause this.
Unfortunately this is a regression yes. Specifically what was described here: Compilation time evolution in cmdstan
Windows was hit the most by this regression. I was able to replicate your times more or less on a notebook. There is not much you can do right now, unless you are willing to try the develop cmdstan version.
Ah, Damn. In that thread it didn’t seem as bad. Thanks for the investigation!
Yeah, Windows was hit more than that thread show (those were done on Ubuntu). Unfortunately.