rcpp sourceCpp 编译器设置 [英] Rcpp sourceCpp compiler settings
问题描述
我正在使用 Rcpp 来加速一个在 R(3.4、Windows7)中被重复调用的函数,我希望更改编译器设置.
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.
当我打电话时:sourceCpp("scoreseq1.1.cc", verbose=TRUE)
部分输出如下:
C:/RBuildTools/3.4/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-34~1.1/include" -O2 -Wall -mtune=core2 -c scoreeq1.1.cc-o scoreeq1.1.o
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
我想将 -mtune
更改为 haswell
,将 -O2
更改为 -O3
以搜索一些性能改进.
I would like to change -mtune
to haswell
, and -O2
to -O3
in search of some performance improvements.
有没有办法通过 sourceCpp
或 cppFunction
做到这一点,我是否需要在 my.cc 文件中添加一个特殊的头文件,或者我需要修改我系统上的一些文件(如果是的话,是什么文件?!)
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?!)
谢谢!
推荐答案
不,你不能(很容易),而且通常不能来自函数.
No, you can't (easily), and in general not from a function.
这些设置从 R 本身的构建开始就固定"了.您可以编辑该文件——但每次重新构建/重新安装 R 时都必须这样做.
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.
在我的盒子上,文件是 $(R RHOME)/etc/Makeconf
.
On my box the file is $(R RHOME)/etc/Makeconf
.
这篇关于rcpp sourceCpp 编译器设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!