RunMat
GitHub

isgpuarray — Test whether values are gpuArray handles in MATLAB and RunMat.

tf = isgpuarray(x) returns true when x is a gpuArray handle and false for other value types, following MATLAB semantics.

Syntax

tf = isgpuarray(A)

Inputs

NameTypeRequiredDefaultDescription
AAnyYesInput value to test.

Returns

NameTypeDescription
tfLogicalArrayTrue when input is a gpuArray handle.

How isgpuarray works

  • gpuArray values return true without gathering device buffers.
  • Numeric, logical, complex, string, character, struct, cell, and object inputs return false.
  • The result is always a logical scalar.

Does RunMat run isgpuarray on the GPU?

The builtin only checks whether the value is a gpuArray handle. It never gathers device buffers or inspects the underlying data contents.

GPU memory and residency

RunMat keeps data on the GPU when a provider is active, and isgpuarray lets you verify residency boundaries in MATLAB-style code.

Examples

Checking a gpuArray handle

G = gpuArray(reshape(1:12, [3 4]));
tf = isgpuarray(G)

Expected output:

tf =
     1

Host arrays are not gpuArray values

A = [1 2 3];
tf = isgpuarray(A)

Expected output:

tf =
     0

Using isgpuarray with coding agents

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

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

FAQ

Does isgpuarray gather data back to the host?

No. It inspects value metadata and returns a logical scalar without triggering a device transfer.

What happens if no acceleration provider is registered?

isgpuarray still reports accurately for values that are already gpuArray handles. If a value is not a gpuArray handle, it returns false.

Bit

and · not · or · xor

Rel

eq · ge · gt · isequal · le · lt · ne

Logical

logical

Open-source implementation

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

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.