Skip to content

CI, TST: Re-enable Emscripten/Pyodide CI job for NumPy #25893

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

Closed

Conversation

agriyakhetarpal
Copy link
Contributor

Description

This PR supersedes gh-24603. It adds a CI job to test NumPy v2.0.0.dev0 against a Pyodide (wasm32) runtime. Some of the key changes here are:

  1. A patch has been added to the ci/tools/emscripten/ directory based on an upstream change to Pyodide at Update numpy to 1.26.4 and don't set MESON env variable pyodide/pyodide#4502. This patch ensures that the correct Meson build system (i.e., vendored-meson) is found during the build process.
  2. A new requirements file has been created that contains pure-Python dependencies that can be installed inside a Pyodide virtual environment. It has been placed in the same directory as above.
  3. Some ancillary files have been added to ensure that the WASM wheel is compiled without specialised CPU instructions (SIMD, etc.) and that the build procedure does not need to build against BLAS or LAPACK, which are currently unavailable on WebAssembly.
  4. Various tests have been skipped, such as:
    • All f2py tests, since Fortran cannot run in WASM
    • Some tests for np.where() that require floating point exception support
    • Some tests related to the use of subprocesses to retrieve configurations for how NumPy has been built
    • A bug in Cython, i.e., [BUG] CythonCImports shadowing functionality can confuse pickle cython/cython#5411, has now been resolved. The import cython line was breaking the test discovery because Cython is not supported in Pyodide in-tree yet.
    • and so on

Thanks to @rgommers and the notes provided on gh-24603, all tests pass! Here's a workflow run from my fork where they can be observed: https://github.com/agriyakhetarpal/numpy/actions/runs/8065629246

agriyakhetarpal and others added 3 commits February 27, 2024 19:06
`ninja` is unavailable for WASM for now, I have added a new requirements file for this and used a `sys_platform != 'emscripten'` platform marker to ignore the `ninja` dependency on WASM-based platforms.
This commit performs the following:

1. Skip `RuntimeWarnings` on exotic `np.where()` tests on WASM because of the lack of floating point exception support
2. Skip NumPy config tests that use subprocess module on WASM
3. Ignore threaded tests for PRNGs on WASM
4. Remove numpygh-5411 Cython `AttributeError` check. See cython/cython#5411, which is now resolved for Cython>3, and we are at Cython>=3.0.6.
4. For f2py, check compilers only if not on WASM
5. Skip pickle serialisation tests for `stringdtype` on WASM runtimes
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>
@agriyakhetarpal
Copy link
Contributor Author

It looks like a PR cannot be re-opened on GitHub after the branch for it has changed, I shall be opening a new PR. (I had amended the commit message to add markers to skip CI and had closed this in order to save resources)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant