[Numpy-discussion] site.cfg: Custom BLAS / LAPACK configuration

Bradley M. Froehle brad.froehle at gmail.com
Fri Nov 30 15:13:58 EST 2012

I recently installed NumPy 1.6.2 on a new computer and wanted to use ACML
as the BLAS/LAPACK library.  [I'm aware that ACML doesn't provide CBLAS,
but that is easy to work around by compiling it yourself to produce
libcblas.a or libcblas.so].

I experienced a great bit of difficulty in getting NumPy to use ACML
(-lcblas -lacml), primarily stemming from the fact that there was a working
ATLAS installation already in /usr/lib64.

As far as I can tell, it's IMPOSSIBLE to create a site.cfg which will link
to ACML when a system installed ATLAS is present.

The detection routine for blas_opt (and similarly for lapack_opt) seem to
operate as:
* Is MKL present?  If so, use it.
* Is ATLAS present? If so, use it.
* Use [blas] section from site.cfg.

Instead I would have expected the detection routine to be more like:
* Is [blas_opt] present in site.cfg? If so, use it.
* Is MKL present? ...
* Is ATLAS present? ...
* Use [blas] section from site.cfg.

This is not just a problem with ACML.  I've also experienced this when
using NumPy on some cray supercomputers where the default C compiler
automatically links a preferred BLAS/LAPACK.

I created a GitHub issue for this:
https://github.com/numpy/numpy/issues/2728.  In addition, I created a pull
request with a "works for me" solution, but which should have needs some
wider visibility https://github.com/numpy/numpy/pull/2751.

I'd appreciate any reviews, workarounds, or other general feedback.  If you
want to test our the library detection mechanism you can run the following
from within the NumPy source directory::

    import __builtin__ as builtins
    builtins.__NUMPY_SETUP__ = True
    import numpy.distutils.system_info as si
    print si.get_info('blas_opt')

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20121130/dfc759bb/attachment.html>

More information about the NumPy-Discussion mailing list