Skip to content

Compiling R on Linux using Intel Composer XE

February 6, 2013

I’ve mostly followed these instructions, making a few minor changes as necessary. The entire process took the better part of a day.

  1. download the R source tarball from CRAN (I used R 2.15.2) and unpack it

    > wget http://cran.r-project.org/src/base/R-2/R-2.15.2.tar.gz
    > tar xvzf R-2.15.2.tar.gz
  2. you need a minimum version of icpc 12.1 to compile Rcpp, due to this bug (as well as icc & ifort)
    > module load intel/2011.9.293
    Lyra: Intel Studio (composer_xe_2011_sp1.9.293) module loaded.
    > icpc -V
    Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.1.3.293 Build 20120212
    Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.
  3. in the source directory, edit the config.site file as follows:
    CC=icc
    CFLAGS="-g -O3 -wd188 -ip"
    F77=ifort
    FFLAGS="-g -O3 -fp-model source"
    SHLIB_LDFLAGS="-shared"
    LIBnn=lib64
    ICCROOT=/pkg/suse11/intel/composer_xe_2011_sp1.9.293
    ICC_LIBS=$ICCROOT/compiler/lib/intel64/
    LDFLAGS="-L$ICC_LIBS -L/usr/lib64"
    CXX=icpc
    CXXFLAGS="-g -O3 -fp-model source"
    SHLIB_CXXLD=icpc
    SHLIB_CXXLDFLAGS="-shared"
    FC=ifort
    FCFLAGS="-g -O3 -fp-model source"
    MKLPATH=$ICCROOT/mkl/lib/intel64
    MKLINCLUDE=$ICCROOT/mkl/include
    BLAS_LIBS="-L$MKLPATH -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm"
  4. ./configure --prefix=$HOME --enable-R-shlib --enable-memory-profiling

    This step alone took about 2.5 hours to run.

  5. make
  6. make install

    By default, R will be installed under $HOME/bin with configuration files in $HOME/lib64/R

    > capabilities()
     jpeg png tiff tcltk X11 aqua http/ftp sockets 
     TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE 
     libxml fifo cledit iconv NLS profmem cairo 
     TRUE TRUE TRUE TRUE TRUE TRUE TRUE
  7. in the R home directory, edit the etc/Makeconf file as follows:
    MKLROOT = /pkg/suse11/intel/composer_xe_2011_sp1.9.293/mkl
    BLAS_LIBS = -L$(MKLROOT)/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm 
    ## LAPACK_LIBS =
  8. now compile any additional packages from source – for example:
    > R CMD INSTALL --byte-compile code/fastICA_1.1-16.tar.gz 
    * installing to library â/home/n1284550/lib64/R/libraryâ
    * installing *source* package âfastICAâ ...
    ** package âfastICAâ successfully unpacked and MD5 sums checked
    checking for gcc... icc -std=gnu99
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether icc -std=gnu99 accepts -g... yes
    checking for icc -std=gnu99 option to accept ISO C89... none needed
    checking how to run the C preprocessor... icc -std=gnu99 -E
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking math.h usability... yes
    checking math.h presence... yes
    checking for math.h... yes
    checking for scopy in -L/pkg/suse11/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm... yes
    checking for sgesdd_... yes
    checking for lsame_... yes
    configure: creating ./config.status
    config.status: creating src/Makevars
    ** libs
    icc -std=gnu99 -I/home/n1284550/lib64/R/include -DNDEBUG -I/usr/local/include -fpic -g -O3 -wd188 -ip -c ica.c -o ica.o
    icc -std=gnu99 -shared -L/pkg/suse11/intel/composer_xe_2011_sp1.9.293/compiler/lib/intel64/ -L/usr/lib64 -o fastICA.so ica.o -L/pkg/suse11/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -L/home/n1284550/lib64/R/lib -lR
    installing to /home/n1284550/lib64/R/library/fastICA/libs
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    * DONE (fastICA)
Advertisements

From → R, Toolchain

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Richard Everitt's blog

Computational Bayesian statistics

Let's Look at the Figures

David Firth's blog

Nicholas Tierney

Computational Bayesian statistics

Mad (Data) Scientist

Musings, useful code etc. on R and data science

R-bloggers

R news and tutorials contributed by (750) R bloggers

Another Astrostatistics Blog

The random musings of a reformed astronomer ...

Darren Wilkinson's research blog

Statistics, computing, data science, Bayes, stochastic modelling, systems biology and bioinformatics

CHANCE

Computational Bayesian statistics

StatsLife - Significance magazine

Computational Bayesian statistics

(badness 10000)

Computational Bayesian statistics

Igor Kromin

Computational Bayesian statistics

Statisfaction

I can't get no

Xi'an's Og

an attempt at bloggin, nothing more...

Sam Clifford

Postdoctoral Fellow, Bayesian Statistics, Aerosol Science

Bayesian Research & Applications Group

Frontier Research in Bayesian Methodology & Computation

%d bloggers like this: