[Numpy-discussion] NumPy's BLAS library on macOS?

Ralf Gommers ralf.gommers at gmail.com
Fri Jul 9 05:20:16 EDT 2021


On Thu, Jul 8, 2021 at 11:47 PM Jerry Morrison <
jerry.morrison+numpy at gmail.com> wrote:

>
> On Wed, Jul 7, 2021 at 10:14 PM Matti Picus <matti.picus at gmail.com> wrote:
>
>>
>> On 8/7/21 2:23 am, Jerry Morrison wrote:
>> > Got it!
>> >
>> > *Summary:*
>> > * Installing a numpy wheel (e.g. `pip install numpy==1.21.0`) uses its
>> > embedded OpenBLAS on every platform that has a wheel.
>> >   That OpenBLAS is always compiled with gcc/gfortran.
>> >   In this case, `np.show_config()` reports `library_dirs =
>> > ['/usr/local/lib']` even though there's no libblas in that directory.
>> >
>> > * Installing numpy from source (e.g. `pip install numpy==1.21.0
>> > --no-binary numpy)` looks for BLAS & LAPACK libraries at build time as
>> > influenced by the environment vars NPY_BLAS_ORDER/NPY_LAPACK_ORDER or
>> > by the file ~/.numpy-site.cfg.
>> >   On macOS, 'accelerate' is in the default search order after
>> 'openblas'.
>> >   On macOS < 11.3, importing numpy that's linked to Accelerate will
>> > detect an Accelerate bug and raise a RuntimeError.
>>
>>
>> That seems correct, although admittedly show_config could do a better
>> job. The problem is that not every BLAS implementation provides a
>> convenient method to self-report.
>>
>
> For implementations that don't self-report, could show_config detect that
> it's using embedded OpenBLAS or a system Accelerate library?
>

It's not about "self reporting". What `show_config` shows for BLAS/LAPACK
is the build time configuration, not the one at runtime. The paths are
present in `numpy/__config.py__`, which is a file generated by the build
process.

>
>
>>
>> It might be nice to document all this somewhere more permanent, the
>> docstring for show_config might be a good place to start.
>>
>
> Agreed. On the https://numpy.org/install/ installation page?
> Do you want a PR? (How to get the translations?)
>

Thanks, a PR would be nice. It's too detailed for the website; Matti's
suggestion was in the docstring of `show_config`, which is defined at
https://github.com/numpy/numpy/blob/main/numpy/distutils/misc_util.py#L2332

Cheers,
Ralf



> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/numpy-discussion/attachments/20210709/91339e25/attachment.html>


More information about the NumPy-Discussion mailing list