runmat-org/runmat

Open source math and physics engine that executes MATLAB-syntax code. Features a modern compiler, automatic GPU acceleration for large calculations, and support for math on geometry / FEA calculations.

255

stars

5,943

commits

Rust

primary language

Sep 9, 2026

updated

runmat.com
gpu
gpu-acceleration
gpu-computing
gpu-programming
jit-compiler
linear-algebra
mathematics
matlab
numerical-analysis
plotting
rust
scientific-computing

README

RunMat

RunMat

MATLAB-compatible runtime for fast GPU-accelerated math.

Build Status License: Apache-2.0 Crates.io npm GitHub Stars

Try RunMat in your browser | Download RunMat Desktop | Docs | Changelog | Benchmarks

RunMat is an open-source, high-performance runtime designed for numerical computing using MATLAB-style syntax. It is built in Rust and provides a multi-tiered execution model that targets both CPU and GPU hardware without requiring manual management of tensor allocations and movement.

RunMat runs MATLAB-syntax .m files with automatic operation fusion, a high-performance compiler, and a cross-platform GPU backend powered by wgpu.

RunMat Desktop is free, including local-folder projects, unlimited cloud projects, private sharing, and real-time collaboration. See what’s included.

Key Capabilities:

  • MATLAB Compatibility: Supports MATLAB-syntax scripts and projects, including arrays, functions, classes, packages, and 1,000+ documented built-in functions.
  • Native Compilation: Compile .m scripts into standalone native executables with runmat compile.
  • Code Checks and Tests: Check code without executing it with runmat check, and run MATLAB-style script, function, and class tests with runmat test.
  • Integer Support: Work with signed and unsigned integer types from 8 to 64 bits.
  • Project Packages: Manage dependencies and lockfiles for reproducible MATLAB-syntax projects with the CLI.
  • Automatic Fusion: Builds an internal graph of array operations to fuse elementwise math and reductions into optimized kernels
  • Tiered Execution: Combines a fast-startup VM interpreter with a JIT (based on Cranelift) for hot code paths
  • Cross-Platform GPU: Transparently offloads workloads to Metal, DirectX 12, Vulkan, or WebGPU
  • Strong Static Analysis: Type/shape inference, definite assignment, and other static analysis passes are run before execution to optimize the execution plan.
  • Async Runtime: Built on Rust futures, allowing non-blocking execution in web environments, CLI tools and headless pipelines
  • Integrated Plotting: Features an interactive GPU-accelerated 2D/3D plotting engine supporting 30+ plot types

Explore the MATLAB compatibility guide for supported language features, or use runmat check analysis.m to check your code before running it.

Quick Start

The quickest way to get started is to open the RunMat Sandbox and run code in your browser—no installation required. To work with local files, download RunMat Desktop.

Alternatively, you can install the CLI:

# Linux/macOS
curl -fsSL https://runmat.com/install.sh | sh

# Windows PowerShell
iwr https://runmat.com/install.ps1 | iex

Create a script hello.m:

disp("Hello, World!");
A = magic(3);
disp(sum(A));

Run the script:

runmat hello.m

See Hello World for more examples, and the Command Line Interface for the full command surface.

Other Installation Options

# Homebrew (macOS/Linux)
brew install runmat-org/tap/runmat

# Cargo (Rust)
cargo install runmat --features gui

# Build from source
git clone https://github.com/runmat-org/runmat.git && cd runmat
cargo build -p runmat --release --features gui

CLI

The CLI can run local scripts or named project entrypoints - on local or remote projects.

runmat analysis.m

# which is shorthand for:

runmat run analysis.m

Check an existing script, run your project's tests, or compile a script into a standalone native executable:

# Check code without executing it
runmat check analysis.m

# Run the project's MATLAB-style tests
runmat test

# Compile a script into a native executable
runmat compile analysis.m -o analysis

See code checking, project tests, and native compilation for options and examples.

Projects can define named entrypoints in runmat.toml:

[package]
name = "demo"

