-
Notifications
You must be signed in to change notification settings - Fork 49
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
Use LFortran to compile any Fortran to WASM #684
Comments
Atm we take the whl build from pyodide https://github.com/pyodide/pyodide/tree/main/packages/scipy We did that because I was too lazy to update all the above-mentioned hacks when updating to an new scipy version (these hacks are all still done by pyodide, and our initial build script was adapted from pyodide by @wolfv) |
I would be super happy to test doing this with you in the emscripten-forge context, @certik. Personally I prefer building scipy from source here instead of taking it from pyodide. |
@wolfv, @DerThorsten awesome. Let's say LFortran can generate the same wasm output as f2c+emcc. How do you then call it from Python? Do you use the f2py somehow, like scipy does? I was thinking of testing this using some small demo, to ensure everything works. |
Emscripten can load the shared objects just fine iiuc |
Ah, so we compile the Fortran code to an "object file" that emcc then loads when it is being linked to the main application? I will need to setup a working example first. |
That would be an interesting start. I think one can also Maybe a good start could be to take the existing scipy package, create the WASM environment with micromamba, and then exchange the |
@certik I added instructions how to setup local builds with emscripten forge https://github.com/emscripten-forge/recipes#local-builds The easiest way to build a new python package and test it is probably via a new recipe. |
LFortran (as of today) can compile 6 out of 18 Fortran packages in SciPy: lfortran/lfortran#2743, and we keep working on compiling the rest. At the same time, I think it's a good time to start using LFortran to compile SciPy to WASM, since it will take some time to iron out all issues. LFortran is available in conda-forge, works on all platforms, etc. We would like to make LFortran work seamlessly as a robust tool that you can depend on and that will eventually remove all pain issues with the tooling around Fortran.
We can start with SciPy (unless you have a better package to try). Here is my understanding so far:
whl
is built.@martinRenou, @DerThorsten how can we help? This will be a long term iterative process, but we want to get started. The nice thing is that once we get SciPy working, LFortran will (almost) automatically work for any other Fortran package out there, so this is a great long term investment.
The text was updated successfully, but these errors were encountered: