gpuInfo — Return a formatted status string for the active acceleration provider.
gpuInfo() formats the same provider metadata projection used by gpuDevice() into a host GPU[key=value, ...] string. With no provider it returns GPU[no provider].
Syntax
summary = gpuInfo()Returns
summary- Type
StringScalar- Description
- Formatted text summary for the active provider/device.
Errors
RunMat:gpuInfo:TooManyInputs- When
- An input argument was supplied to gpuInfo().
- Message
gpuInfo: too many input arguments
Behavior
gpuInfo() accepts no inputs and returns one host string. It reads the provider registered for this call, without initializing or changing the provider, moving arrays, or enqueuing GPU kernels.
The summary contains device_id, index, name, vendor, precision, and supports_double; backend and memory_bytes appear only when supplied by the provider. Numeric and logical fields are unquoted; string fields are single-quoted and embedded single quotes are doubled. Device IDs are assigned by the provider and should not be compared with a hard-coded zero.
If no provider is registered, the result is exactly GPU[no provider]. Unlike gpuDevice, this absence is a valid result, not an error. Both builtins use the same typed metadata projection, but neither dispatches through the other builtin's public error identity.
The field order follows the metadata struct's field iteration order; do not parse the summary as a stable machine protocol. To inspect selected provider execution precision, use gpuDevice().precision or gpuDevice().supports_double instead of searching text; these fields do not establish adapter-wide double-precision hardware capability.
Examples
Display provider status
disp(gpuInfo())
Write a log line
fprintf('Running on %s\n', gpuInfo())
Check for a missing provider
status = gpuInfo();
if strcmp(status, 'GPU[no provider]'); disp('Acceleration disabled'); end
Inspect selected execution precision
info = gpuDevice();
if info.supports_double; disp('double'); else; disp('single'); end
Display an optional memory hint
info = gpuDevice();
if isfield(info, 'memory_bytes'); disp(info.memory_bytes); else; disp('memory unknown'); end
Residency
gpuInfo is a read-only metadata query and leaves existing host and resident arrays untouched. Use gpuArray and gather for explicit data transfer. The result itself is a host string.
Examples
Display provider status
status = gpuInfo(); disp(status);Write a status line
status = gpuInfo(); fprintf('Running on %s\n', status);Handle an absent provider
status = gpuInfo(); missing = strcmp(status, 'GPU[no provider]');Inspect selected execution precision
info = gpuDevice(); status = gpuInfo();Inspect optional memory metadata
info = gpuDevice(); status = gpuInfo(); if isfield(info, 'memory_bytes'); bytes = info.memory_bytes; else; bytes = uint64(0); endUsing 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 reads provider metadata and formats a host string; it performs no allocation, transfer, or kernel work.
What happens without a provider?⌄
It returns exactly GPU[no provider], so callers can branch without catching an error.
How is it different from gpuDevice?⌄
gpuDevice returns a struct for programmatic inspection and errors when no provider exists. gpuInfo returns formatted text and has a valid no-provider result.
Is field order stable?⌄
It follows the current metadata struct's field iteration order, but the summary is for display rather than a stable protocol; use struct fields for programs.
How are strings escaped?⌄
Single quotes are doubled within quoted string field values, so a name such as Ada'GPU displays as Ada''GPU.
Related Acceleration functions
Source you can read
Every RunMat function's source is public. 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 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.