Back to Blog

How to Use a GPU with MATLAB: NVIDIA, Apple Silicon, AMD & Intel

Published01/28/2026
Updated 08/20/2026
7 min read

MATLAB's official numerical GPU path is straightforward when you have a supported NVIDIA GPU: install a current NVIDIA driver, use the Parallel Computing Toolbox, and pass gpuArray inputs to supported functions. Apple, AMD, and Intel GPUs are not supported by that path.

One distinction matters before setup: ordinary gpuArray use does not require you to install the CUDA Toolkit separately. MATLAB includes the CUDA components it needs for supported GPU functions. A separate toolkit is optional for workflows that need additional CUDA libraries or custom CUDA code.

Choose the path for your hardware

HardwareMATLAB numerical GPU pathAnother path for supported MATLAB-syntax work
Supported NVIDIA GPUParallel Computing Toolbox with gpuArrayRunMat through WGPU, subject to adapter and operation support
Apple Silicon GPUNot supported by gpuArrayRunMat through Metal or browser WebGPU
AMD GPUNot supported by gpuArrayRunMat through DirectX 12, Vulkan, or browser WebGPU
Intel GPUNot supported by gpuArrayRunMat through DirectX 12, Vulkan, or browser WebGPU

MATLAB still runs on the CPU on all four platforms. The table only describes numerical GPU execution through gpuArray and the alternative RunMat path.

Using an NVIDIA GPU with MATLAB

For the current MATLAB release, MathWorks lists three practical requirements:

  1. A supported NVIDIA GPU architecture.
  2. A current NVIDIA graphics driver.
  3. A Parallel Computing Toolbox license.

For R2026a, the documented architecture range is CUDA compute capability 5.0 through 12.x. That range changes over time, so use the GPU Computing Requirements page for the release installed on your machine instead of relying on a card-year rule.

Recent releases include validateGPU for diagnosing the setup. gpuDeviceTable and gpuDevice show the adapters MATLAB can use:

validateGPU
gpuDeviceTable
gpuDevice

Once MATLAB sees the device, create data directly on it or transfer an existing array:

rng(0);
x = gpuArray.rand(10_000_000, 1, 'single');
y = sin(x) .* x + 0.5;
m = mean(y, 'all');
fprintf("m = %.6f\n", gather(m));

Functions only run on the GPU when their documentation supports gpuArray inputs. MathWorks maintains the current list in Run MATLAB Functions on a GPU.

When the CUDA Toolkit is actually relevant

MATLAB ships the NVIDIA compiler and runtime components required for its supported GPU functions and CUDA-enabled MEX generation. MathWorks says a separate CUDA Toolkit installation is optional. You may need one when custom CUDA code depends on a library that MATLAB does not include or when a specific CUDA development workflow requires it. The required toolkit version must match the MATLAB release. See Install CUDA Toolkit (Optional).

This distinction also applies to troubleshooting. A missing separately installed toolkit is not the first thing to check when gpuArray fails. Start with the supported-device range, NVIDIA driver, toolbox license, and validateGPU output.

Apple Silicon Macs

MATLAB runs natively on Apple Silicon CPUs, but Parallel Computing Toolbox does not use Apple GPUs for gpuArray calculations. Apple's GPUs do not provide the NVIDIA CUDA architecture that MATLAB's documented GPU path requires.

That leaves three practical choices:

  • Run the MATLAB calculation on the Mac CPU.
  • Run MATLAB on a separate system or cloud environment with supported NVIDIA hardware and the required licensing.
  • Evaluate a different runtime that supports the required operations on Metal or WebGPU.

The right choice depends on more than peak GPU throughput. Data movement, supported operations, precision, memory capacity, and the cost of validating results on a different runtime can dominate the decision.

AMD and Intel GPUs

MATLAB's documented gpuArray path does not support AMD Radeon/Instinct or Intel Arc/integrated GPUs. Installing ROCm or oneAPI does not add those devices as Parallel Computing Toolbox backends.

You can still use MATLAB on the CPU, move the workload to supported NVIDIA hardware, or evaluate another runtime. Treat the GPU vendor as only the first compatibility check. The exact adapter, operating system, graphics driver, data type, and required operations determine whether an alternative backend can execute the workload.

Using RunMat on a non-CUDA GPU

RunMat can route suitable supported array operations through its WGPU provider. WGPU maps to Metal on macOS, DirectX 12 on Windows, Vulkan or another available native backend on Linux, and WebGPU in supported browsers.

