R: C++ Optimization flag when using the inline package

杀马特。学长 韩版系。学妹 提交于 2019-11-28 09:03:51

There are a couple of options:

  1. The best solution is to modify this for all usage by R so create e.g. a file ~/.R/Makevars and set CFLAGS, CXXFLAGS, ... there. This will affect all use by R CMD INSTALL ..., R CMD SHLIB ... etc pp and as cxxfunction() from inline uses it, it works here too.

  2. Specific to inline and Rcpp: modify the plugin, that's why it is a plugin system. See Rcpp:::Rcpp.plugin.maker().

  3. Switch back from cxxfunction() to cfunction(), hence do not use a plugin and set all arguments manually.

Needless to say, I like option 1 and use it myself.

Edit: A fourth (and crude !!) method I used to use in the past is to edit $R_HOME/Makeconf and/or Makeconf.site.

I can suggest a hack. Write a little wrapper program (also called cpp) which calls the real cpp and passes all arguments to it as is except that it passes -O3 for optimization. Then make sure your program occurs first in the executable path resolution for R.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!