Main Content
GPU CUDA and MEX Programming
Further accelerate your code using advanced GPU CUDA® and MEX programming
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
.
Generally, using MEX files is more flexible than using CUDAKernel
objects. For more information, see Run MEX Functions Containing CUDA Code.
Functions
Topics
- Run MEX Functions Containing CUDA Code
All MEX files, including those containing CUDA code, have a single entry point known as
mexFunction
. - Run CUDA or PTX Code on GPU
This page explains how to create an executable kernel from a CUDA C++ source file (CU) file and run that kernel on a GPU in MATLAB.