-
Notifications
You must be signed in to change notification settings - Fork 34
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
Hopefully fixes builds on 3.12. #70
Conversation
Turns out extra numpy.distutils.get_info args were superflous, at least for plain builds.
Thanks for doing this Enzo! Does this still pick up the right blas / lapack libraries to link against? |
No :( I had a bug in my local compilation; I also tried to copy-paste the output of sys.info under python 3.11 and use it in python 3.12 but it didn't work. I suspect it's better to just rewrite the whole thing. (On another note, I noticed that the MacOS pypi package of scs was slower than the one I compiled on the test suite, so maybe the linkage was broken already.)On 7 Oct 2023, at 17:36, bodono ***@***.***> wrote:
Reopened #70.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
Confirmed, linking was broken already. On python 3.11, clean environment.
gives:
While if I compile from source (inside
gives
on Mac amd64. |
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.
Looks pretty close already
meson.build
Outdated
''' | ||
], | ||
check: true | ||
).stdout().strip() |
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.
This is the one annoying thing you have to do indeed - I will get around to replacing all this with a simple dependency('numpy')
at some point.
For now, I'd recommend to include the relpath
bit from SciPy: https://github.com/scipy/scipy/blob/166e1f2b1ea0a1a2c3d7b030bd829549f8a5844a/scipy/meson.build#L54-L57
That will ensure things work fine with an in-tree virtual environment (so numpy
is inside your source tree from Meson's perspective).
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.
Ok, I guess fixed (there are more try/except there that I don't understand).
Yes I also noticed that SCS was much slower from pip than when compiling locally, but I haven't had the bandwidth to investigate it unfortunately! |
I'm just working on BLAS/LAPACK improvements in NumPy, so I can propose something. Rather than make it complicated now with 64-bit integer support (which seems incomplete?), the new Accelerate version for macOS >=13.3 (see note here), etc., maybe do only the basic setup first. Once NumPy has shipped the fancy version (auto-detect every option, full ILP64, switches for order of preference of known libraries, etc.) it can then be updated to mirror NumPy. Sounds like you want regular 32-bit Accelerate on macOS preferably? And OpenBLAS or MKL elsewhere? |
You are missing a |
That would be great, and I guess it can be done by if/else on
Thoughts? And thanks!! |
I just tried
You probably don't have pkg-config installed? What's happening is that for |
The better way to control this is via the `-Dbuildtype=` Meson build option. The default for meson-python is `release`, which means debug=False, optimization=3
@bodono : status. Blas is linked statically when building on github CI (via a meson option passed to the command line). Still no luck for windows, but I think we're super close. If someone has a windows development machine they can probably fix it easily, see lines 20-31 of
|
Amazing work @enzbus ! Thanks again for doing this, drinks on me next time you're in London! |
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.
Great work! This looks quite good to me - just one comment to help users a bit more when they are building from source and something goes wrong in BLAS detection.
meson.build
Outdated
endif | ||
|
||
# We find anaconda blas on windows for github CI | ||
if not blas_deps[0].found() |
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.
This is specific to the CI setup for building Windows wheels, and won't work in case users attempt to build from source on Windows for some reason. That may or may not matter to you, but it's probably appropriate to at least emit a warning with message("explain-that-blas-wasn't-found-and-this-is-for-CI-only")
here?
Also, you may want to change this line to
if host_machine.system() == 'windows' and not blas_deps[0].found()
....
else
error('OpenBLAS or Netlib BLAS/CBLAS is required on all platforms except Windows, and was not found.')
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.
OK, I'm thinking of refactoring it: passing anaconda lib folder location as a meson option in the CI file, so the meson.build
is not tailored for the compilation process on github.
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.
That makes sense to me. You can do it as a CLI option, or you can craft an openblas.pc
file which points to the right paths in a CI job and then add the directory of that .pc
file to PKG_CONFIG_PATH
. For the latter approach, see http://scipy.github.io/devdocs/building/blas_lapack.html#using-pkg-config-to-detect-libraries-in-a-nonstandard-location.
meson.build
Outdated
error('Missing the `scs_source` submodule! Run `git submodule update --init` to fix this.') | ||
endif | ||
|
||
# This uses the path as is, and avoids running the interpreter. |
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.
Minor: this comment is a left-over and doesn't apply, so best to clean it up.
meson.build
Outdated
c_args = cc.get_supported_arguments('-Wno-unused-result') | ||
|
||
# meson doesn't support wildcards | ||
# https://mesonbuild.com/FAQ.html#why-cant-i-specify-target-files-with-a-wildcard |
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.
Probably can be cleaned up as well now?
It looks like the github runners are no longer able to schedule on macos-10.15, I think we can change that to macos-latest, which should schedule easier and hopefully run successfully now. I can do it in a PR that you can merge, or you can do it here if you prefer. |
OK, that explains why the MacOS jobs weren't running. As you prefer, I have limited time but would like to clean it a bit (it doesn't seem urgent, nobody replied on cvxpy/cvxpy#2269 ). Ideally we can also migrate the optional builds (openmp, cuda) to meson and reduce the size of the github yaml file. (We only need conda for installing openblas on windows, etc.) Just a note, meson doesn't support python <= 3.7, so if we eliminate the old setup.py we'll have to drop python 3.7 (but the wheels and source dists will remain on PyPI). |
In practice that makes it harder to do Python 3.5-3.6, but not impossible. Meson by design does not depend on it being implemented in Python, it has its own DSL and you invoke it via a That said, |
…s that were there originally
All checks have passed! I will merge as soon as you let me know it's ready @enzbus . |
Ok, @bodono, I approve too. Please go on and merge, hopefully there won't be issues when the final build and upload is triggered. |
Turns out extra
numpy.distutils.get_info
args were superflous, at least for plain builds.