On 10/28/20 7:46 AM, Stuart Henderson wrote:
+cc some people who might be interested to make sure they see this :)

On 2020/10/28 07:32, Aisha Tammy wrote:
Hi,
I was wondering if it is possible to have multiple providers for a library
and then selecting one of them to be used, selecting which provider is
to be installed.
Case in point, we have the math/{lapack,blas} libraries, which are the
reference implementations and not optimized.
I am working on getting OpenBLAS built and ported, which can also
provide the libblas.so and liblapack.so (among other libraries).
It is ABI compatible with the latest BLAS/LAPACK standards so it should
ideally be a drop in replacement for the libraries for math/{lapack,blas}.
This way there is a significant runtime benefit for multiple science
libraries like numpy, scipy, eigen and a bunch of others.
This replacement mechanism is provided in Gentoo and Debian (and its
derivatives).
I don't think we can have the full replacement mechanism at runtime
due to the linking mechanism being different but it should at least
be possible during install time and relinking libraries.
I am not sure how to go about doing this in OpenBSD.

Is there any interest in doing this? I am hoping I can put something
together if people are interested in wanting OpenBLAS based libraries

Cheers,
Aisha

Having alternatives like this is similar to the case where a library has
flavours, which certainly adds complication - we mostly resist doing this
in ports, the exception is apr-util's ldap flavour and I wouldn't really
want to add more.

Is there likely to be a downside to switching outright to OpenBLAS?

Theoretically no, as it is supposed to be ABI compatible.
Reality is often disappointing.
The reference implementations focus on correctness while
OpenBLAS implementation focuses on speed.
So it is *possible* that there may be bugs in the OpenBLAS
based libraries (not saying that reference impl is perfect).

I agree that this will complicate things.
There are like 4 different providers of BLAS/LAPACK that I am
maintaining in Gentoo. I do not want to add all of them in
OpenBSD, OpenBLAS is by far the superior alternative to the
other 3.
The general method for development: write code using BLAS,
test with reference impl, then use in production with OpenBLAS.

One way in which I think this can be simplified:
Combine math/BLAS and math/LAPACK into one package - math/LAPACK
which can supply both libraries. Almost every package which needs
BLAS also needs LAPACK, so there is little configurability that
we lose here.
Then there can be two flavors math/LAPACK-reference and
math/LAPACK-openblas.
More fixes I want to add - add LAPACKE library as well.
For some reason, we don't seem to be building that one.

Best,
Aisha

Reply via email to