-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add support for BLAS and LAPACK dependencies (continued) #14773
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
base: master
Are you sure you want to change the base?
Conversation
c2a41f4 to
08bec81
Compare
dcbaker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't take too close of a look, but just a few modernization things and type annotation things.
|
Thanks for your comments. To be honest, I haven't gotten to cleaning up / modernizing the code yet — so far my main focus was getting it to work correctly :-). But pushed the suggested fixes now. |
bfa9c78 to
c4f4671
Compare
|
Okay, I think this is ready for review. FWIU the "linux" test failures are due to the test images not being updated — and the Ubuntu image failure is flakiness of the zig version check. |
| keyword, with possible values: | ||
|
|
||
| - `'interface: lp64'` (default) or `'interface: ilp64'`: to select the default | ||
| integer size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why you did this, but it's conceptually not really correct. An "interface" is not really a module. Could we have some other way of expressing this information that is more explicit about what it does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a specific suggestion? From the discussion on #10921 I got the impression that it's a good enough compromise. Eli was rather opposed to adding new keyword arguments to dependency() over this, and the only clean alternative I can think of is creating a whole new module for this — and I'm not really convinced it's worth the effort. There's also the option of duplicating dependencies and having a ton of openblas-lp64, openblas-ilp64, mkl-lp64-iomp and so on — but I'm not convinced this will actually be cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking this too. CPS has the concept of "configurations" but I'm not really sure that this is a configuration either. We have a meeting tomorrow, I will bring this up with them and see what they think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory you could do something like:
blas_dep = dependency('blas',
modules: [...],
configuration: {'interface': 'ilp64'})
But we'd need to properly review that to make sure it works in all (or at least most) use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another big question is whether they provide different pkg-config names. That is, if there is both an openblas and openblas-ilp64 already, then using those names makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to use fake module arguments to pass additional properties to use for dependency selection is to avoid adding more keyword arguments to the dependency() function. IIUC the main reason for not adding more keyword arguments is that it sucks to have a generic function to allow arguments that apply only to a limited subset of cases.
The possible way out is to allow a Python's kwargs-style signature where the dependency() function forwards additional arguments to the concrete implementation of the dependency finding classes. IIUC kwargs-style arguments are not desired in the Meson language. However, using fake modules strings to pass arbitrary arguments effectively implements kwarg-style arguments circumventing the language limitations. It has all the drawbacks of allowing kwarg-style arguments plus all the drawbacks of having to implement parsing and error reporting in the implementation of the concrete dependency implementation.
If adding kwarg-style arguments to the Meson language is really not going to happen, maybe we should add to the dependency() function a properties arguments that takes a dictionary:
blas_dep = dependency('blas', properties: {'threading': true, 'interface': 'ilp64'})
gtest_dep = dependency('gtest', properties: {'bazel': false, 'main': true})
boost_dep = dependency('boost', modules: ['foo', 'bar'], properties: {'threading': true})There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, something accepting a dictionary would definitely be preferable for me over a list with custom key-value syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the example above is mixing "configurations" and "modules"/"components". I would say the gtest "main" example is a module/component, because it's an extra piece added to the core of gtest. boost with threading is a configuration, since you can have single- or multi- threaded implementations of a given module/component. configurations likely need to be a mapping or an array, because you'll likely want to be able to give a tri-state to the configuration like a UserFeature option does, "must have", "can have", "must not have".
dependencies(
'boost',
modules : ['foo', 'bar'],
configurations : {'debug': get_option('debug'), 'threading': true, 'asan': false}
)I wish I'd gotten around to dealing with CPS stuff sooner, because I think it would help with this particular issue to have all of that work done :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say the gtest "main" example is a module/component, because it's an extra piece added to the core of gtest.
Agreed.
boost with threading is a configuration, since you can have single- or multi- threaded implementations of a given module/component.
I used the name properties instead of configuration (and I like configuration much more) but I didn't use a module for threading, thus I'm not sure I understand this objection.
configurations likely need to be a mapping or an array, because you'll likely want to be able to give a tri-state to the configuration like a
UserFeatureoption does, "must have", "can have", "must not have".
Sure. I didn't specify which values can be associated to configuration keys. I guess for some of them a tri-state makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish I'd gotten around to dealing with CPS stuff sooner, because I think it would help with this particular issue to have all of that work done :/
Would you mind opening an issue that tracks all the the CPS-related stuff? I've looked around in the repo but couldn't find anything. I could open an issue myself, but it's not likely to be of high quality (though of course you could then edit it as you see fit), because I don't know this effort well. Let me know if for whatever reason you'd still like me to do that.
|
Open question: Fedora has OpenBLAS threading variants, and no pkg-config files, i.e. they have 9 OpenBLAS libraries — 3 interface variants (LP64, ILP64 without suffix, ILP64 with suffix) times 3 threading variants (sequential, threaded, OpenMP). Do we want to try to support this? It would imply adding |
|
boost already has a edit: Which the interpreter does not allow for... |
|
Do we agree on going with the current design then? What next steps should I take here? (the CI workflows are failing because they're running on old images) |
c4f4671 to
fb2c828
Compare
|
Some more thoughts based on further research I've done in the meantime:
|
|
Thanks for pushing on this @mgorny. Here are my thoughts on your ideas above:
The asymmetry is annoying, but it reflects what's out there in the real world so I can't say it bothers me too much. Also, sometimes plain
Agreed, the latter. I don't think it's necessary (nor very easy) to try and distinguish between such wrappers and Netlib libraries.
There are use cases for both. I think if there'd be a "reject a library with un-suffixed symbol names", it would have to be opt-in for backwards compatibility reasons. As well as for some "build from source and use directly" type use cases; it's probably the more common thing to do for C/Fortran end users, since dealing with symbol prefixes/suffixes can be a fair amount of work. Library authors have incentive to do that work, but scientific end users typically do not.
Possibly worth it. It's a fairly minor convenience though, and can always be done later if someone wants that. If we see patterns like That said, I suspect we'd more need a higher-level "do it all automatically" rather than having other MKL/etc.-specific options.
What Fedora is doing is a bit questionable, so I'm not sure how much effort to spend to work around that. What Fedora (well, one stubborn packager, not his colleagues) wants you to do is use FlexiBLAS rather than OpenBLAS. So may as well rely on that rather than more
+1 this seems important. I think the only reason it wasn't there is because I started working on all this before we had FlexiBLAS support in SciPy and before FlexiBLAS itself had ILP64 support with symbol suffixes (IIRC that only landed sometime last year). |
I might have tested wrong but from my short experiments, it still doesn't support ILP64 with symbol suffixes. |
You are correct, I remembered wrong. The tracking issue is mpimd-csc/flexiblas#12. It was unblocked last year by Reference-LAPACK/lapack#666 being completed, but the implementation is still TODO. |
|
great to see this work! What are the prospects for rgommers/pixi-dev-scipystack#41 in light of this? Are we any closer to figuring out why something seems "off" with the conda-forge distributions, rgommers/pixi-dev-scipystack#23 (comment) ? |
|
That's unrelated to Meson (beyond the fact that having the feature in this PR will help a little), so I would keep that discussion at rgommers/pixi-dev-scipystack#41 to not distract the Meson maintainers with it. |
c4ce43e to
71cacc5
Compare
|
Sorry, I keep rewriting the dependency code out from under you on this :/ |
|
No problem, so far the changes were easy to follow. |
Signed-off-by: Michał Górny <[email protected]>
Signed-off-by: Michał Górny <[email protected]>
Signed-off-by: Michał Górny <[email protected]>
Signed-off-by: Michał Górny <[email protected]>
Signed-off-by: Michał Górny <[email protected]>
Signed-off-by: Michał Górny <[email protected]>
35b6907 to
f4a3645
Compare
|
Rebased. |
Signed-off-by: Michał Górny <[email protected]>
This a rebase / continuation of #10921.
So far just gotten it to work again, will look through the previous review next.