SHARE
TWEET

OpenBLAS installation for Ubuntu 15.10

a guest Nov 14th, 2015 770 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Gets the necessary dependencies, compiles OpenBLAS from the latest source
  3. # and perfirms necessary configuration on Ubuntu 15.10
  4. # Tested on Ubuntu Mate 15.10
  5. # author: --wiku--
  6.  
  7. # script should fail if any of below commands fails
  8. set -e
  9.  
  10. # Update package index, install git, gfortran and necessary build tols
  11. sudo apt-get -y update
  12. sudo apt-get -y install git build-essential gfortran
  13.  
  14. # Get the latest OpenBLAS source
  15. git clone https://github.com/xianyi/OpenBLAS.git
  16.  
  17. # Make and install OpenBLAS in /opt/OpenBLAS
  18. cd OpenBLAS
  19. sudo make FC=gfortran
  20. sudo make PREFIX=/opt/OpenBLAS install
  21.  
  22. # Use update-alternatives to let the OS know the new BLAS library
  23. sudo update-alternatives --install "/usr/lib/libblas.so" libblas.so /opt/OpenBLAS/lib/libopenblas.so 500
  24. sudo update-alternatives --install "/usr/lib/libblas.so.3" libblas.so.3 /opt/OpenBLAS/lib/libopenblas.so 500
  25.  
  26. # Same trick for liblapack (link to openblas lib)
  27. sudo update-alternatives --install "/usr/lib/liblapack.so" liblapack.so /opt/OpenBLAS/lib/libopenblas.so 500
  28. sudo update-alternatives --install "/usr/lib/liblapack.so.3" liblapack.so.3 /opt/OpenBLAS/lib/libopenblas.so 500
  29.  
  30. # Use update-alternatives to set OpenBLAS as default system BLAS
  31. sudo update-alternatives --set libblas.so /opt/OpenBLAS/lib/libopenblas.so
  32. sudo update-alternatives --set libblas.so.3 /opt/OpenBLAS/lib/libopenblas.so
  33. sudo update-alternatives --set liblapack.so /opt/OpenBLAS/lib/libopenblas.so
  34. sudo update-alternatives --set liblapack.so.3 /opt/OpenBLAS/lib/libopenblas.so
  35.  
  36. echo "OpenBLAS installed successfully"
RAW Paste Data
Want to get better at Bash?
Learn to code Bash in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top