RunMat Ahead-of-Time Compilation for MATLAB
runmat.com- Category
- Developer Tools
- Rank
- No. 1166Tools index
Previous survey · No. 1146 ·
- Type
- TOOL
- Use case
- Coding
- Interfaces
- CLI
- GitHub
- 269 stars
- Latest release
- v0.6.2
- Date
About
RunMat now supports a `runmat compile` command that turns MATLAB-syntax source into a standalone native executable, requiring no separate RunMat CLI, VM, or SDK at runtime. It replaces RunMat's earlier bytecode-based JIT (Turbine) with a unified pipeline that lowers the same analyzed MIR into verified Native IR for both JIT and ahead-of-time compilation, linking a compiler-free runtime that preserves MATLAB's indexing, dispatch, and workspace semantics.
What it does
RunMat is an open-source Rust reimplementation of the MATLAB language, and its compile command takes a script and produces a single program you can hand to someone who has never installed RunMat. Code that runs in the interpreter and code that ships as a binary go through the same parsing, analysis and code generation, so behavior should not drift between the two. Compilation targets the machine you build on, and a stricter mode strips out everything the program provably never calls.
Why it's ranked here
Shipping MATLAB code without a MATLAB install has usually meant a commercial compiler and a runtime download. RunMat offers an Apache 2.0 path instead, written in Rust, with installers for Linux, macOS and Windows plus Homebrew, Cargo and npm. The compile docs are unusually specific: they name which policies work today, which fail on purpose until finished, and what the linker needs. That candor, on top of an existing interpreter, browser sandbox and test runner, makes this a credible option for numerical teams, though the strict mode will reject code that leans on dynamic MATLAB behavior.
What's good
The strict closed-world mode refuses to guess. If any call could reach an unknown target, compilation stops with a specific diagnostic rather than producing a binary that breaks later. A link report lists every function, builtin and class kept in the binary and why each edge exists, and it can be written as deterministic JSON for CI. Replacing an existing output keeps the old executable until the new link succeeds. The default mode bundles a matching runtime, and the compiler checks target, ABI, version and builtin catalog before linking.
Tradeoffs
Output targets only the host you compile on; the portable, target-independent mode is reserved and currently fails by design, as does a dynamic mode that would load source at run time. Path changes made while the program runs cannot add code to an already linked binary. You still need a supported system linker and native libraries such as HDF5 when those features are enabled. Building RunMat yourself with a plain Cargo build leaves out the embedded runtime archive, so contributors must use a separate two-phase build. The docs assert MATLAB compatibility but publish no side-by-side results against MATLAB itself.
How to use it well
Run the static checker first, and add the strict warnings flag in CI so dynamic calls surface before you try to compile. Declare every source folder in the project file so the compiler can see cross-file functions, since anything added at run time is invisible to it. Start with the default policy, then try the closed-world policy and read the link report to see what blocks it. This suits engineers distributing analysis tools to colleagues; it does not cover cross-compiling for another platform or running compiled output in a browser.
Technical notes+
docs/getting-started/cli.md documents runmat compile with --policy=native-specialized (default, links the runtime archive embedded in the runmat binary), --policy=closed-world (links only reachable catalog-backed builtin bindings and omits parser, compiler, VM, JIT and object emission; the HIR/MIR schema needed to verify Native IR stays), and reserved dynamic-runtime and portable names that fail. Other flags: --optimization=none|size|speed, --keep-temps, --linker PATH, --force, --explain-link, --link-plan-json PATH. crates/runmat-aot/src/lib.rs is described as host-only orchestration exposing archive, compile and link modules plus emit_native_object; crates/runmat-aot/src/compile/mod.rs exports CompilationPolicy and build_program_link_plan. Cargo.toml pins Cranelift 0.115. docs/jit/index.md limits host JIT to x86-64 and AArch64, with WebAssembly sessions staying on the VM. docs/compiler/index.md still describes bytecode as the pipeline's final product.
Observed
- License
- Apache 2.0
- Language
- Rust, organised as a Cargo workspace
- Install surface
- Shell and PowerShell installers, Homebrew, Cargo, npm
- Interfaces
- CLI, REPL, TypeScript/WebAssembly package, LSP
- Compile target
- Host executable only; portable policy reserved and fails
- Closed-world compile
- Fails with a diagnostic on unknown call targets
- Link dependencies
- System linker and native libraries such as HDF5
- JIT platforms
- x86-64 and AArch64; none in WebAssembly
Read from README.md, Cargo.toml, LICENSE.md, docs/getting-started/cli.md, docs/compiler/index.md, docs/jit/index.md, docs/gpu/index.md, crates/runmat-aot/src/lib.rs, crates/runmat-cli/src/main.rs, crates/runmat-aot/src/compile/mod.rs, docs/README.md.
What it can do
Compile MATLAB-syntax source code into a standalone native executable
MATLAB source code → Native executable
Just-in-time compile MATLAB source code for execution
MATLAB source code → Compiled program execution
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.