[entrypoints.main]
path = "src/main.m"

Run the entrypoint:

runmat run main

Project Testing and CI

Produce JUnit reports for CI and collect LCOV coverage:

runmat test --report junit
runmat test --coverage --coverage-format lcov

The test runner supports MATLAB-style script, function, and class tests, with name and tag filters, cancellation, and JSON, JUnit, or TAP reports. See project testing.

Cloud Project Files

To run a script in a remote project backend, ensure you are authenticated and have selected a project:

runmat login

# or explicitly specify the server URL

runmat login --server https://api.runmat.com

runmat project select <project-id>

And then run the script:

runmat remote run /scripts/analysis.m

The script is executed locally with the remote filesystem provider mounted into the runtime's filesystem abstraction. This means that mutations to the filesystem are persisted to the remote project, but the script runs locally.

For the full command surface, see Command Line Interface.

TypeScript And WebAssembly

The runmat npm package embeds the runtime in browser, worker, Electron, and Node-based hosts.

npm install runmat
import { initRunMat } from "runmat";

const session = await initRunMat();

const result = await session.executeRequest({
  source: {
    kind: "text",
    name: "<repl>",
    text: "A = magic(3); disp(A)"
  }
});

console.log(result.stdout);
console.log(result.workspace.values);

session.dispose();

The TypeScript API includes session execution, workspace snapshots, lazy variable materialization, filesystem providers, plotting surfaces, stdout subscriptions, runtime diagnostics, and GPU status reporting.

See bindings/ts/README.md and WASM & TypeScript/JavaScript.

What Is In This Repository

AreaCrates and paths
Language frontendrunmat-lexer, runmat-parser, runmat-hir, runmat-mir, runmat-static-analysis
Executionrunmat-core, runmat-vm, runmat-runtime, runmat-builtins
Native execution and compilationrunmat-native-executor, runmat-jit, runmat-native-codegen, runmat-aot
GPU accelerationrunmat-accelerate, runmat-accelerate-api
Memory managementrunmat-gc, runmat-gc-api
Plottingrunmat-plot
Filesystem and configrunmat-filesystem, runmat-config
CLI and remote servicesrunmat-cli, runmat-server-client
Browser bindingsrunmat-wasm, bindings/ts
Toolingrunmat-lsp, runmat-telemetry, runmat-logging

The runtime is host-neutral. The CLI, Desktop, WASM bindings, and LSP all submit source through the same session/execution boundary and consume structured results.

Runtime Highlights

  • MATLAB-style source execution for scripts, functions, packages, imports, classdef, indexing, cells, structs, exceptions, and common language constructs.
  • Built-in functions for array operations, linear algebra, tables, plotting, file I/O, optimization, and ODEs, plus control design with lqr, linear regression with fitlm, spectral analysis with pwelch, and symbolic variables with syms.
  • A bytecode VM for predictable startup and a Cranelift JIT for hot execution paths.
  • GPU acceleration through fusion, auto-offload decisions, and wgpu backends for Metal, Vulkan, DirectX 12, and WebGPU.
  • Interactive 2D and 3D plotting with figure handles, subplot state, labels, legends, export, replay, and browser canvas integration.
  • Session APIs for REPLs, notebooks, editors, browser sandboxes, and remote filesystem-backed projects.
  • TypeScript bindings with filesystem providers for memory, IndexedDB, and remote HTTP-backed workspaces.

Validation

RunMat tests cover parsing and language semantics, runtime functions, CPU/GPU execution, and browser/WASM behavior. A shared workflow fixture exercises CSV import, MAT-file save/load, FFTs, filtering, and signal windows through both the CLI and WASM. See the testing strategy for the suites and commands used to validate these paths. For your own project, combine runmat check with representative runs and runmat test to verify the behavior your analysis depends on.

GPU Acceleration

RunMat's acceleration engine captures array operations into fusion plans, estimates whether CPU or GPU execution is better for the current shapes, and keeps tensors resident on device when downstream work can reuse them.

