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

pause — Pause execution until keypress or specified duration elapses with MATLAB-compatible timing semantics.

pause suspends execution until user interaction or for a requested duration, supporting MATLAB-compatible pause, pause(n), and pause-state control forms.

Syntax

out = pause()
out = pause(duration)
state = pause(command)

Inputs

NameTypeRequiredDefaultDescription
durationAnyYes0Duration scalar or command-like scalar value accepted by pause.
commandStringScalarYes—One of 'on', 'off', or 'query'.

Returns

NameTypeDescription
outNumericArrayEmpty array when pausing or changing state.
stateStringScalarPrevious pause state ('on' or 'off').

Errors

IdentifierWhenMessage
RunMat:pause:InvalidInputArgumentInput argument is malformed, unsupported, non-scalar where scalar is required, or a negative/non-finite duration.pause: invalid input argument
RunMat:pause:TooManyInputsMore than one input argument is supplied.pause: too many input arguments
RunMat:pause:StateLockFailedInternal pause-state lock cannot be acquired.pause: failed to acquire pause state
RunMat:pause:GpuGatherFailedGathering a GPU argument to host fails during argument classification.pause: failed to gather gpu input

How pause works

  • A nonnegative duration accepts single, double, and all eight built-in integer classes; integer storage is validated before one explicit seconds/timer conversion.
  • Automatic residency does not change compatibility admission and gathers through the owning provider when host inspection is required. Explicit gpuArray duration input is a separately gated RunMat extension.

Does RunMat run pause on the GPU?

No timing kernel is dispatched. Provider access is limited to owner-aware gathering of an admitted resident scalar.

GPU memory and residency

pause never runs on the GPU. Automatically resident compatible values gather transparently through their owning provider before the host timer boundary. An explicitly supplied gpuArray duration is available only as a gated RunMat extension.

Examples

Pausing for a fixed duration

tic;
pause(0.05);     % wait 50 milliseconds
elapsed = toc

Waiting for user input mid-script

disp("Press any key to continue the demo...");
pause;           % waits until the user presses a key (while pause is 'on')

Temporarily disabling pauses in automated runs

state = pause('off');   % returns previous state so it can be restored
cleanup = onCleanup(@() pause(state));  % ensure state is restored
pause(1.0);             % returns immediately because pause is disabled

Querying the current pause mode

current = pause('query');   % returns 'on' or 'off'

Using empty input to rely on the default behaviour

pause([]);   % equivalent to calling pause with no arguments

Using pause with coding agents

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

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

FAQ

Does pause block forever when standard input is not interactive?⌄

No. When RunMat detects a non-interactive standard input (for example, during automated tests), pause completes immediately even in 'on' mode.

What happens if I call pause with a negative duration?⌄

RunMat raises RunMat:pause:InvalidInputArgument, matching MATLAB.

Does pause accept logical or integer values?⌄

Yes. Every built-in integer class is accepted. RunMat validates the authoritative scalar first and converts only at the explicit host timer boundary; logical scalars remain supported by the runtime.

Can I force pausing off globally?⌄

Use pause('off') to disable pauses. Record the return value so you can restore the prior state with pause(previousState).

Does pause('query') change the pause state?⌄

No. It simply reports the current mode ('on' or 'off').

Is pause affected by GPU fusion or auto-offload?⌄

It never enters a timing fusion or GPU kernel. Automatically resident input can still require an owner-aware provider download before host timing.

What is the default pause state?⌄

'on'. Every RunMat session starts with pausing enabled.

Can I pass a gpuArray as the duration?⌄

RunMat mode supports an explicitly supplied gpuArray duration as a gated extension and gathers it through its owning provider. Internal automatic residency remains transparent in MATLAB-compatible mode.

Related Timing functions

cputime · tic · timeit · timer · timerfind · timerfindall · toc

Open-source implementation

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

  • View the source for pause 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 pause works
  • Does RunMat run pause on the GPU?
  • GPU memory and residency
  • Examples
  • Pausing for a fixed duration
  • Waiting for user input mid-script
  • Temporarily disabling pauses in automated runs
  • Querying the current pause mode
  • Using empty input to rely on the default behaviour
  • Using pause with coding agents
  • FAQ
  • Related Timing functions
  • Open-source implementation
  • About RunMat