Cálculo por GPU con MATLAB
R2026b Acelerar el código ejecutando funciones de MATLAB® en una GPU
Si todas las funciones que desea utilizar son compatibles con la GPU, basta con utilizar gpuArray para transferir los datos de entrada a la GPU. Para empezar a utilizar el cálculo por GPU, consulte Ejecutar funciones de MATLAB en una GPU.
Para Deep Learning, MATLAB permite utilizar múltiples GPU en paralelo automáticamente. Consulte Deep Learning with MATLAB on Multiple GPUs (Deep Learning Toolbox).
Puede utilizar la función gpuDevice para inspeccionar y seleccionar la GPU, y la función gpuDeviceTable para inspeccionar múltiples GPU.
Funciones
Herramientas
| GPU Monitor | Monitor GPU utilization, memory usage, and processes (Desde R2026b) |
Temas
Ejecutar código de MATLAB en una GPU
- Ejecutar funciones de MATLAB en una GPU
Proporcione un argumentogpuArraypara ejecutar funciones en una GPU automáticamente. - Identificar y seleccionar un dispositivo GPU
Este ejemplo muestra cómo utilizargpuDevicepara identificar y seleccionar el dispositivo que desea utilizar. - Requisitos del cálculo por GPU
Compatibilidad con arquitecturas de GPU de NVIDIA®. - Establish Arrays on a GPU
UsegpuArrayobjects to store data on the GPU and perform calculation on the GPU. - Run MATLAB Functions on Multiple GPUs
This example shows how to run MATLAB® code on multiple GPUs in parallel, first on your local machine, then scaling up to a cluster. - Work with Remote GPUs
This example shows how to run MATLAB® code on multiple remote GPUs in a cluster. (Desde R2024a) - Run MATLAB Using GPUs in the Cloud
Take advantage of powerful GPUs in the cloud to accelerate your code. - Write Portable GPU Code
This example shows how to write robust code that can run on machines with or without a GPU. - Work with Sparse Arrays on a GPU
Learn about the conditions for working with sparse arrays on a GPU. - Work with Complex Numbers on a GPU
Learn about the conditions for applying functions that might return complex values on a GPU.
Cálculo por GPU con MATLAB y Python
- Pass GPU Data Between MATLAB and Python
Transfer GPU data seamlessly between MATLAB and Python®. (Desde R2026b)
Mejorar el rendimiento en la GPU
- Measure and Improve GPU Performance
Time code running on your GPU and explore options for improving performance. - Improve Performance Using GPU Monitor Metrics
Improve your GPU performance by understanding the results shown by the GPU Monitor. - Improve Performance Using a GPU and Vectorized Calculations
This example shows you how to improve performance by running a function on the GPU instead of the CPU, and by vectorizing the calculations. - Improve Performance of Element-Wise MATLAB Functions on the GPU Using arrayfun
This example shows how to improve the performance of your code by running MATLAB® functions on the GPU usingarrayfun. - Improve Performance of Small Matrix Problems on the GPU Using pagefun
This example shows how to usepagefunto improve the performance of independent operations applied to multiple matrices arranged in a multidimensional array. - Benchmark A\b on the GPU
This example shows how to benchmark the solving of a linear system on the GPU.
Más Información
- Perfilar código para mejorar el rendimiento
Utilice Profiler para medir cuánto tiempo lleva ejecutar código e identificar qué líneas de código consumen la mayor parte del tiempo o qué líneas no se ejecutan. - Vectorización
Revise el código basado en bucles y orientado a escalares para usar las operaciones matriciales y vectoriales de MATLAB. - Control Random Number Generation Across GPU and CPU
Control the random number streams on a GPU to generate the same sequences of random numbers as on the CPU. - Compare GPU Random Number Generator Algorithms
This example shows how to switch between and compare the different random number generators that are supported on the GPU. - Stencil Operations on a GPU
This example uses Conway's Game of Life to demonstrate how stencil operations can be performed using a GPU. - Compute the Mandelbrot Set Using GPU-Enabled Functions
This example shows how to use GPU-enabled MATLAB® functions to compute a well-known mathematical construction: the Mandelbrot set.





