failed to use multiple threads in R via openblas
1
0
Entering edit mode
RC • 0
@rc-9372
Last seen 4.6 years ago
Beijing

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?

wgcna R openblas blas threads • 2.1k views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 5 days ago
United States

Recompile R configured to use openblas.

ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 945 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6