GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — ENH: start to use OpenBLAS from a wheel by mattip · Pull Request #24749 · numpy/numpy Conversation
|
| There are two variants of the wheel, where possible we reccomend using the | ||
| one with 64-bit integer interfaces, which allow for larger arrays:: | ||
|
|
||
| pip install scipy-openblas64 spin |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Use of spin does not belong on this page, that should appear only on the pages aimed at contributors.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Above the user is directed to use pip install -e . --no-build-isolation. How woul d you suggest they get the needed modifications before running that:
openblas.pc from the scipy-openblas packagePKG_CONFIG_PATH to it_distributor_init.py
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I guess I could move the functionality I added to spin to do these things into to scipy-openblas, and then this would become
pip install scipy-openblas64
python -m scipy-openblas64 setup-repo="."
export PKG_CONFIG_PATH=${PWD}/.openblas # bash
$env:PKG_CONFIG_PATH="$pwd/.openblas" # powershell
pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Duse-ilp64=true" -Csetup-args="-Dblas-symbol-suffix=64_"
Is that preferable?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Another idea: push all this into numpy/meson.build, when configured with -Dblas=scipy-openblas32 or -Dblas=scipy-openblas64. It could take care of everything: creating the openblas.pc file, adding cflags, setting PKG_CONFIG_PATH, modifying _distributor_init.py.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How would you suggest they get the needed modifications before running that:
They don't, that really isn't all that relevant here. BLAS/LAPACK remain external and generic build time dependencies. The wheel is for us to depend on, not for them to mess with directly.
Another idea: push all this into
numpy/meson.build,
I'm not sure it's possible to set PKG_CONFIG_PATH from within Meson.
Either way, there may be an issue here in that the produced wheel will be cached by pip and will contain RPATH entries to a specific Python environment. That is going to break as soon as the user tries to install numpy into another environment.
I have to give it some more thought, but I think this is a little tricky, and perhaps a distraction from the main purpose of this PR right now. We want these wheels used by numpy and scipy wheels and in CI. I'd be inclined to scope this first PR to only that, and not user-facing changes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Indeed, and we cannot add the scipy-openblasX dependency to the sdist without breaking builds from source on platforms for which we don't have openblas wheels.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We may be able to fix this with a metapackage or a do-nothing scipy-openblasX sdist, but it needs some further hack like that. Or a proper solution, like adding a "pypi provider" concept for external dependencies to https://peps.python.org/pep-0725/.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Or could we combine both 32 bit and 64 into a single wheel, along with dummy do-nothing code?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ahh, now I get, sorry for being dense. If we add an ad-hoc dependency on, say, the manylinux2014 wheels for scipy-openblas64, and a dependency on, say, the 32-bit windows wheels for scipy-openblas32, and a dependency on, say, no openblas for macosx-arm64, then there is no way to reconcile all that for a single dependency for the sdist.
I guess another path would be to have a numpy[openblas64] wheel variant, but explaining pip install numpy[openblas64] seems like a nightmare.
Or could we combine both 32 bit and 64 into a single wheel, along with dummy do-nothing code?
Hmm. The problem is of course the wheel size: users would be downloading at least one useless large shared object. That is why I made two wheels.
PEP 725
I think the scipy-openblas wheels fall under the rejected category of external dependencies which are also packaged on PyPI
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think the scipy-openblas wheels fall under the rejected category of external dependencies which are also packaged on PyPI
Well I put it in that category because it seemed too niche - the PEP is still draft, so I can easily reverse that decision:)
the manylinux2014 wheels for scipy-openblas64, and a dependency on, say, the 32-bit windows wheels for scipy-openblas32, and a dependency on, say, no openblas for macosx-arm64, then there is no way to reconcile all that for a single dependency for the sdist.
I think we don't need any 32-bit wheel for numpy at least (scipy is a different story), so it's a little easier. We could have platform selectors perhaps, determining whether we want scipy-openblas64 or nothing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| elseif ( Test-Path env:NPY_USE_BLAS_ILP64 ) { | ||
| python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Duse-ilp64=true" -Csetup-args="-Dblas-symbol-suffix=64_" | ||
| python -m pip install scipy-openblas64 | ||
| spin build --with-scipy-openblas=64 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Moving pip invocations to spin should be a short-term thing, it's fine with me on Azure because that's so hard to debug. But can you please comment out the original line instead of removing it?
More importantly: I don't think this will work, because you removed the other CLI flags and they are needed. Can you instead do:
python -m pip install scipy-openblas64
export PKG_CONFIG_PATH=... # whatever is the right path here
python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Duse-ilp64=true" -Csetup-args="-Dblas-symbol-suffix=64_"
?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
spin build will add the meson flags when invoked with --with-scipy-openblas=64 (in addition to creating the openblas.pc file, modifying _distributor_init.py, and adding the proper PKG_CONFIG_PATH).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| ctx.params["meson_args"] += ( | ||
| "-Dblas-symbol-suffix=64_", | ||
| "-Duse-ilp64=true", | ||
| ) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here is where spin build adds the meson arguments for 64-bit openblas builds
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4f60be0 to
b68dd54
Compare
|
I rebased off main and reduced the scope of the PR to CI build/test runs. We can decide how/if to use the scipy-openblas wheels as a runtime dependency in a future PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
All looks about right to me, now it's "only" a matter of making CI happy. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
948c1f2 to
9d07277
Compare
9d07277 to
ca639f0
Compare
|
It is too easy to run tests locally, which modify |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yeah it's never a good idea to modify files that are under version control. If you can't avoid a change, maybe change # It's okay to replace this content: try: # This `_local` file doesn't exist in VCS, so easier to modify for local development import ._distributor_init_local except ImportError: pass |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
musllinux requires the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| python3 -m pip install -r test_requirements.txt && \ | ||
| echo CFLAGS \$CFLAGS && \ | ||
| python3 -m pip install -v . && \ | ||
| spin openblas-config --with-scipy-openblas=32 && \ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| spin openblas-config --with-scipy-openblas=32 && \ | |
| spin openblas-config --with-scipy-openblas=32 && \ |
| spin openblas-config --with-scipy-openblas=32 && \ | |
| spin config-openblas --with-scipy-openblas=32 && \ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I will close this PR and start over, with the goal of accepting a An enhancement would be to search basedir/.openblas for the pkgconfig file. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.