| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
[skip ci]
| endian = 'little' | ||
|
|
||
| [properties] | ||
| longdouble_format = 'IEEE_QUAD_LE' |
There was a problem hiding this comment.
This is the only addition compared to the upstream emscripten.meson.cross file in Pyodide - necessary for now.
Sorry, something went wrong.
There was a problem hiding this comment.
Most of this file can be removed, only this is needed:
[properties]
longdouble_format = 'IEEE_QUAD_LE'
Sorry, something went wrong.
Sorry, something went wrong.
|
I decided that it's easier to finish this only after upgrading the build of numpy that Pyodide does in-tree to Meson and 1.26.x first. I've made a start on that, but I need to do some more digging. There was also a pip bug that made that a little more difficult. And pyodide/pyodide#4118 is the same LONG_BIT error as I'm seeing in this PR. Next steps I plan to take (not necessarily in this order):
|
Sorry, something went wrong.
|
Thanks for working on this @rgommers ! I don't have useful suggestions about the errors you are facing but I agree it would probably be easier to do this in the in-tree build first. Also cc @lesteve who worked on the scikit-image meson build.
I think overall we could be happy to accept any changes needed to make numpy with meson work. But since pyodide build aims to be a drop-in replacement for python -m build, we need to double check in particular whether this would still be OK with cibuildwheel, or if there is some other recommended way of passing those config settings. |
Sorry, something went wrong.
That should be fine for cibuildwheel I think. python -m build -Ckey=value will add key=value to the config_settings dict and then pass that on to the backend. -C/--config-setting is implemented in build, and -C/--config-settings in pip (note the extra s for pip in the long form). I am missing that flag from pyodide build --help. |
Sorry, something went wrong.
Currently pyodide build passes extra command line arguments to config-settings (backend-flags), so pyodide build key1=val1 is equivalent to python -m build -C key1==val1 (it is not documented sorry). But yes, we should change it to -C/--config-settings to match the behavior of pypabuild and pip. |
Sorry, something went wrong.
|
Thank you @ryanking13, that's exactly what I needed. |
Sorry, something went wrong.
Initial inspiration was taken from numpy/numpy#24603.
Moving it to Meson is going to take a bit of time, and in the meantime we have to disable it, because it's the only job that still needs the `setup.py` based build and we'd like to remove support for building with `setup.py`.
|
@ryanking13 Do you know what the status of this is? It would be good if we could look into this again. I would look into it myself but so far I don't know much about meson... |
Sorry, something went wrong.
|
I've been meaning to get back to this PR. I believe with @ryanking13's changes for improved Meson/meson-python support in Pyodide, this should be unblocked. Timing wise I realistically won't revisit it before the NumPy 2.0 release settles down though (any week now ...). |
Sorry, something went wrong.
|
Yes, now that we're building numpy with meson in-tree, I don't think it's going to be hard to make it work in out-of-tree too. We've recently added a patch for python-meson >= 0.15 so I think we need to release pyodide-build (0.25.1).
Maybe emscripten CI should also wait for numpy 2.0 to be released? I've seen Pyodide builds break in many cases when packages do major releases, so it might be better to wait and see if the numpy 2.0 build works in-tree before applying it. |
Sorry, something went wrong.
That seems reasonable to me. EDIT: no real reason not to do it now though, it's just not a priority compared to 2.0-critical tasks. |
Sorry, something went wrong.
There was a problem hiding this comment.
I added some comments to this file about what is still relevant. @agriyakhetarpal is going to have a fresh attempt at a new/updated CI job.
Sorry, something went wrong.
|
|
||
| - name: Install pyodide-build | ||
| run: pip install "pydantic<2" pyodide-build==$PYODIDE_VERSION | ||
| run: pip install "pydantic<2" build pyodide-build==$PYODIDE_VERSION |
There was a problem hiding this comment.
build isn't needed anymore, I think pyodide-build will do fine.
Sorry, something went wrong.
| cp pyproject.toml.setuppy pyproject.toml | ||
| CFLAGS=-g2 LDFLAGS=-g2 pyodide build | ||
| # Note that we need to cross-compile here. Using `pyodide build` | ||
| # fails on not having a cross file. The `source() function in |
There was a problem hiding this comment.
This is no longer true, the cross file is shipped by pyodide now.
Sorry, something went wrong.
There was a problem hiding this comment.
Update: still true actually, the cross file won't get applied as long as we have vendored-meson.
We also need the fix from pyodide/pyodide#4502 to actually pick up vendored-meson. With that, an out of tree build should work.
Sorry, something went wrong.
There was a problem hiding this comment.
I am on it – I shall be adding a patch file to port the above PR into vendored-meson, as discussed on Slack.
Sorry, something went wrong.
| # tl;dr this needs some work, and it seems like cross-compilation is | ||
| # hard because Pyodide doesn't ship its own Python interpreter that | ||
| # we can actually target during a direct cross build. | ||
| python -m build --wheel -Csetup-args=--cross-file=$PWD/tools/ci/emscripten.meson.cross -Csetup-args=-Dallow-noblas=true |
There was a problem hiding this comment.
The -Dallow-noblas=true is no longer needed, the fallback to internal code when BLAS is missing is automatic.
Sorry, something went wrong.
There was a problem hiding this comment.
The -Csetup-args=--cross-file=$PWD/tools/ci/emscripten.meson.cross will still be needed I think, only to add the longdouble format, just in slightly different format. From this comment I think it should be:
pyodide build setup-args="--cross-file=$PWD/tools/ci/emscripten.meson.cross"
Sorry, something went wrong.
There was a problem hiding this comment.
Pyodide bundles emscripten.meson.cross used in in-tree build, so probably you can try that one too.
PYODIDE_MESON_CROSS_FILE=`pyodide config get meson_cross_file`
pyodide build -C "setup-args=\"${PYODIDE_MESON_CROSS_FILE}\""
Sorry, something went wrong.
| source .venv-pyodide/bin/activate | ||
| cd .. | ||
| python numpy/runtests.py -n -vv | ||
| pytest --pyargs numpy -m "not slow" |
There was a problem hiding this comment.
This change is still needed.
Sorry, something went wrong.
| 's390x': S390X_FEATURES, | ||
| 'arm': ARM_FEATURES, | ||
| 'aarch64': ARM_FEATURES, | ||
| 'wasm32': {}, |
There was a problem hiding this comment.
the changes in this file will still be needed.
Sorry, something went wrong.
| endian = 'little' | ||
|
|
||
| [properties] | ||
| longdouble_format = 'IEEE_QUAD_LE' |
There was a problem hiding this comment.
Most of this file can be removed, only this is needed:
[properties]
longdouble_format = 'IEEE_QUAD_LE'
Sorry, something went wrong.
Copied with updates and suggestions received from numpy#24603 on 23/02/2024.
Copied with updates and suggestions received from numpy#24603 on 23/02/2024.
This commit performs the following actions: 1. Adds WASM builds to the CPU family for Meson configurations, but without SSE or SIMD instructions. 2. Removes CPU feature detection message for an unsupported architecture. 3. Enables `IEEE_QUAD_LE` longdouble format for the wasm32 target (cross-builds). 4. Enables run for Emscripten/Pyodide wheels by setting the `if:` condition to `true`. 5. Uses recursive submodules to ensure that vendored-meson is received. 6. Moves the Meson cross file to `tools/ci/emscripten/` (i.e., creates a separate Emscripten folder to store relevant files) 7. Adds a patch for vendored-meson detection for Pyodide and applies this Pyodide-meson patch in the Emscripten CI jobs 8. Builds wasm32 wheels without BLAS and LAPACK support (see numpy#24750 (comment)) 9. Forces coloured and prettified outputs for test runs Some of these changes have been copied with updates and suggestions received from numpy#24603 on 23/02/2024 and authorship is preserved with this commit. Co-Authored-By: Ralf Gommers <ralf.gommers@gmail.com>
This commit performs the following actions: 1. Adds WASM builds to the CPU family for Meson configurations, but without SSE or SIMD instructions. 2. Removes CPU feature detection message for an unsupported architecture. 3. Enables `IEEE_QUAD_LE` longdouble format for the wasm32 target (cross-builds). 4. Enables run for Emscripten/Pyodide wheels by setting the `if:` condition to `true`. 5. Uses recursive submodules to ensure that vendored-meson is received. 6. Moves the Meson cross file to `tools/ci/emscripten/` (i.e., creates a separate Emscripten folder to store relevant files) 7. Adds a patch for vendored-meson detection for Pyodide and applies this Pyodide-meson patch in the Emscripten CI jobs 8. Builds wasm32 wheels without BLAS and LAPACK support (see numpy#24750 (comment)) 9. Forces coloured and prettified outputs for test runs Some of these changes have been copied with updates and suggestions received from numpy#24603 on 23/02/2024 and authorship is preserved with this commit. Co-Authored-By: Ralf Gommers <ralf.gommers@gmail.com>
This commit performs the following actions: 1. Adds WASM builds to the CPU family for Meson configurations, but without SSE or SIMD instructions. 2. Removes CPU feature detection message for an unsupported architecture. 3. Enables `IEEE_QUAD_LE` longdouble format for the wasm32 target (cross-builds). 4. Enables run for Emscripten/Pyodide wheels by setting the `if:` condition to `true`. 5. Uses recursive submodules to ensure that vendored-meson is received. 6. Moves the Meson cross file to `tools/ci/emscripten/` (i.e., creates a separate Emscripten folder to store relevant files) 7. Adds a patch for vendored-meson detection for Pyodide and applies this Pyodide-meson patch in the Emscripten CI jobs 8. Builds wasm32 wheels without BLAS and LAPACK support (see numpy#24750 (comment)) 9. Forces coloured and prettified outputs for test runs Some of these changes have been copied with updates and suggestions received from numpy#24603 on 23/02/2024 and authorship is preserved with this commit. [skip cirrus] [skip circle] [skip azp] Co-Authored-By: Ralf Gommers <ralf.gommers@gmail.com>
This commit performs the following actions: 1. Adds WASM builds to the CPU family for Meson configurations, but without SSE or SIMD instructions. 2. Removes CPU feature detection message for an unsupported architecture. 3. Enables `IEEE_QUAD_LE` longdouble format for the wasm32 target (cross-builds). 4. Enables run for Emscripten/Pyodide wheels by setting the `if:` condition to `true`. 5. Uses recursive submodules to ensure that vendored-meson is received. 6. Moves the Meson cross file to `tools/ci/emscripten/` (i.e., creates a separate Emscripten folder to store relevant files) 7. Adds a patch for vendored-meson detection for Pyodide and applies this Pyodide-meson patch in the Emscripten CI jobs 8. Builds wasm32 wheels without BLAS and LAPACK support (see numpy#24750 (comment)) 9. Forces coloured and prettified outputs for test runs Some of these changes have been copied with updates and suggestions received from numpy#24603 on 23/02/2024 and authorship is preserved with this commit. [skip cirrus] [skip circle] [skip azp] Co-Authored-By: Ralf Gommers <ralf.gommers@gmail.com>
|
This PR is superseded by gh-25894, things seem to work there. So I'll close this PR. Thanks for the help everyone! |
Sorry, something went wrong.
|
Thanks for working on this @rgommers and @agriyakhetarpal! |
Sorry, something went wrong.
This commit performs the following actions: 1. Adds WASM builds to the CPU family for Meson configurations, but without SSE or SIMD instructions. 2. Enables `IEEE_QUAD_LE` longdouble format for the wasm32 target (cross-builds). 3. Enables run for Emscripten/Pyodide wheels by setting the `if:` condition to `true`. 4. Uses recursive submodules to ensure that vendored-meson is received. 5. Moves the Meson cross file to `tools/ci/emscripten/` (i.e., creates a separate Emscripten folder to store relevant files) 6. Adds a patch for vendored-meson detection for Pyodide and applies this Pyodide-meson patch in the Emscripten CI jobs 7. Builds wasm32 wheels without BLAS and LAPACK support (see numpy#24750 (comment)) 8. Forces coloured and prettified outputs for test runs Some of these changes have been copied with updates and suggestions received from numpy#24603 on 23/02/2024 and authorship is preserved with this commit. [skip cirrus] [skip circle] [skip azp] Co-Authored-By: Ralf Gommers <ralf.gommers@gmail.com> Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Initial inspiration was taken from numpy/numpy#24603.
* Test emscripten workflow inspired by NumPy Adds a CI job to build and test scikit-image in a Pyodide virtual environment through WASM wheels. Following this, it would be possible to include JupyterLite notebooks in the documentation in order to run scikit-image's code snippets which come with docstring-based examples. Initial inspiration was taken from numpy/numpy#24603. Co-authored-by: Lars Grüter <lagru@mailbox.org> Co-authored-by: Stefan van der Walt <45071+stefanv@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
This is one of the last CI jobs to be converted to Meson. Still a work in progress.
Note that we need to cross-compile here. Using pyodide build fails on not having a cross file. The source() function in pyodide_build/cli/build.py needs a --backend-flags parameter so that we can pass config-settings arguments to the backend. In the meantime, we use python -m build ....
One can also try this locally with:
as long as both pyodide-build and the exact version of Emscripten (currently 3.1.32, can be installed with https://emscripten.org/docs/tools_reference/emsdk.html) are available. The configure stage of the build looks fine, the build itself fails halfway through due to:
That issue is due to a static assert in pyconfig.h, also discussed at: pyodide/pyodide#2494 (comment)
See also pyodide/pyodide#2238 and the patches to _numpyconfig.h in https://github.com/pyodide/pyodide/tree/main/packages/numpy.
tl;dr this needs some work, and it seems like cross-compilation is hard because Pyodide doesn't ship its own Python interpreter that we can actually target during a direct cross build.
Cc @hoodmane @rth. I hope I can bother you with this. If I got any of the above wrong or if you've got a suggestion to get past the LONG_BIT error, I'd love to hear it. Also, a couple of questions: