luhenry / netlib

An high-performance, hardware-accelerated implementation of Netlib in Java
Other
60 stars 12 forks source link

Which native lib path the JNIBLAS use by default ? #11

Closed WeichenXu123 closed 2 years ago

WeichenXu123 commented 2 years ago

On my Ubuntu OS (version 20.04.4 LTS (Focal Fossa))

I have 2 different libblas.so files, one in /usr/lib/libblas.so.3 another in /usr/lib/x86_64-linux-gnu/libblas.so.3

I found the dev.ludovic.netlib.NativeBLAS will load /usr/lib/x86_64-linux-gnu/libblas.so.3, but when I run System.out.println(System.getProperty("java.library.path")), I got: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni

It shows the /usr/lib is prior to /usr/lib/x86_64-linux-gnu, then I don't understand why dev.ludovic.netlib.NativeBLAS load from /usr/lib/x86_64-linux-gnu path by default.

WeichenXu123 commented 2 years ago

@luhenry Could you help explain ? Thank you!

luhenry commented 2 years ago

That behavior is from the JVM, and netlib does nothing specific to try to load the library from a different order.

If you want to be specific on which library to load exactly, you can set -Ddev.ludovic.netlib.blas.nativeLibPath=/usr/lib/x86_64-linux-gnu/libblas.so.3