RunMat
GitHub

isgpuarray — Return true when a value is stored as a gpuArray handle.

tf = isgpuarray(x) returns a logical scalar that is true when x is a gpuArray handle. All other value kinds, including numeric arrays, logical arrays, characters, structs, and objects, return false.

How isgpuarray works in RunMat

  • 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.

How isgpuarray runs 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

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.

These functions work well alongside isgpuarray. Each page has runnable examples you can try in the browser.

gpuArray, gather, islogical, isa, isfinite, isinf, isnan, isnumeric, isreal

Open-source implementation

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

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.

  • Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
  • Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
  • A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.

Getting started · Benchmarks · Pricing

Try RunMat — free, no sign-up

Start running MATLAB code immediately in your browser.