You write supported MATLAB-syntax array code without adding gpuArray or gather calls:

rng(0);
x = rand(10_000_000, 1, 'single');
y = sin(x) .* x + 0.5;
m = mean(y, 'all');
fprintf("m = %.6f\n", double(m));

The runtime decides whether each eligible operation or fused chain should stay on the CPU or move to the active provider. Unsupported operations can fall back to host implementations, and GPU initialization can fail when the adapter or driver does not expose the limits RunMat needs. This is an opportunistic execution path, not a guarantee that every operation or GPU will accelerate.

Before benchmarking a real script:

  1. Check language and builtin coverage with RunMat compatibility documentation.
  2. Run runmat accel-info to inspect the native adapter and active backend, or use the browser sandbox on a WebGPU-capable browser.
  3. Compare results with the accepted reference using a tolerance appropriate to the workload.
  4. Measure the full workflow on the same machine, including any file I/O and result transfer that production use requires.

The GPU architecture documentation describes automatic promotion, fusion, device residency, and CPU fallback in more detail.

Measure before deciding

GPU launches and host-device transfers add fixed costs. A GPU can lose to a CPU on a small array and win on a larger version of the same operation, but there is no portable element-count threshold. Hardware, operation mix, memory layout, precision, kernel coverage, and existing data residency all change the break-even point.

MATLAB's gputimeit runs a function repeatedly and waits for GPU work to finish before recording time:

x = gpuArray.rand(10_000_000, 1, 'single');
f = @() sin(x) .* x + 0.5;
seconds = gputimeit(f)

For a multi-step workflow, synchronize the device before and after the timed region. Do not print, plot, or gather an intermediate inside a hot loop unless the application actually requires it. MathWorks documents the timing options and their limitations in Measure and Improve GPU Performance.

The same measurement rule applies to RunMat. Record the RunMat version, adapter, backend, precision, warmup policy, repetitions, and correctness tolerance. Compare complete wall-clock time rather than extrapolating from peak TFLOPS.

Choose precision from the numerical requirement

Single precision uses half the storage of double precision and often runs faster on GPUs. That does not make it a safe default for every scientific workload. Ill-conditioned systems, long accumulations, and algorithms with tight error budgets may require double precision or a validated mixed-precision design.

MATLAB's double-precision GPU performance depends on the NVIDIA device. RunMat's available precision depends on what the active provider advertises; operations that cannot run at the required precision must stay on the CPU or use an explicitly accepted downcast policy. Validate the final result against the error budget of the actual model.

FAQ

Do I need to install the CUDA Toolkit to use a GPU with MATLAB?

No. Ordinary MATLAB functions that support gpuArray need Parallel Computing Toolbox, supported NVIDIA hardware, and a current driver. MathWorks documents a separate CUDA Toolkit installation as optional for additional libraries and custom CUDA workflows.

Can MATLAB use the GPU on an Apple Silicon Mac?

MATLAB's gpuArray path does not support Apple GPUs. Parallel Computing Toolbox GPU computing currently requires a supported NVIDIA GPU. MATLAB still runs natively on Apple Silicon CPUs.

Can MATLAB use an AMD or Intel GPU for gpuArray calculations?

No. MATLAB's documented gpuArray path currently supports NVIDIA GPUs, not AMD or Intel GPUs. Those systems can still run MATLAB calculations on the CPU.

Can I use gpuArray without the Parallel Computing Toolbox?

No. gpuArray and MATLAB's standard numerical GPU workflow require the toolbox.

What NVIDIA GPU does the current MATLAB release support?

Check the requirements for your installed release. For R2026a, MathWorks documents NVIDIA compute capability 5.0 through 12.x and recommends the latest NVIDIA driver.

Can RunMat accelerate code on Apple, AMD, Intel, or NVIDIA GPUs?

RunMat can use WGPU on compatible adapters for suitable supported operations. Backend availability, precision, operation coverage, and workload size determine whether the work reaches the GPU or falls back to the CPU.

Why is my GPU slower than my CPU?

The workload may be too small to amortize upload and launch costs, may transfer data too often, or may include operations that fall back to the CPU. Measure the complete workload with correct synchronization before changing the implementation.

Should I use single or double precision?

Use the precision required by your algorithm and validation tolerance. Benchmark only after correctness is established.

Enjoyed this post? Join the newsletter

Monthly updates on RunMat internals, development, and performance tips.

Use RunMat for free

RunMat is free to use in your browser, on Desktop, or with the CLI.