Skip to content

Instantly share code, notes, and snippets.

@bmmalone
Last active January 19, 2023 06:20
Show Gist options
  • Save bmmalone/1b5f9ff72754c7d4b313c0b044c42684 to your computer and use it in GitHub Desktop.
Save bmmalone/1b5f9ff72754c7d4b313c0b044c42684 to your computer and use it in GitHub Desktop.
Install OpenBLAS and add it to the path
### Lines to add to .bashrc
# for the OpenBLAS library
export LD_LIBRARY_PATH=/path/to/OpenBLAS:$LD_LIBRARY_PATH
export BLAS=/path/to/libopenblas.a
export ATLAS=/path/to/libopenblas.a
# download the OpenBLAS source
git clone https://github.com/xianyi/OpenBLAS
# compile the library
cd OpenBLAS && make FC=gfortran
@bmmalone
Copy link
Author

The OpenBLAS library is used for efficiency. This library is installed by default on many versions of Unix. It is also available through many standard package managers. For example:

  • Ubuntu: sudo apt-get install libopenblas-dev
  • CentOS: sudo yum install openblas-devel

If the use of package managers are not an option (for example, because they require root access) or just not desired, then OpenBLAS can be installed locally. The following instructions have been tested extensively on Ubuntu, but they may require modification for other distributions.

For OSX, a custom installation of numpy linking against the OpenBLAS library is required. We do not officially support this, but example documentation is available elsewhere on the web.

N.B. In principle, any BLAS and ATLAS library, such as Intel's Math Kernel Library, can be used. This has not been tested and is not supported, though.

@rahmahi
Copy link

rahmahi commented Sep 28, 2020

what is the "/path/to/" means and how should I define it. How "/path/to/" related to OpenBLAS directory?

@bmmalone
Copy link
Author

bmmalone commented Oct 5, 2020

@rahmahi: /path/to just means the absolute path the respective libraries and folders. So, for example, something like: export BLAS=/home/bmmalone/local/lib/libopenblas.a

@nagarjunvinukonda
Copy link

nagarjunvinukonda commented Oct 29, 2020

Hello,
I am using ubuntu 18.0.4, if I installed Openblas using sudo apt-get install libopenblas-dev command. Does that mean it is not necessary to install again Openblas using git clone https://github.com/xianyi/OpenBLAS ? If not, what's the difference between those two packages.

@bmmalone
Copy link
Author

bmmalone commented Oct 29, 2020

Hey @nagarjunvinukonda: The versions are probably about the same; sometimes, the versions in the apt-get repositories are a little behind the version in the main repository.

The main difference is that using sudo requires, well, sudo/root access, while installing via the script can be done without root access. Thus, if you are in a computing environment where you don't have root access, sudo isn't possible.

It's also a little easier if you need to install multiple versions of openblas for some reason (since the location of the versions is controlled explicitly, while the location of files from apt-get can be difficult to track).

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