Repository navigation
cppjit series and a JupyterLite site: the C++ and cppjit notebooks in the browser, no install - #11
Merged
Merged
Conversation
vgvassilev
force-pushed
the
sc-cppjit-series
branch
4 times, most recently
from
November 5, 2026 10:01
f84560e to
a46402b
Compare
The tutorials run only on a machine with a C++ toolchain and a kernel installed, and the C++-from-Python direction (a Python kernel with a C++ compiler inside it) has no series at all. Derivatives of the C++ in such notebooks have to be pre-generated, because no cppjit build carries Clad. Add a cppjit series of five notebooks (call a header from Python, use the derivative Clad writes for it, fit a C++ simulator on that exact gradient, fit the Higgs mass on CMS open data without ROOT, calibrate a tumour twin) and a JupyterLite site on which the C++ series and the cppjit series run with nothing installed: xeus-cpp + cppjit compiled to WebAssembly on the LLVM 23 line, with Clad built into CppInterOp, so clad::gradient works in a C++ cell and through cppjit. The native side runs on a cppjit wheel built with the same Clad plugin, and the notebooks generate their derivatives in the session on both. SciPy and matplotlib load on first import; the wire cost is 49.8 MB for the first notebook and 69.8 MB with SciPy loaded. The kernel and the wheel are release assets verified against digests committed in lite/kernel/SHA256SUMS; build-kernel.yml rebuilds both on a runner and proposes new digests as a pull request. The release kernel is linked against an LLVM 23 built with the ci-workflows llvm-wasm recipe (WebAssembly target only, -Oz, LTO: 23.7 MB on the wire instead of 32.5, cell times unchanged within noise); tools/build-wasm-kernel.sh takes such an install through LLVM_WASM_DIR, and the workflow builds against the conda package until that install is published as a cell. The kernel is built from CppInterOp, cppjit and xeus-cpp main with compiler-research/CppInterOp #1167 and Clad at 90a623d6 (vgvassilev/clad#2453: a failed input's declarations are no longer replayed into CodeGen on clang >= 22, which hung the kernel after any parse error), with the patches in lite/kernel/: #1167's clad cross-build flags and static link interface under emsdk 4.0.9, cppjit as a wasm side module and with Clad on request. These are candidates for upstream. Verified under nektos/act: the cppjit job, the Pages build with the real assets and the kernel-and-wheel build. Two cells of 07_stl_modern_cpp.ipynb ran lambdas that write to std::cout inside top-level statements; clang-repl 21 (the xeus-cpp kernel) crashes in the Itanium mangler on that pattern (compiler-research/xeus-cpp#476) depending on heap layout, which is why the C++ job was green on master in June and dead on every runner since. Both cells now define a named function and call it, with the same outputs.
vgvassilev
force-pushed
the
sc-cppjit-series
branch
from
November 5, 2026 10:07
a46402b to
974f033
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New series
cppjit/: five notebooks from the SC26 tutorial where a Python kernel compiles C++ through cppjit (call a header, use Clad's derivative of it, fit a C++ simulator with SciPy on that gradient, the Higgs on CMS open data without ROOT, a sixty-line tumour twin). CI runs them with the Python kernel (sanitised comparison: timings and fitted digits differ by machine); environment.yml gains numpy, scipy, matplotlib-base and cppjit.lite/+tools/: a JupyterLite site built from the xeus-cpp + cppjit kernel compiled to WebAssembly. The start-up set is python + numpy (5.9 MB); SciPy and matplotlib download in the background and unpack on first import; the CppInterOp module is relinked to export only what is used. 45 MB on the wire for the first notebook, 64 MB with SciPy and matplotlib. The C++ series runs in the same site (cpp/, notebook 10 excluded: itsloglambda collides with std::log in the browser kernel's scope)..github/workflows/deploy-pages.ymlrebuilds and publishes the site on GitHub Pages; the kernel binaries come from a release of this repository (lite/kernel/README.md), everything else from pinned locks (lite/env). Design, measurements and the rebuild recipe: lite/README-build.md.