x = rand(10_000_000, 1, "single");
y = sin(x) .* exp(-x / single(10));
z = tanh(y) + single(0.1) .* y;
m = mean(z, "all");

Elementwise chains and reductions like this can be fused into larger GPU dispatches without writing kernel code. Smaller workloads can stay on CPU when transfer overhead would dominate.

See GPU Acceleration & Fusion Engine.

Plotting

RunMat includes an open plotting engine used by the CLI, browser sandbox, and TypeScript bindings.

x = 0:0.1:10;
plot(x, sin(x));
title("Sine wave");
grid on;

RunMat 3D plotting demo

See Plotting System.

Documentation

Start here:

Runtime internals:

The full docs index is docs/README.md.

Benchmarks

The benchmarks directory contains reproducible cross-language comparisons against NumPy, PyTorch, Octave, and Julia where applicable.

Representative published runs include:

BenchmarkResult
Monte Carlo GBM risk simulationUp to 131x faster than NumPy on the published sweep.
Elementwise mathUp to 144x faster than PyTorch at 1B elements on the published sweep.
4K image preprocessingUp to 10x faster than NumPy on the published sweep.

Run the suite:

python3 benchmarks/.harness/run_suite.py \
  --suite benchmarks/.harness/suite.json \
  --output results/suite_results.json

Benchmark results depend on hardware, driver stack, backend selection, and workload shape. The benchmark harness records device details and parity checks with each run.

Development

Install the Rust toolchain from rust-toolchain.toml, then build the workspace:

cargo build
cargo test

Build the CLI with plotting support:

cargo build -p runmat --release --features gui

Work on the TypeScript/WASM package:

cd bindings/ts
npm install
npm run build
npm test

Useful docs:

License

RunMat is licensed under the Apache License 2.0.

RunMat is a registered trademark of Dystr Inc. MATLAB is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

Contributors

nallana

4,809 commits

gneeri

749 commits

finrunsfar

358 commits

cursoragent

9 commits

runmat-org/runmat

Open source math and physics engine that executes MATLAB-syntax code. Features a modern compiler, automatic GPU acceleration for large calculations, and support for math on geometry / FEA calculations.

255

stars

5,943

commits

Rust

primary language

Sep 9, 2026

updated

runmat.com
gpu
gpu-acceleration
gpu-computing
gpu-programming
jit-compiler
linear-algebra
mathematics
matlab
numerical-analysis
plotting
rust
scientific-computing

README

RunMat

RunMat

MATLAB-compatible runtime for fast GPU-accelerated math.

Build Status License: Apache-2.0 Crates.io npm GitHub Stars

Try RunMat in your browser | Download RunMat Desktop | Docs | Changelog | Benchmarks

RunMat is an open-source, high-performance runtime designed for numerical computing using MATLAB-style syntax. It is built in Rust and provides a multi-tiered execution model that targets both CPU and GPU hardware without requiring manual management of tensor allocations and movement.

RunMat runs MATLAB-syntax .m files with automatic operation fusion, a high-performance compiler, and a cross-platform GPU backend powered by wgpu.

RunMat Desktop is free, including local-folder projects, unlimited cloud projects, private sharing, and real-time collaboration. See what’s included.

Key Capabilities:

  • MATLAB Compatibility: Supports MATLAB-syntax scripts and projects, including arrays, functions, classes, packages, and 1,000+ documented built-in functions.
  • Native Compilation: Compile .m scripts into standalone native executables with runmat compile.
  • Code Checks and Tests: Check code without executing it with runmat check, and run MATLAB-style script, function, and class tests with runmat test.
  • Integer Support: Work with signed and unsigned integer types from 8 to 64 bits.
  • Project Packages: Manage dependencies and lockfiles for reproducible MATLAB-syntax projects with the CLI.
  • Automatic Fusion: Builds an internal graph of array operations to fuse elementwise math and reductions into optimized kernels
  • Tiered Execution: Combines a fast-startup VM interpreter with a JIT (based on Cranelift) for hot code paths
  • Cross-Platform GPU: Transparently offloads workloads to Metal, DirectX 12, Vulkan, or WebGPU
  • Strong Static Analysis: Type/shape inference, definite assignment, and other static analysis passes are run before execution to optimize the execution plan.
  • Async Runtime: Built on Rust futures, allowing non-blocking execution in web environments, CLI tools and headless pipelines
  • Integrated Plotting: Features an interactive GPU-accelerated 2D/3D plotting engine supporting 30+ plot types

