RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

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.

/
See all docs
Builtin Reference
    • codistributed
    • codistributed.build
    • codistributor
    • codistributor1d
    • codistributor2dbc
    • distributed
    • fetchNext
    • fetchOutputs
    • gcat
    • gcp
    • getCodistributor
    • getCurrentJob
    • getCurrentTask
    • getCurrentWorker
    • getLocalPart
    • globalIndices
    • gop
    • gplus
    • iscodistributed
    • isComplete
    • labBarrier
    • labBroadcast
    • labindex
    • labProbe
    • labReceive
    • labSend
    • labSendReceive
    • numlabs
    • parfeval
    • parfevalOnAll
    • parpool
    • redistribute
    • spmdBarrier
    • spmdBroadcast
    • spmdCat
    • spmdIndex
    • spmdPlus
    • spmdProbe
    • spmdReceive
    • spmdReduce
    • spmdSend
    • spmdSendReceive
    • spmdSize

parfevalOnAll — Schedule one function invocation on every worker in a pool.

parfevalOnAll creates one aggregate future for a callable scheduled once on each admitted worker.

Syntax

future = parfevalOnAll(pool, function, outputs, arguments...)
future = parfevalOnAll(function, outputs, arguments...)

Inputs

pool
Type
Any
Required
Yes
Default
—
Description
Pool on which the function is scheduled.
function
Type
Any
Required
Yes
Default
—
Description
Function handle to execute.
outputs
Type
IntegerScalar
Required
Yes
Default
—
Description
Number of requested function outputs.
arguments
Type
Any
Required
Variadic
Default
—
Description
Arguments supplied to the scheduled function.
function
Type
Any
Required
Yes
Default
—
Description
Function handle to execute on the current or automatic pool.
NameTypeRequiredDefaultDescription
poolAnyYes—Pool on which the function is scheduled.
functionAnyYes—Function handle to execute.
outputsIntegerScalarYes—Number of requested function outputs.
argumentsAnyVariadic—Arguments supplied to the scheduled function.
functionAnyYes—Function handle to execute on the current or automatic pool.

Returns

future
Type
Any
Description
Future representing the scheduled invocation.
NameTypeDescription
futureAnyFuture representing the scheduled invocation.

Errors

RunMat:parallel:LoweringRequired
When
The call bypasses the executor's semantic async lowering path.
Message
parallel call requires executor-aware lowering
IdentifierWhenMessage
RunMat:parallel:LoweringRequiredThe call bypasses the executor's semantic async lowering path.parallel call requires executor-aware lowering

Behavior

The scheduler freezes the callable identity, requested output count, arguments, executable bundle, and pool generation into a typed work request. The returned future records its state, outputs, failure, cancellation, and owning generation.

Omitting the pool uses the current pool or creates an automatic one. Worker and transport failures retain structured error identity and source information; program errors are not retried as infrastructure failures.

Execution placement

Scheduling does not reinterpret the callable on a worker. The worker executes the compiler-owned function identity and transferred values using the host adapter selected by the pool.

Example

Schedule one invocation per worker

pool = parpool(2);
future = parfevalOnAll(pool, @(x) x + 2, 1, 5);
answers = fetchOutputs(future)

Expected output:

answers contains one value 7 per worker

Using parfevalOnAll with coding agents

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

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

FAQ

What does the output-count argument mean?⌄

It is the number of outputs requested from the scheduled callable and retained by the future.

Can I omit the pool?⌄

Yes. RunMat uses the current compatible pool or creates an automatic pool.

Can a future outlive its pool?⌄

No. It is fenced to the pool generation that scheduled it.

How are worker failures reported?⌄

Structured identifiers, messages, call stacks, and source locations cross the execution boundary.

Related Parallel functions

codistributed · codistributed.build · codistributor · codistributor1d · codistributor2dbc · distributed · fetchNext · fetchOutputs · gcat · gcp · getCodistributor · getCurrentJob · getCurrentTask · getCurrentWorker · getLocalPart · globalIndices · gop · gplus · iscodistributed · isComplete · labBarrier · labBroadcast · labindex · labProbe · labReceive · labSend · labSendReceive · numlabs · parfeval · parpool · redistribute · spmdBarrier · spmdBroadcast · spmdCat · spmdIndex · spmdPlus · spmdProbe · spmdReceive · spmdReduce · spmdSend · spmdSendReceive · spmdSize

Related guides

  • Parallel execution

Source you can read

Every RunMat function's source is public. Read exactly how parfevalOnAll is executed, line by line, in Rust.

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

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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
  • Behavior
  • Execution placement
  • Example
  • Schedule one invocation per worker
  • Using parfevalOnAll with coding agents
  • FAQ
  • Related Parallel functions
  • Related guides
  • Source you can read
  • About RunMat