Search
Question: failed to use multiple threads in R via openblas
0
gravatar for ZoeChing
5 months ago by
ZoeChing0
Beijing
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/libRblas.so". I try to replace the libRblas.so/libblas.so with libopenblas-r0.2.19.so (with the following commands) to make openblas work for R.  

export OPENBLAS_NUM_THREADS=8

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

ln -s /usr/lib64/libopenblas-r0.2.19.so /usr/lib64/libblas.so

ln -s /usr/lib64/libopenblas-r0.2.19.so /usr/lib64/R/lib/libblas.so

lsof -p pidID |grep blas

> R 71713 root mem REG 253,0 33947432 201416627 /usr/lib64/libopenblas-r0.2.19.so

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 5 months ago by Martin Morgan ♦♦ 20k • written 5 months ago by ZoeChing0
0
gravatar for Martin Morgan
5 months ago by
Martin Morgan ♦♦ 20k
United States
Martin Morgan ♦♦ 20k wrote:

Recompile R configured to use openblas.

ADD COMMENTlink written 5 months ago by Martin Morgan ♦♦ 20k

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 libopenblas-r0.2.19.so, 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-1.7.0.111-2.6.7.2.el7_2.x86_64/
./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 5 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 5 months ago by Martin Morgan ♦♦ 20k
Please log in to add an answer.

Help
Access

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