R4.0, rtools 4.0 and rstan 2.19 on windows

Working on a CRAN update for ctsem, when trying out the new R setup I’m noticing very slow compiling of stan models. I understand we might see a new rstan at some point, but are there any updates to makevars recommendations? I’ve assumed that the old lines specifying how to find cxx14 compilers etc are unnecessary and just have:

CXX14FLAGS=-O2 -mtune=native -march=core2
CXX11FLAGS=-O2 -mtune=native -march=core2

Also, for anyone reading / searching this topic, make sure your old rtools (ie 3.5) are not in the system path.

At the moment, I think that is all that is needed, although you can probably safely do -march=native as well on your own machine (not for CRAN builds). I think the g++-8 that comes with RTools40 will generate code that executes faster with fewer mistakes detecting newer processor architectures, but the compilation is more resource intensive than with g++-4.9.

1 Like

Thanks. I’ve been burnt thinking march=native was working fine (and forgetting about it) a few times by now ;) but I’ll try it again…