RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

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.

LicensePrivacy
/
See all docs
Builtin Reference
    • cputime
    • pause
    • tic
    • timeit
    • timer
    • timerfind
    • timerfindall
    • toc

timer — Create a timer handle object for scheduled callbacks.

timer creates a handle object with callback, timing, execution, visibility, and user-data properties. Use start, startat, stop, wait, and delete to control its lifecycle, and use timerfind or timerfindall to retrieve valid timers.

Syntax

t = timer
t = timer(Name, Value, ...)

Inputs

NameTypeRequiredDefaultDescription
Name,ValueAnyVariadic—Timer properties such as TimerFcn, StartDelay, Period, ExecutionMode, Name, Tag, and UserData.

Returns

NameTypeDescription
tAnyTimer handle object.

Errors

IdentifierWhenMessage
RunMat:timer:InvalidInputA timer argument, property, or callback value has an unsupported type.timer: invalid input
RunMat:timer:InvalidPropertyA timer property name is unknown, read-only, or has an invalid value.timer: invalid property
RunMat:timer:InvalidHandleA lifecycle method receives a non-timer or invalid timer handle.timer: invalid timer handle
RunMat:timer:CallbackFailedA timer callback fails.timer: callback failed
RunMat:timer:GcFailureA timer object cannot be allocated, rooted, read, or mutated.timer: object storage failed

How timer works

  • t = timer creates a valid timer handle with defaults: ExecutionMode='singleShot', Period=1, StartDelay=0, TasksToExecute=1, BusyMode='drop', ObjectVisibility='on', Running='off', TasksExecuted=0, Type='timer', and a generated Name.
  • t = timer(Name, Value, ...) accepts common callback, timing, labeling, and user-data properties: TimerFcn, StartFcn, StopFcn, ErrorFcn, Period, StartDelay, TasksToExecute, BusyMode, ExecutionMode, Name, Tag, ObjectVisibility, and UserData.
  • Callback properties accept strings, character rows, function handles, closures, or callback cell arrays. Function-handle, closure, and callback-cell callbacks execute directly; non-empty text callbacks are not yet executable.
  • start(t) validates TimerFcn, marks Running='on', executes StartFcn, executes TimerFcn once for singleShot or TasksToExecute times for fixed execution modes, updates TasksExecuted, InstantPeriod, and AveragePeriod, then executes StopFcn and marks Running='off'.
  • startat(t, delaySeconds) is supported for numeric positive relative delays. MATLAB date/time and date-string start times are not yet implemented.
  • stop(t) marks the timer stopped and runs StopFcn if the timer was running. wait(t) returns after the timer is stopped. delete(t) invalidates the handle, removes it from timer discovery, and releases its GC root.
  • Timer callbacks currently run synchronously on the current VM path. Long delays therefore block the caller on native hosts; background event-queue scheduling is not yet available.
  • TasksToExecute retains a native integer scalar exactly. Period and StartDelay are stored as seconds and reject integer values that cannot cross the binary64 seconds boundary exactly.
  • UserData preserves native integer class, shape, and payload without numeric conversion.
  • Multiple timers are currently returned as a cell row.

Does RunMat run timer on the GPU?

timer is a control-flow and callback object. It gathers no tensors, allocates no GPU buffers, and does not participate in fusion.

Examples

Create and start a one-shot timer

t = timer('TimerFcn', @(src, evt)disp("tick"));
start(t)

Find a timer by tag

t = timer('Tag', 'batch', 'TimerFcn', @tick);
found = timerfind('Tag', 'batch')

Using timer with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how timer changes the result.

Run a small timer example, explain the result, then change one input and compare the output.

FAQ

Does RunMat run timers in the background?⌄

No. Timer callbacks run synchronously when start drives the timer. Background scheduling requires an event queue that is not yet available.

Can timer callbacks use GPU arrays?⌄

Yes, when the callback body calls GPU-capable builtins. The timer object itself is host-side control flow and has no GPU kernel.

Related Timing functions

cputime · pause · tic · timeit · timerfind · timerfindall · toc

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how timer is executed, line by line, in Rust.

  • View the source for timer in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How timer works
  • Does RunMat run timer on the GPU?
  • Examples
  • Create and start a one-shot timer
  • Find a timer by tag
  • Using timer with coding agents
  • FAQ
  • Related Timing functions
  • Open-source implementation
  • About RunMat