Skip to content

Compile Spark with Native BLAS LAPACK Support

Jencir Lee edited this page May 17, 2017 · 2 revisions

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:

  1. 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
  2. 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.

  3. Set up symbolic links for the libblas.so.3 and liblapack.so.3 that netlib4java will look for. For example, with ATLAS, first check if liblapack.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.

Clone this wiki locally