New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve BLAS/LAPACK support: dependency detection, UX, and ILP64 #17244
Comments
|
As I said here, adding So this covers the point of detecting "any supported BLAS/LAPACK library via CMake as a fallback". |
|
@Enchufa2 thanks for testing that on Fedora and suggesting this improvement. I believe it works with Flexiblas - and with Netlib BLAS and ATLAS. But it will not work with at least MKL and Accelerate. MKL uses the g77 ABI rather than gfortran one, so it will lead to segfaults if we're blindly building against it without enabling our ABI wrappers for cdotc & co. Accelerate is completely unsupported, so we need to reject it. I wish it was as simple as adding the above two-liner to add support for any BLAS library across platforms and packaging systems, but I'm pretty sure we cannot get away with that. EDIT: to clarify - it will work with "MKL via Flexiblas" (because Flexiblas has basically the same ABI wrappers as we have), but it will not work with MKL directly. And when just saying "give me any BLAS" we have no guarantee that we won't get MKL directly. And I'd say that getting MKL directly is a lot more likely than getting Flexiblas. |
|
But the method is not really blind, is it? Unless I'm missing something, you are already checking the name of the one detected here: Line 141 in a637553
|
I'd need to test, but I expect that if Meson asks CMake for To verify we're actually using CMake, remove only I think it'll require custom support (like what I'm in the process of implementing) in Meson for this to return the name of the particular BLAS library that CMake detects. |
|
Then this is just a lack of support in Meson, because FindBLAS does return all the information about the library found, so it should be straightforward to expose it. |
I suspect it may be by design that the name is the one you asked for. Not many dependencies work like BLAS, which is kind of a virtual dependency which can have multiple implementations. I think it'll require a |
I'm reading /usr/share/cmake/Modules/FindBLAS.cmake and I don't see anywhere whatsoever that it returns that information. It provides a variable describing the list of library filenames to link to -- it does not tell you anything about which |
|
It gets you the linker flags without the |
|
So what do you do with that information? Hand-rolled regex matches against linker flags inside CMakeLists.txt? |
Is there any reason not to run I also see the documentation mention:
I find this suggestion confusing, because from my uninformed point of view this seems to be an anti-pattern. Background: I've just spent some measly half an hour trying to figure out why |
|
@SomeoneSerge re |
|
@rgommers oh, I didn't make myself quite clear. What worked in my case is the following sequence: $ meson setup build/ ... -Dblas=mkl -Dlapack=mkl
$ python -m pip wheel --config-settings builddir=build --verbose --no-index --no-build-isolation --no-clean --no-deps --wheel-dir dist .
$ python -m pip install ./*.whl ...The How would you feel about including that in the documentation? |
It doesn't actually work reliably. The right way is documented at http://scipy.github.io/devdocs/dev/contributor/meson_advanced.html#select-a-different-blas-or-lapack-library. I'm rewriting the docs to make that info easier to find. |
|
Interesting. I read the page, but I'm still unsure what exactly can go wrong when using Could you elaborate on your reliability concerns? And regarding -m build, is there a way to make it respect the existing build/? Although I'm not asking because it's too hard to pass meson flags to -m build, but merely because this feels backwards Thank you! |
Since meson-python 0.13.0, it will add
There is no way to do this, it is not supported. And there's no reason left I can think of to reuse a previously configured builds and the behavior would be ambiguous in some cases, so I think the "just don't do that" verdict is final. |
This is an issue to keep track of and break down and plan the work for making the BLAS and LAPACK dependency detection as robust and easy to use as possible.
The related items in gh-16293 are:
pkg-config): Feature: MKL dependency mesonbuild/meson#2835numpy.distutilsbased CI job, and not supported yet in the Meson-based build.Let's break this down more. Here is what I think we need:
pkg-confignative-file.iniorcross-file.ini.pip/buildinstead of having to invokemeson setupseparately: Passing through project-specific config options mesonbuild/meson-python#54NPY_LAPACK_ORDER) in an ini filepip/build/ini-fileA bunch of these things are in progress already at mesonbuild/meson#10921.
The text was updated successfully, but these errors were encountered: