{"id":700,"date":"2016-10-13T20:21:19","date_gmt":"2016-10-13T20:21:19","guid":{"rendered":"https:\/\/aciref.org\/?p=700"},"modified":"2016-10-13T20:21:19","modified_gmt":"2016-10-13T20:21:19","slug":"on-building-a-fast-r-environment","status":"publish","type":"post","link":"https:\/\/aciref.chpc.utah.edu\/?p=700","title":{"rendered":"On Building a fast R environment"},"content":{"rendered":"<p>\t\t\t\tIn this article we will describe how to build an R distribution from source<br \/>\nusing the Intel Compiler Suite.<\/p>\n<h4>Why?<\/h4>\n<p>The execution of R code can be significantly sped up when it is built<br \/>\nwith a decent compiler and relies on fast mathematical libraries (mainly linear algebra).<\/p>\n<h4>Requirements<\/h4>\n<p>The installation (vide infra) was performed on a machine running on the Centos7 OS.<br \/>\nWe also used the Intel Compiler Suite (Intel Parallel Studio XE 2017) and<br \/>\nits Math Kernel Library (MKL).<\/p>\n<h4>Installation Process<\/h4>\n<h5>Downloading the source code<\/h5>\n<p>cd \/uufs\/chpc.utah.edu\/sys\/srcdir\/R<br \/>\nwget http:\/\/cran.stat.ucla.edu\/src\/base\/R-3\/R-3.3.1.tar.gz<br \/>\ntar -zxvf R-3.3.1.tar.gz<br \/>\nmv R-3.3.1 3.3.1<br \/>\ncd 3.3.1<\/p>\n<h5>Setting up the Compiler Environment<\/h5>\n<p>module load intel\/2017.0.098<br \/>\necho $MKLROOT<br \/>\nexport CC=icc<br \/>\nexport CXX=icpc<br \/>\nexport F77=ifort<br \/>\nexport FC=ifort<br \/>\nexport AR=xiar<br \/>\nexport LD=xild<br \/>\nexport CFLAGS=&#8221; -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC &#8221;<br \/>\nexport CXXFLAGS=&#8221; -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC &#8221;<br \/>\nexport FFLAGS=&#8221; -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC &#8221;<br \/>\nexport FCFLAGS=&#8221; -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC &#8221;<br \/>\nexport LIBDIR=\\<br \/>\n\/uufs\/chpc.utah.edu\/sys\/installdir\/intel\/compilers_and_libraries_2017.0.098\/linux\/compiler\/lib\/intel64_lin<br \/>\nexport LDFLAGS=&#8221; -Wl,-rpath=$MKLROOT\/lib\/intel64_lin \\<br \/>\n                 -L$MKLROOT\/lib\/intel64_lin -lmkl_intel_lp64 \\<br \/>\n                 -lmkl_core -lmkl_intel_thread \\<br \/>\n                 -Wl,-rpath=$LIBDIR -L$LIBDIR -liomp5 -lpthread &#8221;<\/p>\n<h5>Generation of the Makefile<\/h5>\n<p>cd \/uufs\/chpc.utah.edu\/sys\/builddir\/R; mkdir 3.3.1i; cd 3.3.1i<\/p>\n<p># Configure (with BLAS &#038; LAPACK MKL Support)<br \/>\n..\/..\/..\/srcdir\/R\/3.3.1\/configure &#8211;prefix=\/uufs\/chpc.utah.edu\/sys\/installdir\/R\/3.3.1i \\<br \/>\n                                  &#8211;enable-R-profiling &#8211;enable-R-shlib &#8211;enable-memory-profiling \\<br \/>\n                                  &#8211;enable-java &#8211;enable-shared=yes &#8211;with-blas=&#8221;$LDFLAGS&#8221; \\<br \/>\n                                  &#8211;with-readline &#8211;with-tcltk &#8211;with-libpng &#8211;with-jpeglib &#8211;with-libtiff \\<br \/>\n                                  &#8211;with-ICU &#8211;with-pic &#8211;with-x &#8211;with-lapack<\/p>\n<h5>Output of the configure command<\/h5>\n<p><i><br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nR is now configured for x86_64-pc-linux-gnu<\/p>\n<p>  Source directory:          ..\/..\/..\/srcdir\/R\/3.3.1<br \/>\n  Installation directory:    \/uufs\/chpc.utah.edu\/sys\/installdir\/R\/3.3.1i<\/p>\n<p>  C compiler:                icc -std=gnu99   -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC<br \/>\n  Fortran 77 compiler:       ifort   -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC<\/p>\n<p>  C++ compiler:              icpc   -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC<br \/>\n  C++11 compiler:            icpc  -std=c++11  -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC<br \/>\n  Fortran 90\/95 compiler:    ifort  -axCORE-AVX2,AVX,SSE4.2 -O3 -ipo -qopenmp -fPIC<br \/>\n  Obj-C compiler:            gcc -g -O2 -fobjc-exceptions<\/p>\n<p>  Interfaces supported:      X11, tcltk<br \/>\n  External libraries:        readline, BLAS(MKL), LAPACK(in blas), curl<br \/>\n  Additional capabilities:   PNG, JPEG, TIFF, NLS, cairo, ICU<br \/>\n  Options enabled:           shared R library, R profiling, memory profiling<\/p>\n<p>  Capabilities skipped:<br \/>\n  Options not enabled:       shared BLAS<\/p>\n<p>  Recommended packages:      yes<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n<\/i><\/p>\n<h5>Building the executable\/installation<\/h5>\n<p>make -j 16<br \/>\nmake check<br \/>\nmake install<br \/>\nmake pdf<br \/>\nmake install-pdf\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article we will describe how to build an R distribution from source using the Intel Compiler Suite. Why? The execution of R code can be significantly sped up when it is built with a decent compiler and relies on fast mathematical libraries (mainly linear algebra). Requirements The installation (vide infra) was performed on [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-700","post","type-post","status-publish","format-standard","hentry","category-experience"],"_links":{"self":[{"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=\/wp\/v2\/posts\/700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=700"}],"version-history":[{"count":0,"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=\/wp\/v2\/posts\/700\/revisions"}],"wp:attachment":[{"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aciref.chpc.utah.edu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}