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

gplus — Sum values across the active labs.

gplus applies the compatible typed addition semantics across the active lab gang.

Syntax

value = gplus(value, destination)

Inputs

value
Type
Any
Required
Yes
Default
—
Description
Value operated on by the parallel runtime.
lab
Type
IntegerScalar
Required
No
Default
—
Description
Optional one-based source lab index.
NameTypeRequiredDefaultDescription
valueAnyYes—Value operated on by the parallel runtime.
labIntegerScalarNo—Optional one-based source lab index.

Returns

result
Type
Any
Description
Result produced by the parallel operation.
NameTypeDescription
resultAnyResult produced by the parallel operation.

Errors

RunMat:parallel:LoweringRequired
When
The operation is invoked without an active compiler-owned SPMD or distributed execution context.
Message
parallel operation requires executor-aware lowering
IdentifierWhenMessage
RunMat:parallel:LoweringRequiredThe operation is invoked without an active compiler-owned SPMD or distributed execution context.parallel operation requires executor-aware lowering

SPMD execution

Collective and point-to-point functions run inside an active spmd region. Ranks are one-based within the admitted worker gang. Every rank follows the compiler-owned operation order, which keeps matching calls deterministic across local, browser, isolated-process, and remote execution.

The spmd* names are the current surface. The corresponding lab*, gplus, gcat, and gop names remain compatible spellings with the same execution and value semantics.

Values and messages

Messages use RunMat's canonical execution codec. Supported values retain their class, shape, container structure, and exact integer payload; a transfer does not route typed data through double.

Source and destination ranks must identify members of the active gang. Tags are exact nonnegative integers and default to zero when omitted. A receive may select a particular source and tag; spmdProbe and labProbe test the same selection without consuming a message.

Aggregate results

An aggregate without a destination returns the result to every rank. With a destination, the result is delivered to that rank and the other ranks receive the operation's documented empty result. Concatenation uses the requested one-based dimension, and functional reductions require an associative binary callable.

Failures and cancellation

A collective used outside compiler-owned SPMD execution returns a structured lowering error. Invalid ranks, tags, dimensions, reducers, mismatched operation order, worker failure, cancellation, and an unsatisfied communication dependency terminate the gang with a structured parallel error instead of waiting indefinitely.

Example

Sum a typed value across two workers

pool = parpool(2);
spmd
    total = gplus(uint32(labindex));
end

Expected output:

both workers receive uint32(3)

Using gplus with coding agents

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

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

FAQ

Where can these functions run?⌄

Inside an active spmd region. They are lowered with the region's worker-gang identity and operation sequence.

Are ranks zero-based?⌄

No. Rank values are one-based within the active SPMD gang.

Do messages preserve integer classes?⌄

Yes. The execution codec preserves supported typed values, including exact fixed-width integer payloads.

What happens when destination is omitted from an aggregate?⌄

The aggregate result is returned to every rank.

Can an unmatched communication wait forever?⌄

No. RunMat detects an unsatisfied gang communication dependency and reports a structured parallel error.

Related Parallel functions

codistributed · codistributed.build · codistributor · codistributor1d · codistributor2dbc · distributed · fetchNext · fetchOutputs · gcat · gcp · getCodistributor · getCurrentJob · getCurrentTask · getCurrentWorker · getLocalPart · globalIndices · gop · 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

Related guides

  • Parallel execution

Source you can read

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

  • View the source for gplus 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
  • SPMD execution
  • Values and messages
  • Aggregate results
  • Failures and cancellation
  • Example
  • Sum a typed value across two workers
  • Using gplus with coding agents
  • FAQ
  • Related Parallel functions
  • Related guides
  • Source you can read
  • About RunMat