Installing OpenBLAS on CentOS / Fedora

In a Java project I am using matrix-toolkits-java (MTJ) for matrix multiplication efficiently. It depends on netlib-java , which in turn relies on an optimized BLAS and LAPACK implementation installed on the machine. He specifically searches /usr/lib64/libblas.so.3

and searches /usr/lib64/liblapack.so.3

for these libraries.

On installation blas

and lapack

through Yum, we get symbolic links /usr/lib64/libblas.so.3

and /usr/lib64/liblapack.so.3

pointing to .so files from links blas

and lapack

installed through Yum.

We now want to use implementations that are faster than referenced ones, in my case OpenBLAS . It doesn't matter if I compile myself or install it via Yum, we end up with /usr/lib64/libopenblas-r0.2.18.so

.

Now, according to any tutorial on the web, I have to replace the symlinks to the referenced implementation with the symlinks to the OpenBLAS implementation, ending up with something like this:

libblas.so.3 -> libopenblas-r0.2.18.so
liblapack.so.3 -> libopenblas-r0.2.18.so

      

Ok I can do it! I can do this with ln

or via alternatives

. And if I do that, my code happily uses the fast OpenBLAS.

However, when ldconfig

my awesome symlinks run, they are overwritten with the BLAS and LAPACK reference settings. And then my software is sad and slow again.

So my question is, how do I install OpenBLAS on CentOS / Fedora in such a way that launching ldconfig

it won't kill it? I cannot remove packages blas

and lapack

as other clients of the host can rely on it. Rather, I would somehow make the OS understand that OpenBLAS is a drop-in alternative for blas

and lapack

.

+3


source to share


2 answers


I don't think this behavior can be avoided without removing the reference implementations. if you need to manually rebuild ld.so.cache you can run ldconfig -X

to avoid refreshes.



other than that you will most likely have to create a custom script to restore symlinks to openblas after ldconfig updates the links

0


source







All Articles