Skip to content

Commit

Permalink
Merge pull request numpy#13132 from zerothi/linalg-order
Browse files Browse the repository at this point in the history
BLD: Allow users to specify BLAS and LAPACK library link order
  • Loading branch information
rgommers authored May 1, 2019
2 parents e341a7f + 995665e commit 0f19dae
Show file tree
Hide file tree
Showing 3 changed files with 258 additions and 108 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ matrix:
- python: 3.6
env:
- PYTHONOPTIMIZE=2
- BLAS=None
- LAPACK=None
- ATLAS=None
- NPY_BLAS_ORDER=mkl,blis,openblas,atlas,accelerate,blas
- NPY_LAPACK_ORDER=MKL,OPENBLAS,ATLAS,ACCELERATE,LAPACK
- USE_ASV=1
- python: 3.5
dist: trusty # remove after April 2019
Expand Down
60 changes: 59 additions & 1 deletion doc/source/user/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,70 @@ means that g77 has been used. If libgfortran.so is a dependency, gfortran
has been used. If both are dependencies, this means both have been used, which
is almost always a very bad idea.

Accelerated BLAS/LAPACK libraries
---------------------------------

NumPy searches for optimized linear algebra libraries such as BLAS and LAPACK.
There are specific orders for searching these libraries, as described below.

BLAS
~~~~

The default order for the libraries are:

1. MKL
2. BLIS
3. OpenBLAS
4. ATLAS
5. Accelerate (MacOS)
6. BLAS (NetLIB)


If you wish to build against OpenBLAS but you also have BLIS available one
may predefine the order of searching via the environment variable
``NPY_BLAS_ORDER`` which is a comma-separated list of the above names which
is used to determine what to search for, for instance::

NPY_BLAS_ORDER=ATLAS,blis,openblas,MKL python setup.py build

will prefer to use ATLAS, then BLIS, then OpenBLAS and as a last resort MKL.
If neither of these exists the build will fail (names are compared
lower case).

LAPACK
~~~~~~

The default order for the libraries are:

1. MKL
2. OpenBLAS
3. ATLAS
4. Accelerate (MacOS)
5. LAPACK (NetLIB)


If you wish to build against OpenBLAS but you also have MKL available one
may predefine the order of searching via the environment variable
``NPY_LAPACK_ORDER`` which is a comma-separated list of the above names,
for instance::

NPY_LAPACK_ORDER=ATLAS,openblas,MKL python setup.py build

will prefer to use ATLAS, then OpenBLAS and as a last resort MKL.
If neither of these exists the build will fail (names are compared
lower case).


Disabling ATLAS and other accelerated libraries
-----------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Usage of ATLAS and other accelerated libraries in NumPy can be disabled
via::

NPY_BLAS_ORDER= NPY_LAPACK_ORDER= python setup.py build

or::

BLAS=None LAPACK=None ATLAS=None python setup.py build


Expand Down
Loading

0 comments on commit 0f19dae

Please sign in to comment.