[Rcpp-devel] Intel compiler

Yan Zhou zhouyan at me.com
Wed Jan 2 09:12:51 CET 2013


Just an amend to my last email. A second thought, I think you cannot use icpc to build Rcpp while R is built with GCC. Binaries built with icpc can link to and load shared objects (e.g., libR.so) built with GCC, but not the other way. So R may not be able to load the libRcpp.so or you shared objects that linked libRcpp.a (as you have to built them with icpc). So building R with icpc is perhaps your only choice, not just the easiest way.

Yan

On Jan 02, 2013, at 07:48 AM, Yan Zhou <zhouyan at me.com> wrote:

The easiest way is to build R yourself with intel icpc. Below is the script I used to build R on Linux with intel compilers. I assume you also has intel ifort installed (otherwise you can use gfortran). Intel C++ is not much faster than latest g++ for much optimization. But considering you are using CentOS, which is a clone of RHEL and come with GCC 4.4 series, icpc is considerable faster. Intel fortran generate somehow faster binary than gfortran. Besides intel come with faster math library and Intel compilers are bundled with MKL, the fastest BLAS implementation out there, I really don't see a reason why you shouldn't build R with it if you want to use this compiler on your work. Below is the script I used to build R on Linux with icc and ifort

#!/bin/bash

if [ $UID == 0 ]; then
    echo "Don't run this script as root"
    exit
fi

export CC="icc -std=gnu99"
export CXX="icpc -std=c++11"
export F77="ifort"
export FC="ifort"
export AR="xiar"
export LD="xild"
export CFLAGS="-g -fp-model strict -O3 -xHost"
export CXXFLAGS="-g -fp-model strict -O3 -xHost"
export FFLAGS="-g -fp-model strict -O3 -xHost"
export FCFLAGS="-g -fp-model strict -O3 -xHost"

cd ~/Documents/Build/R-src
svn up
./tools/rsync-recommended
mkdir -p ~/Documents/Build/R-build
rm -rf ~/Documents/Build/R-build/*
cd ~/Documents/Build/R-build

~/Documents/Build/R-src/configure \
    --build=x86_64-pc-linux-gnu \
    --with-blas="-lmkl_rt -openmp" \
    --with-lapack \
    --with-system-zlib \
    --with-system-bzlib \
    --with-system-xz \
    --with-system-pcre \
    --enable-openmp \
    --enable-R-shlib
make -j8

I never used RStudio. I guess it is an IDE so there maybe some work to do to make it work with a custom build R. For example, there can be problems of how RStudio find libR.so. If that is an issue you may need someone knows it better to help. If the server is not using Linux (not sure if I got the idea of RStudio server right) or you cannot access the server, then I have little to help. Intel compilers cannot build R on Mac due to some linker issue the last time I tried (maybe solved in most recent versions) and Windows is something I never use. Using a tool chain different than the one build R to build packages (such as Rcpp) is generally not a good idea. Though intel icpc is binary compatible with gcc, you can never be sure if some ABI issue will arise. However since icpc use libstdc++ which is built with gcc, they usually try very hard to avoid any compatibility issues.

If you can use it to build R and later found any problems with Rcpp, you can come back to the list. I know Dirk use G++ exclusively, but I use intel compilers regularly, so if there is any issue I may be able to help patch it.

Best,

Yan Zhou

On Jan 02, 2013, at 04:54 AM, Jules Archer <jules.archer at ymail.com> wrote:

Hi,

I'm interested in using the intel compiler for current and future Rccp application development. Would it be possible to provide a simple
example or two of how this alternative compiler can be used to compile Rccp applications?

I've successfully installed the latest intel c++ compiler (v13) in a linux environment (CentOS6.3). The latest version of Rcpp (0.10.2) is working as is with gnu c++ in combination with Rstudio server. 

Thanks!
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130102/02dc8a6f/attachment-0001.html>


More information about the Rcpp-devel mailing list