[Rd] linux multi-threaded compilation is running only on one processor

Simon Urbanek simon.urbanek at r-project.org
Fri Dec 28 17:33:00 CET 2012


On Dec 28, 2012, at 5:23 AM, Vitaliy FEOKTISTOV wrote:

> Hello,
> 
> I compiled R-2.15.2 with linux intel compilers (see below).
> 
> when I execute some R code on a // 4 proc x 4 cores // server
> (export MKL_NUM_THREADS = 16)
> very often I have the situations where only one processor (4 cores) is
> active instead of 4 (16 cores) !
> 
> do you know this fact depends on what ?
> 

What code? Usually, this has nothing to do with R but the libraries you're using and their capability to implicitly parallelize the calls used (presumably MKL is your case?). You didn't provide any details on what you are actually doing, but really you should be asking on the lists for the libraries you are using.


> thank you !
> 
> P.S.
> many functions of R are single-threaded, is there a simple way to make them multi-threaded ?
> 

R is not thread-safe, so any parallelization has to be done at native code level. So if "functions of R" is referring to R code then the answer is no (except for the obvious use parallel/multicore where applicable), if it is referring to native functions then the answer is possibly - Luke Tierney has done some of that work -- did you try pnmath? 

Cheers,
Simon


> 
> =========================================================================================================
> 
> CMP_LIB_PATH=/opt/intel/lib/intel64
> MKL_LIB_PATH=/opt/intel/composerxe/mkl/lib/intel64
> INC_LIB_PATH=/usr/local/lib
> 
> export CC="icc -std=c99"
> export CFLAGS="-g -O3 -wd188 -ip"
> export F77=ifort
> export FFLAGS="-g -O3"
> export CXX=icpc
> export CXXFLAGS="-g -O3"
> export FC=ifort
> export FCFLAGS="-g -O3"
> export SHLIB_CXXLD=icpc
> 
> export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MKL_LIB_PATH}:${INC_LIB_PATH}:${CMP_LIB_PATH}
> export LDFLAGS="-L${MKL_LIB_PATH},-L${INC_LIB_PATH},-L${CMP_LIB_PATH},-Bdirect,--hash-style=both,-Wl,-O1"
> 
> export SHLIB_LDFLAGS="-lpthread"
> export SHLIB_CXXLDFLAGS="-lpthread"
> export MAIN_LDFLAGS="-lpthread"
> 
> MKL="-L${MKL_LIB_PATH} -L${INC_LIB_PATH} -lmkl_lapack95_lp64
> -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread"
> ./configure --prefix=${INSTALL_DIR} --enable-R-shlib
> --with-blas="$MKL" --with-lapack
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 



More information about the R-devel mailing list