作者Wush978 (拒看低质媒体)
看板R_Language
标题[心得] 在Ubuntu 14.04上用Intel Compiler编译R
时间Mon Oct 13 14:38:59 2014
[关键字]: R, Installation, MKL
[重点摘要]:
在Ubuntu 14.04上利用Intel Compiler编译R, 并设定後让在Rstudio中使用。
1. 安装Intel Compiler, MKL, ... 到 /opt/intel
2. 下载R Source并解压缩到某个资料夹,以下代称<R HOME>
3. 在bash下执行以下指令:
```sh
# install tiff and cairo, or plot in rstudio will crash
sudo apt-get install libcairo2-dev libtiff5-dev
source /opt/intel/composerxe/bin/compilervars.sh intel6
export CC="icc"
export CXX="icpc"
export AR="xiar"
export LD="xild"
export CFLAGS="-O3 -ipo -openmp -xHost"
export CXXFLAGS="-O3 -ipo -openmp -xHost"
MKL="-lmkl_gf_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread"
echo $MKL
export MAIN_LDFLAGS='-openmp'
./configure --with-blas="$MKL" --with-lapack --enable-R-shlib --enable-BLAS-shlib --enable-memory-profiling
make
```
4. 在`~/.bashrc`中加入:
source /opt/intel/composerxe/bin/compilervars.sh intel6
PATH=<R HOME>/bin:$PATH
5. 重新开启在bash中执行rstudio即可打开编译後的R。
6. 可能会有其他的side effect... 後续再补上。也欢迎补充更好的设定方法
实测一段原本要跑14秒的sapply函数,变成11秒。
参考资料:
-
http://0rz.tw/H7I0J
https://software.intel.com/en-us/articles/
build-r-301-with-intel-c-compiler-and-intel-mkl-on-linux
-
http://stackoverflow.com/questions/25669214/
compiling-r-3-1-1-using-intel-mkl-enable-r-shlib-triggers-undefined-reference
-
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.112.25.100
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/R_Language/M.1413182342.A.DBA.html
※ 编辑: Wush978 (140.112.25.100), 10/13/2014 14:39:18
1F:→ gsuper: 版主更新到14罗 我孩死抓着13不放手 10/14 19:38
2F:→ gsuper: 重灌没很难 重新compile一堆library真的超烦 10/14 19:39
3F:→ Wush978: 这是新买的电脑,哈哈 10/14 20:44
4F:→ yanchenglin: Revolution R Open(免费)有MKL功能,可以直接装来用 10/17 00:14
5F:→ yanchenglin: 核心是R 3.1.1平台WIN/OS X/UBUNTU/CENTOS/openSUSE 10/17 00:17
我没有什麽Revolution R的使用经验,目前也不太打算去碰触那部份。
很欢迎版友分享相关经验
※ 编辑: Wush978 (118.161.31.44), 10/19/2014 18:08:16
6F:推 ljta: 这个流程我跑过一遍,确实可用。感谢版主。 10/19 19:10