-
Notifications
You must be signed in to change notification settings - Fork 6
Compile Spark with Native BLAS LAPACK Support
As the default build of Spark doesn't include native BLAS/LAPACK support, we'd see "WARN BLAS" and "WARN LAPACK" in the output messages of our code. We could follow the procedure below to include native BLAS/LAPACK support:
-
first build Spark with the option
-Pnetlib-lgpl
http://apache-spark-user-list.1001560.n3.nabble.com/Mllib-native-netlib-java-OpenBLAS-td19662.html.build/mvn -Pyarn -Phadoop-2.7 -Pnetlib-lgpl -DskipTests clean package
or
dev/make-distribution.sh -Pyarn -Phadoop-2.7 -Pnetlib-lgpl -DskipTests
-
Make sure a native BLAS/LAPACK library is available on the system. On macOS, Accelerate is built-in; on Linux, we could use ATLAS, OpenBLAS.
-
Set up symbolic links for the
libblas.so.3
andliblapack.so.3
thatnetlib4java
will look for. For example, with ATLAS, first check ifliblapack.so
is configured to link to any lib,sudo update-alternatives --display liblapack.so
If not, do
sudo update-alternatives --install /usr/lib64/libblas.so libblas.so /usr/lib64/atlas/libtatlas.so.3 1000 sudo update-alternatives --install /usr/lib64/libblas.so.3 libblas.so.3 /usr/lib64/atlas/libtatlas.so.3 1000 sudo update-alternatives --install /usr/lib64/liblapack.so liblapack.so /usr/lib64/atlas/libtatlas.so.3 1000 sudo update-alternatives --install /usr/lib64/liblapack.so.3 liblapack.so.3 /usr/lib64/atlas/libtatlas.so.3 1000
Now if we run the code again, any "WARN BLAS" or "WARN LAPACK" messages should have disappeared.