Windows/Rstan: compiler flags not being picked up?

Hello,

I am unsure whether my Makevars settings are being picked up by Stan.

My Makevars settings are below but the DSO signature in the stanFit object is different:

.. .. ..@ dso         :Formal class 'cxxdso' [package "rstan"] with 7 slots
  .. .. .. .. ..@ sig         :List of 1
  .. .. .. .. .. ..$ file715860c76949: chr(0) 
  .. .. .. .. ..@ dso_saved   : logi TRUE
  .. .. .. .. ..@ dso_filename: chr "file715860c76949"
  .. .. .. .. ..@ modulename  : chr "stan_fit4model71585464310f_GP"
  .. .. .. .. ..@ system      : chr "x86_64, mingw32"
  .. .. .. .. ..@ cxxflags    : chr "CXXFLAGS = -O2 -Wall $(DEBUGFLAG) -mtune=core2"
  .. .. .. .. ..@ .CXXDSOMISC :<environment: 0x0000017395d3c6f8> 

Is this the correct behaviour? Should I not be seeing the -O3?

  • Operating System: Windows
  • RStan Version: 2.19.2

Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars"))):

CXX14FLAGS=-O3
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3
STAN_OPENCL=true
OPENCL_PLATFORM_ID=1
OPENCL_DEVICE_ID=0
CC = g++
LDFLAGS_OPENCL= -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64" -lOpenCL

(I have the same settings in Makevars.win)

Output of devtools::session_info("rstan")

> devtools::session_info("rstan")
- Session info ----------------------------------------------------------------------------------------------------------------------------

- Packages --------------------------------------------------------------------------------------------------------------------------------
 ! package      * version   date       lib source        
   assertthat     0.2.1     2019-03-21 [1] CRAN (R 3.5.3)
   backports      1.1.4     2019-04-10 [1] CRAN (R 3.5.3)
   BH             1.69.0-1  2019-01-07 [1] CRAN (R 3.5.2)
   callr          3.3.1     2019-07-18 [1] CRAN (R 3.5.3)
   checkmate      1.9.4     2019-07-04 [1] CRAN (R 3.5.3)
   cli            1.1.0     2019-03-19 [1] CRAN (R 3.5.3)
   colorspace     1.4-1     2019-03-18 [1] CRAN (R 3.5.3)
   crayon         1.3.4     2017-09-16 [1] CRAN (R 3.5.3)
   desc           1.2.0     2018-05-01 [1] CRAN (R 3.5.3)
   digest         0.6.20    2019-07-04 [1] CRAN (R 3.5.3)
   ellipsis       0.2.0.1   2019-07-02 [1] CRAN (R 3.5.3)
   fansi          0.4.0     2018-10-05 [1] CRAN (R 3.5.3)
   ggplot2      * 3.2.0     2019-06-16 [1] CRAN (R 3.5.3)
   glue           1.3.1     2019-03-12 [1] CRAN (R 3.5.3)
   gridExtra      2.3       2017-09-09 [1] CRAN (R 3.5.3)
   gtable         0.3.0     2019-03-25 [1] CRAN (R 3.5.3)
   inline         0.3.15    2018-05-18 [1] CRAN (R 3.5.3)
   labeling       0.3       2014-08-23 [1] CRAN (R 3.5.2)
   lattice        0.20-35   2017-03-25 [?] CRAN (R 3.5.1)
   lazyeval       0.2.2     2019-03-15 [1] CRAN (R 3.5.3)
   loo            2.1.0     2019-03-13 [1] CRAN (R 3.5.3)
   magrittr       1.5       2014-11-22 [1] CRAN (R 3.5.3)
   MASS           7.3-50    2018-04-30 [?] CRAN (R 3.5.1)
   Matrix         1.2-14    2018-04-13 [?] CRAN (R 3.5.1)
   matrixStats    0.54.0    2018-07-23 [1] CRAN (R 3.5.3)
   mgcv           1.8-24    2018-06-23 [?] CRAN (R 3.5.1)
   munsell        0.5.0     2018-06-12 [1] CRAN (R 3.5.3)
   nlme           3.1-137   2018-04-07 [?] CRAN (R 3.5.1)
   pillar         1.4.2     2019-06-29 [1] CRAN (R 3.5.3)
   pkgbuild       1.0.3     2019-03-20 [1] CRAN (R 3.5.3)
   pkgconfig      2.0.2     2018-08-16 [1] CRAN (R 3.5.3)
   plyr           1.8.4     2016-06-08 [1] CRAN (R 3.5.3)
   prettyunits    1.0.2     2015-07-13 [1] CRAN (R 3.5.3)
   processx       3.4.1     2019-07-18 [1] CRAN (R 3.5.3)
   ps             1.3.0     2018-12-21 [1] CRAN (R 3.5.3)
 P R6             2.2.2     2017-06-17 [3] CRAN (R 3.5.0)
   RColorBrewer   1.1-2     2014-12-07 [1] CRAN (R 3.5.2)
   Rcpp           1.0.2     2019-07-25 [1] CRAN (R 3.5.3)
   RcppEigen      0.3.3.5.0 2018-11-24 [1] CRAN (R 3.5.3)
   reshape2       1.4.3     2017-12-11 [1] CRAN (R 3.5.3)
   rlang          0.4.0     2019-06-25 [1] CRAN (R 3.5.3)
   rprojroot      1.3-2     2018-01-03 [1] CRAN (R 3.5.3)
   rstan        * 2.19.2    2019-07-09 [1] CRAN (R 3.5.3)
   scales         1.0.0     2018-08-09 [1] CRAN (R 3.5.3)
   StanHeaders  * 2.18.1-10 2019-06-14 [1] CRAN (R 3.5.3)
   stringi        1.4.3     2019-03-12 [1] CRAN (R 3.5.3)
   stringr        1.4.0     2019-02-10 [1] CRAN (R 3.5.3)
   tibble         2.1.3     2019-06-06 [1] CRAN (R 3.5.3)
   utf8           1.1.4     2018-05-24 [1] CRAN (R 3.5.3)
   vctrs          0.2.0     2019-07-05 [1] CRAN (R 3.5.3)
   viridisLite    0.3.0     2018-02-01 [1] CRAN (R 3.5.3)
   withr          2.1.2     2018-03-15 [1] CRAN (R 3.5.3)
   zeallot        0.1.0     2018-01-28 [1] CRAN (R 3.5.3)

Thanks!

I wouldn’t worry about what it says in dso because we aren’t doing anything with the cxxflags. Look at the output when you specify the verbose = TRUE argument to stan_model or stan if you have any doubt as to what flags were used.

1 Like