Question: failed to use multiple threads in R via openblas
gravatar for ZoeChing
8 months ago by
ZoeChing0 wrote:

i was trying to make network construction in wgcna packages execute faster. As recommended in the "frequently asked questions" ,  i wanna to compile R with blas library. 

After openblas installation completed, i found the following information in the manual : "Once installed it canbe used by somethinglike --with-blas="-lopenblas" ."   Is that means i have to configure R with this? Because i do not want to re-install R and its libraries,  i checked any blas in R with the command " lsof -p pidID |grep blas ". The feedback is "/usr/lib64/R/lib/". I try to replace the with (with the following commands) to make openblas work for R.  


export LD_LIBRARY_PATH=${HOME}/usr/lib64/openblas/lib\:$LD_LIBRARY_PATH

ln -s /usr/lib64/ /usr/lib64/

ln -s /usr/lib64/ /usr/lib64/R/lib/

lsof -p pidID |grep blas

> R 71713 root mem REG 253,0 33947432 201416627 /usr/lib64/

It seems work. But when i use  "cat /proc/pidID/status|grep Threads" to check the threads, only 1 threads were used in R. 

It seems R calls openblas successfully,  but why only i thread were used in R ? what can i do to use multiple-threads in R with openblas? Do i still need to re-install R?

ADD COMMENTlink modified 8 months ago by Martin Morgan ♦♦ 21k • written 8 months ago by ZoeChing0
gravatar for Martin Morgan
8 months ago by
Martin Morgan ♦♦ 21k
United States
Martin Morgan ♦♦ 21k wrote:

Recompile R configured to use openblas.

ADD COMMENTlink written 8 months ago by Martin Morgan ♦♦ 21k

Hi martin,thx for your reply.

i had re-installed R and configured with --with-blas="-lopenblas . After installation, i executed“./R” from the “bin” directory. "lsof -p pidID |grep blas " reports R is using, but still only 1 thread. 

btw, i have set  export OPENBLAS_NUM_THREADS=8. still confused. Is there anything i have missed ?

tar -zxvf R-3.4.0.tar.gz
cd R-3.4.0/
locate jni.h
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-
./configure --prefix=/usr/lib64/R --enable-R-shlib --with-blas="-lopenblas" --enable-memory-profiling --with-tcltk=no --with-readline=no --with-x=no
make make install
./R CMD ldd exec/./R | grep blas
cat /proc/`ps aux | grep R| awk '{print $2}'`/status | grep Threads



ADD REPLYlink written 7 months ago by ZoeChing0

I don't really have enough experience; probably better to ask on R-sig-hpc (maybe after googling 'R-sig-hpc openblas').

ADD REPLYlink written 7 months ago by Martin Morgan ♦♦ 21k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 271 users visited in the last hour