Compiling R on Linux using Intel Composer XE
I’ve mostly followed these instructions, making a few minor changes as necessary. The entire process took the better part of a day.
- 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
- 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.
- 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"
-
./configure --prefix=$HOME --enable-R-shlib --enable-memory-profiling
This step alone took about 2.5 hours to run.
-
make
-
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
- 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 =
- 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)
Trackbacks & Pingbacks