Explore the MATLAB compatibility guide for supported language features, or use runmat check analysis.m to check your code before running it.

Quick Start

The quickest way to get started is to open the RunMat Sandbox and run code in your browser—no installation required. To work with local files, download RunMat Desktop.

Alternatively, you can install the CLI:

# Linux/macOS
curl -fsSL https://runmat.com/install.sh | sh

# Windows PowerShell
iwr https://runmat.com/install.ps1 | iex

Create a script hello.m:

disp("Hello, World!");
A = magic(3);
disp(sum(A));

Run the script:

runmat hello.m

See Hello World for more examples, and the Command Line Interface for the full command surface.

Other Installation Options

# Homebrew (macOS/Linux)
brew install runmat-org/tap/runmat

# Cargo (Rust)
cargo install runmat --features gui

# Build from source
git clone https://github.com/runmat-org/runmat.git && cd runmat
cargo build -p runmat --release --features gui

CLI

The CLI can run local scripts or named project entrypoints - on local or remote projects.

runmat analysis.m

# which is shorthand for:

runmat run analysis.m

Check an existing script, run your project's tests, or compile a script into a standalone native executable:

# Check code without executing it
runmat check analysis.m

# Run the project's MATLAB-style tests
runmat test

# Compile a script into a native executable
runmat compile analysis.m -o analysis

See code checking, project tests, and native compilation for options and examples.

Projects can define named entrypoints in runmat.toml:

[package]
name = "demo"

[entrypoints.main]
path = "src/main.m"

Run the entrypoint:

runmat run main

Project Testing and CI

Produce JUnit reports for CI and collect LCOV coverage:

runmat test --report junit
runmat test --coverage --coverage-format lcov

The test runner supports MATLAB-style script, function, and class tests, with name and tag filters, cancellation, and JSON, JUnit, or TAP reports. See project testing.

Cloud Project Files

To run a script in a remote project backend, ensure you are authenticated and have selected a project:

runmat login

# or explicitly specify the server URL

runmat login --server https://api.runmat.com

runmat project select <project-id>

And then run the script:

runmat remote run /scripts/analysis.m

The script is executed locally with the remote filesystem provider mounted into the runtime's filesystem abstraction. This means that mutations to the filesystem are persisted to the remote project, but the script runs locally.

For the full command surface, see Command Line Interface.

TypeScript And WebAssembly

The runmat npm package embeds the runtime in browser, worker, Electron, and Node-based hosts.

npm install runmat
import { initRunMat } from "runmat";

const session = await initRunMat();

const result = await session.executeRequest({
  source: {
    kind: "text",
    name: "<repl>",
    text: "A = magic(3); disp(A)"
  }
});

console.log(result.stdout);
console.log(result.workspace.values);

session.dispose();

The TypeScript API includes session execution, workspace snapshots, lazy variable materialization, filesystem providers, plotting surfaces, stdout subscriptions, runtime diagnostics, and GPU status reporting.

See bindings/ts/README.md and WASM & TypeScript/JavaScript.

What Is In This Repository

AreaCrates and paths
Language frontendrunmat-lexer, runmat-parser, runmat-hir, runmat-mir, runmat-static-analysis
Executionrunmat-core, runmat-vm, runmat-runtime, runmat-builtins
Native execution and compilationrunmat-native-executor, runmat-jit, runmat-native-codegen, runmat-aot
GPU accelerationrunmat-accelerate, runmat-accelerate-api
Memory managementrunmat-gc, runmat-gc-api
Plottingrunmat-plot
Filesystem and configrunmat-filesystem, runmat-config
CLI and remote servicesrunmat-cli, runmat-server-client
Browser bindingsrunmat-wasm, bindings/ts
Toolingrunmat-lsp, runmat-telemetry, runmat-logging

