gpuInfo — Return formatted GPU provider status in MATLAB and RunMat.
gpuInfo() returns a concise status string describing the active GPU acceleration provider. It is a convenience wrapper around gpuDevice for logging and interactive diagnostics.
Syntax
summary = gpuInfo()Returns
| Name | Type | Description |
|---|---|---|
summary | StringScalar | Formatted text summary for the active provider/device. |
How gpuInfo works
- Queries the same device metadata as
gpuDevice()and formats the fields intoGPU[key=value, ...]. - Includes identifiers (
device_id,index), descriptive strings (name,vendor,backend) and capability hints (precision,supports_double,memory_byteswhen available). - Escapes string values using MATLAB-style single quote doubling so they are display-friendly.
- When no acceleration provider is registered, returns the placeholder string
GPU[no provider]instead of throwing an error, making it safe to call unconditionally. - Propagates unexpected errors (for example, if a provider fails while reporting metadata) so they can be diagnosed.
GPU memory and residency
gpuInfo is a pure metadata query and never changes residency. Arrays stay wherever they already live (GPU or CPU). Use gpuArray, gather, or RunMat Accelerate's auto-offload heuristics to move data between devices as needed.
Examples
Displaying GPU status in the REPL
disp(gpuInfo())Expected output:
GPU[device_id=0, index=1, name='InProcess', vendor='RunMat', backend='inprocess', precision='double', supports_double=true]Emitting a log line before a computation
fprintf("Running on %s\n", gpuInfo())Expected output:
Running on GPU[device_id=0, index=1, name='InProcess', vendor='RunMat', backend='inprocess', precision='double', supports_double=true]Checking for double precision support quickly
summary = gpuInfo();
if contains(summary, "supports_double=true")
disp("Double precision kernels available.");
else
disp("Falling back to single precision.");
endHandling missing providers gracefully
% Safe even when acceleration is disabled
status = gpuInfo();
if status == "GPU[no provider]"
warning("GPU acceleration is currently disabled.");
endCombining gpuInfo with gpuDevice for structured data
info = gpuDevice();
summary = gpuInfo();
if isfield(info, 'memory_bytes')
fprintf("%s (memory: %.2f GB)\n", summary, info.memory_bytes / 1e9);
else
fprintf("%s (memory: unknown)\n", summary);
endExpected output:
GPU[device_id=0, index=1, name='InProcess', vendor='RunMat', backend='inprocess', precision='double', supports_double=true] (memory: 15.99 GB)Using gpuInfo with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how gpuInfo changes the result.
Run a small gpuInfo example, explain the result, then change one input and compare the output.
FAQ
Does gpuInfo change GPU state?⌄
No. It only reads metadata and formats it into a string.
Will gpuInfo throw an error when no provider is registered?⌄
No. It returns GPU[no provider] so caller code can branch without exception handling.
How is gpuInfo different from gpuDevice?⌄
gpuDevice returns a struct that you can inspect programmatically. gpuInfo formats the same information into a single string that is convenient for logging and display.
Does the output order of fields stay stable?⌄
Yes. Fields are emitted in the same order as the gpuDevice struct: identifiers, descriptive strings, optional metadata, precision, and capability flags.
Are strings escaped in MATLAB style?⌄
Yes. Single quotes are doubled (e.g., Ada'GPU becomes Ada''GPU) so the summary can be pasted back into MATLAB code without breaking literal syntax.
Related Acceleration functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how gpuInfo is executed, line by line, in Rust.
- View the source for gpuInfo 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.