I’m trying to allocate the number of cores to my simulation for compiling and running many different Stan models in parallel. I’m just wondering whether the compilation from the Stan code to the executable is a parallel core or single core process?
I know you can set the number of cores in make and I know that you can set the number of cores the Stan executable should use via cmdstanr during HMC, but are these related to the number of cores used during compilation?
They are not. Unfortunately there’s not a way to use multiple cores to speed up compilation of individual models.
Yeah, this can be used to speed up building CmdStan itself (this is what the cores argument to install_cmdstan() does), but it will not speed up compilation of individual models.
Right, this is what the parallel_chains argument to CmdStanR’s sample() method does (or alternatively setting the mc.cores option), but this also doesn’t affect compilation.
I think this is because of the sequential nature of the steps involved, but @WardBrian or another developer who works on the compiler would know better than I do.