The runtime is host-neutral. The CLI, Desktop, WASM bindings, and LSP all submit source through the same session/execution boundary and consume structured results.

Runtime Highlights

  • MATLAB-style source execution for scripts, functions, packages, imports, classdef, indexing, cells, structs, exceptions, and common language constructs.
  • Built-in functions for array operations, linear algebra, tables, plotting, file I/O, optimization, and ODEs, plus control design with lqr, linear regression with fitlm, spectral analysis with pwelch, and symbolic variables with syms.
  • A bytecode VM for predictable startup and a Cranelift JIT for hot execution paths.
  • GPU acceleration through fusion, auto-offload decisions, and wgpu backends for Metal, Vulkan, DirectX 12, and WebGPU.
  • Interactive 2D and 3D plotting with figure handles, subplot state, labels, legends, export, replay, and browser canvas integration.
  • Session APIs for REPLs, notebooks, editors, browser sandboxes, and remote filesystem-backed projects.
  • TypeScript bindings with filesystem providers for memory, IndexedDB, and remote HTTP-backed workspaces.

Validation

RunMat tests cover parsing and language semantics, runtime functions, CPU/GPU execution, and browser/WASM behavior. A shared workflow fixture exercises CSV import, MAT-file save/load, FFTs, filtering, and signal windows through both the CLI and WASM. See the testing strategy for the suites and commands used to validate these paths. For your own project, combine runmat check with representative runs and runmat test to verify the behavior your analysis depends on.

GPU Acceleration

RunMat's acceleration engine captures array operations into fusion plans, estimates whether CPU or GPU execution is better for the current shapes, and keeps tensors resident on device when downstream work can reuse them.

x = rand(10_000_000, 1, "single");
y = sin(x) .* exp(-x / single(10));
z = tanh(y) + single(0.1) .* y;
m = mean(z, "all");

Elementwise chains and reductions like this can be fused into larger GPU dispatches without writing kernel code. Smaller workloads can stay on CPU when transfer overhead would dominate.

See GPU Acceleration & Fusion Engine.

Plotting

RunMat includes an open plotting engine used by the CLI, browser sandbox, and TypeScript bindings.

x = 0:0.1:10;
plot(x, sin(x));
title("Sine wave");
grid on;

RunMat 3D plotting demo

See Plotting System.

Documentation

Start here:

Runtime internals:

The full docs index is docs/README.md.

Benchmarks

The benchmarks directory contains reproducible cross-language comparisons against NumPy, PyTorch, Octave, and Julia where applicable.

Representative published runs include:

BenchmarkResult
Monte Carlo GBM risk simulationUp to 131x faster than NumPy on the published sweep.
Elementwise mathUp to 144x faster than PyTorch at 1B elements on the published sweep.
4K image preprocessingUp to 10x faster than NumPy on the published sweep.

Run the suite:

python3 benchmarks/.harness/run_suite.py \
  --suite benchmarks/.harness/suite.json \
  --output results/suite_results.json

Benchmark results depend on hardware, driver stack, backend selection, and workload shape. The benchmark harness records device details and parity checks with each run.

Development

Install the Rust toolchain from rust-toolchain.toml, then build the workspace:

cargo build
cargo test

Build the CLI with plotting support:

cargo build -p runmat --release --features gui

Work on the TypeScript/WASM package:

cd bindings/ts
npm install
npm run build
npm test

Useful docs:

License

RunMat is licensed under the Apache License 2.0.

RunMat is a registered trademark of Dystr Inc. MATLAB is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

Contributors

nallana

4,809 commits

gneeri

749 commits

finrunsfar

358 commits

cursoragent

9 commits

Languages

Rust

95.6%

Python

3.2%