Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rcpp sourceCpp compiler settings

Tags:

r

rcpp

I am using Rcpp to speed up a function that gets called repeatedly in R (3.4, Windows7) and I was hoping to change the compiler settings.

When I call: sourceCpp("scoreseq1.1.cc", verbose=TRUE)

Part of the output reads:

C:/RBuildTools/3.4/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-34~1.1/include" -O2 -Wall -mtune=core2 -c scoreseq1.1.cc -o scoreseq1.1.o

I would like to change -mtune to haswell, and -O2 to -O3 in search of some performance improvements.

Is there a way to do that through the sourceCpp or cppFunction, do I need a special header in my.cc file, or do I need to I need to modify some file on my system (and if so, what file?!)

Thanks!

like image 481
Bobert Avatar asked Sep 09 '26 04:09

Bobert


1 Answers

No, you can't (easily), and in general not from a function.

These settings are "fixed" from when R itself is built. You can edit the file -- but you will have to so each time R is rebuilt / reinstalled.

On my box the file is $(R RHOME)/etc/Makeconf.

like image 191
Dirk Eddelbuettel Avatar answered Sep 10 '26 19:09

Dirk Eddelbuettel