Has a Coffee Lake processor (likely if you bought your computer new in the last 12 months)
Uses Windows
Has already installed rstan 2.18.1 (don’t if you haven’t already)
Is willing to test whether adding -mtune=native -march=native to CXX14FLAGS in their ~/.R/Makevars file to see if a Stan program crashes (i.e. example(stan_model, package = "rstan", run.dontrun = TRUE))
? If so, please report whether it crashes or runs.
I guess Ben wrote " 3. Has already installed rstan 2.18.1 (don’t if you haven’t already)" because 2.18.1 might not work and he didn’t want to anyone to destroy their working environment, but certainly if you install 2.18.1 then you fulfill the required condition :)
You could use, e.g., conda, but again I guess Ben hoped someone would have a suitable configuration already and he assumed that there are not that many Windows users using virtual environments.
Yes, I should say if you have access to a Coffee Lake that you do not have to rely on it having a working rstan, then go ahead and upgrade it to 2.18.1 and try putting the -march=native -mtune=native thing into CXX14FLAGS to see if g++-4.9.3 can tune the binary to an instruction set that did not exist when g++-4.9.3 was last updated.
I tried it on a Coffee Lake 8700K. Fresh install rstan (Version 2.18.1, GitRev: 2e1f913d3ca3). The example you gave compiled and ran with and without those flags.
I did have to create a Makevars.win file for it to work at all: