Welcome 微信登录

首页 / 操作系统 / Linux / Ubuntu下使用icc/ifort/MKL编译R及性能实测

1 基本环境
Ubuntu 11.04 32-bit
R 32-bit 2.13.0
Intel Composer XE 2011.3.174(含icc/ifort/MKL)
MKL(Intel Math Kernel Library), 号称"provides extremely well-tuned BLAS and LAPACK implementations that deliver significant performance leadership over alternative math libraries". 在特定的计算情境下会带来一定的性能提升. 记得哪里看到过Revolution R和MATLAB就有用到MKL. 这里尝试用Intel提供的C和Fortran编译器结合其MKL库编译R, 以期尽量发挥现有硬件的性能. Intel的Composer XE中自带了MKL, 而且icc/ifort基本是傻瓜化安装, 这里不再赘述.2 编译过程
假设icc/ifort/MKL安装在默认的 /opt/intel/composerxe-2011.3.174/ 目录下.通常我们会这样简单编译安装:wget http://ftp.ctex.org/mirrors/CRAN/src/base/R-2/R-2.13.0.tar.gz
tar -xf R-2.13.0.tar.gz
cd R-2.13.0
./configure
make
sudo make install这次具体指定一下参数就好了.
卸载原有的R:sudo apt-get remove r-base
sudo apt-get autoremove设以下为foo.shsource /opt/intel/composerxe-2011.3.174/bin/iccvars.sh ia32
source /opt/intel/composerxe-2011.3.174/bin/ifortvars.sh ia32
source /opt/intel/composerxe-2011.3.174/mkl/bin/mklvars.sh ia32export CC=icc
export CFLAGS="-g -O2 -wd188 -ip -std=c99"
export F77=ifort
export FFLAGS="-g -O3"
export CXX=icpc
export CXXFLAGS="-g -O3"
export FC=ifort
export FCFLAGS="-g -O3"
export ICC_LIBS=/opt/intel/composerxe-2011.3.174/compiler/lib/ia32
export IFC_LIBS=/opt/intel/composerxe-2011.3.174/compiler/lib/ia32
export SHLIB_CXXLD=icpc
export SHLIB_CXXLDFLAGS=-sharedMKL_LIB_PATH=/opt/intel/composerxe-2011.3.174/mkl/lib/ia32
export LD_LIBRARY_PATH=$MKL_LIB_PATHOMP_NUM_THREADS=2export LDFLAGS="-L${MKL_LIB_PATH},-Bdirect,--hash-style=both,-Wl,-O1 -L$ICC_LIBS -L$IFC_LIBS -L/usr/local/lib"export SHLIB_LDFLAGS="-lpthread"
export MAIN_LDFLAGS="-lpthread"MKL="-L${MKL_LIB_PATH} -lmkl_blas95 -lmkl_lapack95  -Wl,--start-group -lmkl_intel -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread"source一下foo.sh:source foo.sh下载解压和configure:wget http://ftp.ctex.org/mirrors/CRAN/src/base/R-2/R-2.13.0.tar.gz
tar -xf R-2.13.0.tar.gz
cd R-2.13.0
./configure --enable-R-shlib --with-blas="$MKL"  --with-lapack最后的configure结果大概会是这样的:R is now configured for i686-pc-linux-gnuSource directory:          .
Installation directory:    /usr/localC compiler:                icc  -g -O2 -wd188 -ip -std=c99
Fortran 77 compiler:       ifort  -g -O3C++ compiler:              icpc  -g -O3
Fortran 90/95 compiler:    ifort -g -O3
Obj-C compiler:Interfaces supported:      X11
External libraries:        readline, BLAS(generic), LAPACK(in blas)
Additional capabilities:   PNG, JPEG, NLS, cairo
Options enabled:           shared R library, R profiling, JavaRecommended packages:      yes然后make
make check
sudo make installBingo.三点说明:make到中间出现找不到/usr/include/asm/errno.h的情况. 加一个符号链接, 解决:
sudo ln -s /usr/include/asm-generic /usr/include/asm
参考网站[1]给出的中CFLAGS等4处带有参数 -mieee-fp , make时过不去. 在此去掉此参数以后, make通过, 后果未知.
make install时提示icc -I. -I../../src/include -I../../src/include  -I/usr/local/include -DHAVE_CONFIG_H   -openmp -fpic  -g -O2 -wd188 -ip -std=c99 -DR_HOME=""/usr/local/lib/R"" -o Rscript
./Rscript.c
/bin/bash: icc: 未找到命令
make[2]: *** [install-Rscript] 错误 127建立符号链接, 解决:
sudo ln -s /opt/intel/composerxe-2011.3.174/bin/ia32/icc /bin/icc
  • 1
  • 2
  • 3
  • 下一页
CentOS/Linux下 GMT的安装Ubuntu 10.10下简单安装配置R环境相关资讯      R  ifort  
  • Ubntu 14.04 LTS 下编译安装R   (04/04/2015 21:49:34)
  • 在Hadoop集群上运行R程序--安装  (07/21/2012 10:24:24)
  • Ubuntu 10.04 下安装Intel Fortran  (07/12/2012 09:09:46)
  • R-2.15.1 在 Fedora 16 上的安装(  (07/30/2012 14:54:26)
  • Ubuntu 10.10下简单安装配置R环境  (07/12/2012 09:29:38)
  • CentOS 6.2 x84_64 下安装intel 的  (07/12/2012 09:03:40)
本文评论 查看全部评论 (0)
表情: 姓名: 字数