[Rd] MKL Acceleration encouraging; need adjust package builds?

Paul Johnson pauljohn32 at gmail.com
Wed Nov 25 17:51:08 CET 2015

On Mon, Nov 23, 2015 at 11:39 AM, David Smith <davidsmi at microsoft.com> wrote:
> Hi Paul,
> We've been through this process ourselves for the Revolution R Open project. There are a number of pitfalls to avoid, but you can take a look at how we achieved it in the build scripts at:
> https://github.com/RevolutionAnalytics/RRO
> There are also some very useful notes in the R Installation guide:
> https://cran.r-project.org/doc/manuals/r-release/R-admin.html#BLAS
> Most packages do benefit from MKL (or any multi-threaded BLAS) to some degree, although the actual benefit depends on the R functions they call. Some packages (and some built-in R functions) don't call into BLAS endpoints, so you won't see benefits in all cases.
> # David Smith
Dear David

I'm in the situation mentioned here in the docs, since BLAS is not shared.

"Note that under Unix (but not under Windows) if R is compiled against
a non-default BLAS and --enable-BLAS-shlib is not used, then all
BLAS-using packages must also be. So if R is re-built to use an
enhanced BLAS then packages such as quantreg will need to be
re-installed. "

I am building all of the modules from scratch, so if the default build
is sufficient, then I'll be done. When I asked the other day, I was
worried that packages would find the wrong shared library. As far as I
can tell now, I should not have been so worried.

Today, while browsing the R installation, I find the Makeconf file and
that has all the information a package should need.  I've verified
that the quantreg package detects this information, and we'll just
hope the others do too :)

In case anybody else comes along later and wonders how R can be
configured to make this go, here's the top of our Makeconf from the
installed R, which has the configure line as well as BLAS_LIBS, which,
so far as I can tell, is making all of this go.

Makeconf content

# etc/Makeconf.  Generated from Makeconf.in by configure.
# ${R_HOME}/etc/Makeconf
# R was configured using the following call
# (not including env. vars and site configuration)
# configure  '--prefix=/tools/cluster/6.2/R/3.2.2_mkl' '--with-tcltk'
'--enable-R-shlib' '--enable-shared' '--with-pic'
-Wl,--no-as-needed -lmkl_gf_lp64 -Wl,--start-group -lmkl_gnu_thread
-lmkl_core  -Wl,--end-group -fopenmp  -ldl -lpthread -lm'

## This fails if it contains spaces, or if it is quoted
include $(R_SHARE_DIR)/make/vars.mk

AR = ar
## Used by packages 'maps' and 'mapdata'
AWK = gawk
BLAS_LIBS = -L/panfs/pfs.acf.ku.edu/cluster/6.2/intel/2015/mkl/lib/intel64
-Wl,--no-as-needed -lmkl_gf_lp64 -Wl,--start-group -lmkl_gnu_thread
-lmkl_core  -Wl,--end-group -fopenmp  -ldl -lpthread -lm
C_VISIBILITY = -fvisibility=hidden


Paul E. Johnson
Professor, Political Science        Director
1541 Lilac Lane, Room 504      Center for Research Methods
University of Kansas                 University of Kansas
http://pj.freefaculty.org              http://crmda.ku.edu

More information about the R-devel mailing list