Main Content

GPU Computing in MATLAB

Accelerate your code by running MATLAB® functions on a GPU

If all the functions that you want to use are supported on the GPU, you can simply use gpuArray to transfer input data to the GPU. To get started with GPU computing, see Run MATLAB Functions on a GPU.

For deep learning, MATLAB provides automatic parallel support for multiple GPUs. See Deep Learning with MATLAB on Multiple GPUs (Deep Learning Toolbox).

You can use the gpuDevice function inspect and select your GPU and use the gpuDeviceTable functions to inspect multiple GPUs.


expand all

gpuArrayArray stored on GPU
gatherTransfer distributed array, Composite object, or gpuArray object to local workspace
gpuDeviceQuery or select a GPU device
GPUDeviceManagerManager for GPU Devices
gpuDeviceCountNumber of GPU devices present
gpuDeviceTableTable of properties of GPU devices (Since R2021a)
wait (GPUDevice)Wait for GPU calculation to complete
gputimeitTime required to run function on GPU
existsOnGPUDetermine if gpuArray or CUDAKernel is available on GPU
isgpuarrayDetermine whether input is gpuArray (Since R2020b)
arrayfunApply function to each element of array on GPU
pagefunApply function to each page of distributed or GPU array
gpurngControl random number generation on the GPU
resetReset GPU device and clear its memory
parallel.gpu.RandStreamRandom number stream on a GPU
parallel.gpu.enableCUDAForwardCompatibilityQuery and set forward compatibility for GPU devices (Since R2020b)


Run MATLAB Code on GPU

Improve Performance on GPU

Learn More

Related Information