diff --git a/src/pages/sponsor/NumbaInWasm/GetAQuote.tsx b/src/pages/sponsor/NumbaInWasm/GetAQuote.tsx new file mode 100644 index 00000000..963582a8 --- /dev/null +++ b/src/pages/sponsor/NumbaInWasm/GetAQuote.tsx @@ -0,0 +1,9 @@ +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import GetAQuotePage from '@site/src/components/fundable/GetAQuotePage'; + +export default function FundablePage() { + const { siteConfig } = useDocusaurusContext(); + return ( + + ); +} diff --git a/src/pages/sponsor/NumbaInWasm/index.tsx b/src/pages/sponsor/NumbaInWasm/index.tsx new file mode 100644 index 00000000..876857af --- /dev/null +++ b/src/pages/sponsor/NumbaInWasm/index.tsx @@ -0,0 +1,9 @@ +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import LargeProjectCardPage from '@site/src/components/fundable/LargeProjectCardPage'; + +export default function FundablePage() { + const { siteConfig } = useDocusaurusContext(); + return ( + + ); +} diff --git a/src/pages/sponsor/_projectsDetails.ts b/src/pages/sponsor/_projectsDetails.ts index b6916b9c..2fca5373 100644 --- a/src/pages/sponsor/_projectsDetails.ts +++ b/src/pages/sponsor/_projectsDetails.ts @@ -10,6 +10,7 @@ import Decimal32InArrowCppMD from "@site/src/pages/sponsor/descriptions/Decimal3 import Float16InArrowCppMD from "@site/src/pages/sponsor/descriptions/Float16InArrowCpp.md" import RunEndEncodedInArrowCppMD from "@site/src/pages/sponsor/descriptions/RunEndEncodedInArrowCpp.md" import ParquetNullOptimizationsMD from "@site/src/pages/sponsor/descriptions/ParquetNullOptimizations.md" +import NumbaInWasmMD from "@site/src/pages/sponsor/descriptions/NumbaInWasm.md" export const fundableProjectsDetails = { jupyterEcosystem: [ @@ -50,6 +51,18 @@ export const fundableProjectsDetails = { currentFundingPercentage: 0, repoLink: "https://github.com/geojupyter/jupytergis" }, + { + category: "Jupyter Ecosystem", + title: "Numba and llvmlite in the browser", + pageName: "NumbaInWasm", + shortDescription: "Numba, the standard JIT compiler for numerical Python, now runs in the browser: we have it compiling and executing code inside JupyterLite, along with packages that depend on it such as PyTensor and PyMC. Help us upstream the llvmlite and Numba changes, expand test coverage, add persistent caching, and bring the wider Numba ecosystem to emscripten-forge.", + description: NumbaInWasmMD, + price: "TBD", + maxNbOfFunders: 1, + currentNbOfFunders: 0, + currentFundingPercentage: 0, + repoLink: "https://github.com/numba/llvmlite" + }, ], packageManagement: [ { diff --git a/src/pages/sponsor/descriptions/NumbaInWasm.md b/src/pages/sponsor/descriptions/NumbaInWasm.md new file mode 100644 index 00000000..79da7dba --- /dev/null +++ b/src/pages/sponsor/descriptions/NumbaInWasm.md @@ -0,0 +1,86 @@ +#### Overview + +[Numba](https://numba.pydata.org/) is the standard +just-in-time (JIT) compiler for numerical Python, widely used +across the scientific stack to accelerate compute-heavy code. +Until recently it could not run in the browser: its JIT +backend, [llvmlite](https://github.com/numba/llvmlite), relies +on execution engines that WebAssembly does not provide. + +We have made Numba work in the browser. Numba and llvmlite now +run inside [JupyterLite](https://jupyterlite.readthedocs.io/), +compiling Python functions to WebAssembly and executing them in +the same page, with no server involved. We are looking for +funding to turn this prototype into a capability the ecosystem +can rely on, maintained upstream in Numba and llvmlite. + +See our announcement, +[Numba in the Browser](https://notebook.link/blog/numba-in-the-browser/), +for the full story. + +#### What Works Today + +- llvmlite runs in the browser, through a WebAssembly execution + engine that emits WebAssembly objects from LLVM IR, links them + in-process with LLVM's linker LLD, and loads each result as an + Emscripten side module. +- Numba's `@jit` and `@njit` compile and execute inside a + JupyterLite kernel, on arrays as well as scalars. +- Packages that depend on Numba run in the browser, including + [PyTensor](https://github.com/pymc-devs/pytensor), + [PyMC](https://github.com/pymc-devs/pymc), + [Dolo.py](https://github.com/EconForge/dolo.py) and + [interpolation.py](https://github.com/EconForge/interpolation.py). +- On the example in our announcement, Numba gives a roughly + 250x speedup in WebAssembly, against about 90x for the same + code natively. + +#### Why Numba in the Browser Matters + +A substantial part of the scientific Python stack depends on +Numba, frequently as a hard requirement rather than an optional +accelerator. PyTensor, PyMC, QuantEcon, stumpy and others are in +this category. Until now none of them could be installed in +Pyodide or emscripten-forge at all: not a matter of running +slower in the browser, but of not running. + +Numba also covers a case that pre-compiled extensions +structurally cannot. Code written interactively in a notebook +does not exist until the user types it, so it cannot be shipped +ahead of time in a wheel or a conda package. A JIT compiler is +the only way to make that code fast, and notebooks are precisely +where browser-based Python is used. + +#### Why QuantStack + +QuantStack has in-house Numba expertise, which is rare, combined +with long experience of LLVM in WebAssembly. We develop +[xeus-cpp](https://github.com/jupyter-xeus/xeus-cpp), a C++ +interpreter running in the browser via Clang and LLVM compiled +to WebAssembly, and the execution engine behind Numba in the +browser grew directly out of that work. We also maintain +[emscripten-forge](https://github.com/emscripten-forge) and are +core contributors to Jupyter and JupyterLite, where this work is +deployed. + +#### Proposed Work + +The prototype establishes the end-to-end architecture. Making it +dependable means: + +- upstreaming the llvmlite and Numba changes as focused, + reviewable contributions; +- expanding test coverage, running the llvmlite and Numba test + suites in the browser; +- improving compilation performance and adding persistent + caching, so that compiled functions survive a page reload; +- validating and packaging more of the Numba ecosystem for + emscripten-forge. + +These are separable pieces of work: we advance incrementally and +deliver sub-parts, so the project can be funded in full or in +part. + +##### Are you interested in this project? Either entirely or +partially, contact us for more information on how to help us +fund it.