Skip to content

Instantly share code, notes, and snippets.

@dusenberrymw
Last active October 11, 2018 11:34
Show Gist options
  • Save dusenberrymw/d24fcefcd245cfacbc60d3b4caccc560 to your computer and use it in GitHub Desktop.
Save dusenberrymw/d24fcefcd245cfacbc60d3b4caccc560 to your computer and use it in GitHub Desktop.
Install OpenBLAS for use with Spark.
  • Install OpenBLAS
    • yum install libgfortran

    • Note: OpenBLAS contains both BLAS and LAPACK routines. So in the end, we can create softlinks for the standard BLAS and LAPACK shared library locations.

    • Download from Github: https://github.com/xianyi/OpenBLAS

    • make

    • make install

    • Create links:

      ln -sf /opt/OpenBLAS/lib/libopenblas.so /opt/OpenBLAS/lib/libblas.so
      ln -sf /opt/OpenBLAS/lib/libopenblas.so /opt/OpenBLAS/lib/libblas.so.3
      ln -sf /opt/OpenBLAS/lib/libopenblas.so /opt/OpenBLAS/lib/liblapack.so
      ln -sf /opt/OpenBLAS/lib/libopenblas.so /opt/OpenBLAS/lib/liblapack.so.3
      ln -sf /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/libblas.so
      ln -sf /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/libblas.so.3
      ln -sf /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/liblapack.so
      ln -sf /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/liblapack.so.3
      
    • Test if setup properly:

      • ./bin/spark-shell

        import com.github.fommil.netlib.BLAS
        println(BLAS.getInstance().getClass().getName())
        
      • Should output com.github.fommil.netlib.NativeSystemBLAS.

      • ps aux | grep spark

      • Grab PID of actual java process for Spark

      • lsof -p PID | grep 'blas'

      • Should be pointing to OpenBLAS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment