Main Content

GPU Computing

Accelerate your code by running it on a GPU

You can speed up your code by running MATLAB® functions on a GPU. If the functions that you want to use support GPU execution, 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.

If running MATLAB functions on the GPU does not sufficiently speed up your code, or if you need to use advanced GPU CUDA® features, you can write your own CUDA code and run it in MATLAB by generating an executable MEX file using mexcuda or an executable kernel using parallel.gpu.CUDAKernel.

Categories